*
* $Id$
*
- * (c) 2007, Luis E. Garcia Ontanon <luis.ontanon@gmail.com>
+ * (c) 2007, Luis E. Garcia Ontanon <luis@ontanon.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
static void dprintf(int lev, const char* fmt, ...) {
va_list ap;
- va_start(ap,fmt);
if (lev <= debug_level) {
+ va_start(ap,fmt);
vfprintf(stderr,fmt,ap);
+ va_end(ap);
fflush(stderr);
}
- va_end(ap);
}
" -p promiscuous mode\n"
" -s snapshot length\n"
" -q quiet\n"
- " -d increase deug level\n"
+ " -d increase debug level\n"
" -h prints this message\n"
;
switch (opt) {
case 'i':
if (interface) panic(1,"interface already given");
- interface = strdup(optarg);
+ interface = g_strdup(optarg);
break;
case 'w':
if (outfile) panic(3,"output file already given");
- outfile = strdup(optarg);
+ outfile = g_strdup(optarg);
break;
case 's':
snaplen = strtoul(optarg,NULL,10);
break;
case 'b':
if (start_filter_str) panic(5,"start filter already given");
- start_filter_str = strdup(optarg);
+ start_filter_str = g_strdup(optarg);
break;
case 'e':
if (stop_filter_str) panic(6,"stop filter already given");
- stop_filter_str = strdup(optarg);
+ stop_filter_str = g_strdup(optarg);
break;
case 'f':
if (capture_filter_str) panic(7,"capture filter already given");
- capture_filter_str = strdup(optarg);
+ capture_filter_str = g_strdup(optarg);
break;
case 'p':
promisc = 1;
dprintf(1,"starting with:\n interface: %s\n snaplen: %d\n promisc: %d"
"\n outfile: %s\n capture filter: %s\n start: %s\n stop: %s\n debug level: %d\n",
- interface ? interface : "to be choosen",
+ interface ? interface : "to be chosen",
snaplen,
promisc,
outfile ? outfile : "** missing **",