Mercurial > dnsbl
comparison src/scanner.cpp @ 18:041ea016b684
add scanning for bare hostnames
author | carl |
---|---|
date | Fri, 30 Apr 2004 00:32:44 -0700 |
parents | b6a4b72bb96e |
children | b8f5fa3dd5b8 |
comparison
equal
deleted
inserted
replaced
17:b6a4b72bb96e | 18:041ea016b684 |
---|---|
879 switch (st) { | 879 switch (st) { |
880 | 880 |
881 ////////////////////////////// | 881 ////////////////////////////// |
882 // host name recognizer | 882 // host name recognizer |
883 case h_end: { | 883 case h_end: { |
884 count--; | 884 pending[--count] = '\0'; // null terminate host name by overwriting the terminator |
885 pending[count] = 0; | |
886 char *tld; | 885 char *tld; |
887 for (int i=0; (tld = tlds[i]); i++) { | 886 for (int i=0; (tld = tlds[i]); i++) { |
888 int n = strlen(tld); | 887 int n = strlen(tld); |
889 if (count > n) { | 888 if (count > n) { |
890 if (strncasecmp((const char *)(pending+count-n), tld, n) == 0) { | 889 if (strncasecmp((const char *)(pending+count-n), tld, n) == 0) { |
894 } | 893 } |
895 } | 894 } |
896 } // fall thru | 895 } // fall thru |
897 | 896 |
898 case h_init: { | 897 case h_init: { |
899 count = 0; | 898 count = 0; |
900 } break; | 899 } break; |
901 | 900 |
902 ////////////////////////////// | 901 ////////////////////////////// |
903 // html tag { discarder | 902 // html tag discarder |
904 case t_end: | 903 case t_end: { |
905 st = t_init; | 904 st = t_init; |
906 // fall thru | 905 } // fall thru |
907 | 906 |
908 case t_disc: { | 907 case t_disc: { |
909 count = 0; | 908 count = 0; // discard all characters |
910 } break; | 909 } break; |
911 | 910 |
912 case t_init: { | 911 case t_init: { |
913 pusher(); | 912 pusher(); |
914 } break; | 913 } break; |