diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-06-20 12:18:48 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-06-20 19:19:47 +0000 |
commit | 312ed10900df878ef8476febe72c8f1308aba106 (patch) | |
tree | c4a73afa3bd05891cad18cbde65b64d2c1ee2330 /dumpcap.c | |
parent | 6808afd0172cc1507f19ef1533f500fac4b0dce2 (diff) |
Add --help and --version long options.
Also, make the convention for long-only options be that their
case-statement values start at 128, so they avoid colliding with any
ASCII code points, including control characters.
Make the tables of long options "static const" while we're at it, and
get rid of unnecessary casts.
Change-Id: I55702a85e9bc078b1cd0f2803ebb68a710405bab
Reviewed-on: https://code.wireshark.org/review/2491
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'dumpcap.c')
-rw-r--r-- | dumpcap.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -4176,8 +4176,10 @@ main(int argc, char *argv[]) GString *comp_info_str; GString *runtime_info_str; int opt; - struct option long_options[] = { + static const struct option long_options[] = { {(char *)"capture-comment", required_argument, NULL, LONGOPT_NUM_CAP_COMMENT }, + {(char *)"help", no_argument, NULL, 'h'}, + {(char *)"version", no_argument, NULL, 'v'}, {0, 0, 0, 0 } }; @@ -4525,8 +4527,8 @@ main(int argc, char *argv[]) global_capture_opts.saving_to_file = TRUE; global_capture_opts.has_ring_num_files = TRUE; - /* Pass on capture_child mode for capture_opts */ - global_capture_opts.capture_child = capture_child; + /* Pass on capture_child mode for capture_opts */ + global_capture_opts.capture_child = capture_child; /* Now get our args */ while ((opt = getopt_long(argc, argv, OPTSTRING, long_options, NULL)) != -1) { |