From a9621bc98996e08d86734e6848de13223341ea64 Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 6 Aug 2006 15:26:16 +0000 Subject: Fix CIDR functions so they work git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4731 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/inspircd.cpp | 59 ++++++-------------------------------------------------- 1 file changed, 6 insertions(+), 53 deletions(-) (limited to 'src/inspircd.cpp') diff --git a/src/inspircd.cpp b/src/inspircd.cpp index a34f438f9..09cd74d69 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -940,61 +940,14 @@ int InspIRCd::Run() int main(int argc, char** argv) { - /* TEST SUITE FOR TOKENSTREAM - * - * Expected output: - * - * String: 'PRIVMSG #test FOO BAR' - * Token 0 = 'PRIVMSG' - * Token 1 = '#test' - * Token 2 = 'FOO' - * Token 3 = 'BAR' - * String: 'PRIVMSG #test :FOO BAR BAZ' - * Token 0 = 'PRIVMSG' - * Token 1 = '#test' - * Token 2 = 'FOO BAR BAZ' - * String: ':PRIVMSG #test :FOO BAR BAZ' - * Token 0 = ':PRIVMSG' - * String: 'AAAAAAA' - * Token 0 = 'AAAAAAA' - * String: '' - * NumItems = 0 - * - std::string a = "PRIVMSG #test FOO BAR"; - printf("String: '%s'\n",a.c_str()); - irc::tokenstream test(a); - printf("Token 0 = '%s'\n",test.GetToken().c_str()); - printf("Token 1 = '%s'\n",test.GetToken().c_str()); - printf("Token 2 = '%s'\n",test.GetToken().c_str()); - printf("Token 3 = '%s'\n",test.GetToken().c_str()); - printf("Token 4 = '%s'\n",test.GetToken().c_str()); - - std::string b = "PRIVMSG #test :FOO BAR BAZ"; - printf("String: '%s'\n",b.c_str()); - irc::tokenstream test2(b); - printf("Token 0 = '%s'\n",test2.GetToken().c_str()); - printf("Token 1 = '%s'\n",test2.GetToken().c_str()); - printf("Token 2 = '%s'\n",test2.GetToken().c_str()); - printf("Token 3 = '%s'\n",test2.GetToken().c_str()); - - std::string c = ":PRIVMSG #test :FOO BAR BAZ"; - printf("String: '%s'\n",c.c_str()); - irc::tokenstream test3(c); - printf("Token 0 = '%s'\n",test3.GetToken().c_str()); - - c = "AAAAAAA"; - printf("String: '%s'\n",c.c_str()); - irc::tokenstream test4(c); - printf("Token 0 = '%s'\n",test4.GetToken().c_str()); - printf("Token 1 = '%s'\n",test4.GetToken().c_str()); - - c = ""; - printf("String: '%s'\n",c.c_str()); - irc::tokenstream test5(c); - printf("Token 0 = '%s'\n",test5.GetToken().c_str()); + + unsigned char addr[] = {0xCC,0xAA,0xCC,0xAA}; + unsigned char mask[] = {0xCC,0xAA,0xC0,0xAA}; + + printf("%d",MatchCIDRBits(addr, mask, 20)); exit(0); - */ + try { ServerInstance = new InspIRCd(argc, argv); -- cgit v1.2.3