X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=ziffy%2Fziffy.c;h=c0743a1a269b6f410b5a7f92d4b24f1c150df2e3;hb=da7f94a6b0f603280dcae083f2e5c1627b817fe1;hp=64e2bc4d79330c302a389930370ab0307a8b02c2;hpb=fe507b6b15788a3a8e58063d9dae52532a5229a5;p=yaz-moved-to-github.git diff --git a/ziffy/ziffy.c b/ziffy/ziffy.c index 64e2bc4..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) {