diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-07-02 21:50:54 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-07-03 04:51:20 +0000 |
commit | 8afe3313697e4e5adcb5eebc9bd31b375dee92b0 (patch) | |
tree | 70aecda9538784b2d86399b459d48c359376ff0d /editcap.c | |
parent | a4304de1ccb3646dec74ed3a380485e80006b877 (diff) |
More getopt_long, to add --help and --version support.
Change-Id: I946067b972a70154f02ab561bc0fd029a7a5abc4
Reviewed-on: https://code.wireshark.org/review/2791
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'editcap.c')
-rw-r--r-- | editcap.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -50,6 +50,10 @@ #include <unistd.h> #endif +#ifdef HAVE_GETOPT_H +#include <getopt.h> +#endif + #ifdef HAVE_SYS_TIME_H #include <sys/time.h> #endif @@ -842,6 +846,11 @@ main(int argc, char *argv[]) int i, j, err; gchar *err_info; int opt; + static const struct option long_options[] = { + {(char *)"help", no_argument, NULL, 'h'}, + {(char *)"version", no_argument, NULL, 'V'}, + {0, 0, 0, 0 } + }; char *p; guint32 snaplen = 0; /* No limit */ @@ -905,7 +914,7 @@ main(int argc, char *argv[]) #endif /* Process the options */ - while ((opt = getopt(argc, argv, "A:B:c:C:dD:E:F:hi:Lrs:S:t:T:vVw:")) != -1) { + while ((opt = getopt_long(argc, argv, "A:B:c:C:dD:E:F:hi:Lrs:S:t:T:vVw:", long_options, NULL)) != -1) { switch (opt) { case 'A': { |