From a4304de1ccb3646dec74ed3a380485e80006b877 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Wed, 2 Jul 2014 19:33:27 -0700 Subject: Add long-option support. That way, --help and --version, as well as -h and -v, work. Change-Id: I095e0dcef9f6181d6fbe6337f9f33e80bc44f11a Reviewed-on: https://code.wireshark.org/review/2790 Reviewed-by: Guy Harris --- rawshark.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'rawshark.c') diff --git a/rawshark.c b/rawshark.c index b85c87b2ed..b67cc06749 100644 --- a/rawshark.c +++ b/rawshark.c @@ -45,6 +45,10 @@ #include #endif +#ifdef HAVE_GETOPT_H +#include +#endif + #include #ifdef HAVE_FCNTL_H @@ -459,6 +463,11 @@ main(int argc, char *argv[]) GPtrArray *disp_fields = g_ptr_array_new(); guint fc; gboolean skip_pcap_header = FALSE; + static const struct option long_options[] = { + {(char *)"help", no_argument, NULL, 'h'}, + {(char *)"version", no_argument, NULL, 'v'}, + {0, 0, 0, 0 } + }; #define OPTSTRING_INIT "d:F:hlnN:o:pr:R:sS:t:v" @@ -617,7 +626,7 @@ main(int argc, char *argv[]) /* Now get our args */ /* XXX - We should probably have an option to dump libpcap link types */ - while ((opt = getopt(argc, argv, optstring)) != -1) { + while ((opt = getopt_long(argc, argv, optstring, long_options, NULL)) != -1) { switch (opt) { case 'd': /* Payload type */ if (!set_link_type(optarg)) { -- cgit v1.2.3