diff -r 23a242d7b7fa -r 51eb85ae4de4 util.c --- a/util.c Mon Oct 31 17:17:07 2011 -0700 +++ b/util.c Fri Nov 04 20:34:28 2011 -0700 @@ -40,6 +40,7 @@ { printf( "%s [-vh] [-f ] [-d ]\n", prg ); printf( " -d Show debug information on stderr\n" ); + printf( " -c Create the volta database from a rules file\n" ); printf( " -f Specify the database file to use (default is './volta.db')\n"); printf( " -h Usage (you're lookin' at it)\n" ); printf( " -v Display version\n" ); @@ -80,12 +81,12 @@ /* - * Output to stdout for squid, unless the debug level is at or above 4. + * Output to stdout for squid, unless the debug level is at or above 5. */ void out( const char *str ) { - if ( v.debugmode >= 4 ) return; + if ( v.debugmode >= 5 ) return; fprintf( stdout, "%s", str ); return; } @@ -115,6 +116,25 @@ /* + * Lowercase a string in place. + * + */ +void +lowercase_str( char *str, unsigned short int len ) +{ + unsigned short int i = 0; + char c; + + for ( ; i < len; i++ ) { + c = str[i]; + str[i] = tolower( c ); + } + + return; +} + + +/* * Append 'buf' to the end of 'line', a la strcat, except dynamically * grow memory for the target string. * @@ -142,12 +162,12 @@ if ( new_len > LINE_MAX || (line_realloc = realloc(line, sizeof(char) * new_len)) == NULL ) { debug( 5, LOC, "Ignoring line %d, error while allocating memory: %s\n", v.timer.lines+1, (line_realloc == NULL ? strerror(errno) : "Line too large") ); - if ( line != NULL ) free( line ), line = NULL; + free( line ), line = NULL; printf( "\n" ); } else { line = line_realloc; - memcpy( line + offset, buf, LINE_BUFSIZE - 1 ); + memcpy( line + offset, buf, LINE_BUFSIZE ); } return( line ); @@ -222,6 +242,7 @@ * +ip_string+ into an in_addr struct, returning a pointer to it. * */ +/* struct in_addr * copy_ipv4_token( char *ip_string, unsigned short int length ) { @@ -246,7 +267,7 @@ return( alloc_ptr ); } - +*/ /* * Report how many lines were processed per second.