diff options
author | Peter Wu <peter@lekensteyn.nl> | 2017-11-13 23:43:10 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2017-11-14 00:46:20 +0000 |
commit | 3006ffa615d02dabe7431394b07e8b2d9888ca41 (patch) | |
tree | bde60ef906861a3c6ec803b421cf58d9a6903c0e /editcap.c | |
parent | a595d7326b4a42f15a7b3109a6e81b4de02bbc14 (diff) |
CMake,editcap: avoid noise with editcap -F and -T options
Avoid printing a noisy "option requires an argument" error when using
'-T' and '-F' as documented. Fix warning that started showing on macOS
with CMake 3.9.4 about CMP0058 since v2.5.0rc0-1180-g799f4f0e14.
Change-Id: Ie0cc352c6b0b2724997e7fe6b49fd5b1f02d1e07
Reviewed-on: https://code.wireshark.org/review/24404
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Ahmad Fatoum <ahmad@a3f.at>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'editcap.c')
-rw-r--r-- | editcap.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -1047,7 +1047,7 @@ main(int argc, char *argv[]) #endif /* Process the options */ - while ((opt = getopt_long(argc, argv, "a:A:B:c:C:dD:E:F:hi:I:Lo:rs:S:t:T:vVw:", long_options, NULL)) != -1) { + while ((opt = getopt_long(argc, argv, ":a:A:B:c:C:dD:E:F:hi:I:Lo:rs:S:t:T:vVw:", long_options, NULL)) != -1) { switch (opt) { case 0x8100: { @@ -1279,6 +1279,7 @@ main(int argc, char *argv[]) break; case '?': /* Bad options if GNU getopt */ + case ':': /* missing option argument */ switch(optopt) { case'F': list_capture_types(stdout); @@ -1287,6 +1288,11 @@ main(int argc, char *argv[]) list_encap_types(stdout); break; default: + if (opt == '?') { + fprintf(stderr, "editcap: invalid option -- '%c'\n", optopt); + } else { + fprintf(stderr, "editcap: option requires an argument -- '%c'\n", optopt); + } print_usage(stderr); ret = INVALID_OPTION; break; |