X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=ziffy%2Fziffy.c;h=c0743a1a269b6f410b5a7f92d4b24f1c150df2e3;hb=13473bcae713a0df158fd9620fbeba13663459ca;hp=31bdee181455dd6ed5b561192b5fa94af02ca5b3;hpb=5fb7fa9318c6ea4a6aeecd515cc00fcd46709a3d;p=yaz-moved-to-github.git diff --git a/ziffy/ziffy.c b/ziffy/ziffy.c index 31bdee1..c0743a1 100644 --- a/ziffy/ziffy.c +++ b/ziffy/ziffy.c @@ -36,9 +36,7 @@ #endif #include -#if 1 -#include "getopt.h" -#endif +#include #include "pcap.h" /* Packet Capture Library */ @@ -117,21 +115,6 @@ static char __version__ [] = "Version 0.0.3"; static char __released__ [] = "June 2001"; -#if (0) -struct option options [] = -{ - /* Default args */ - { "help", no_argument, NULL, 'h' }, - { "version", no_argument, NULL, 'v' }, - - /* Session Management stuff */ - { "restart-session", required_argument, NULL, 'S' }, - { "discard-session", required_argument, NULL, 'D' }, - - { NULL, 0, NULL, 0 } -}; -#endif - char ebuf [PCAP_ERRBUF_SIZE] = {0}; struct pcap_stat pcapstats = {0}; @@ -272,7 +255,8 @@ void parse_pdu (u_char * user_data, int main (int argc, char * argv []) { int option; - char * optstr = "hvac:ef:i:lnprs:twxz"; + const char * optstr = "hvac:ef:i:lnprs:twxz"; + char *optarg; char * progname; @@ -294,20 +278,10 @@ int main (int argc, char * argv []) else progname ++; -#if (0) - /* - * initialize getopt - */ - optarg = NULL; - optind = 0; - optopt = 0; - opterr = 0; /* this prevents getopt() to send error messages to stderr */ -#endif - /* * Parse command-line options */ - while ((option = getopt (argc, argv, optstr)) != EOF) + while ((option = options(optstr, argv, argc, &optarg)) != -2) { switch (option) { @@ -404,12 +378,12 @@ int main (int argc, char * argv []) if (filter) { strcat (filter, " "); - filter = realloc (filter, roomsize); + filter = (char *) realloc (filter, roomsize); strcat (filter, argv [optind ++]); } else { - filter = malloc (roomsize); + filter = (char *) malloc (roomsize); strcpy (filter, argv [optind ++]); } }