From 4bc595e8fd2364e93114ee66493544b9521680da Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 18 Dec 2007 14:07:08 +0000 Subject: [PATCH] Using YAZ' options rather than getopt.h. Ziffy now uses YAZ' options rather than getopt.h because getopt.h is unavailable on some systems. --- ziffy/ziffy.c | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) 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) { -- 1.7.10.4