aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-11-14 15:59:38 -0800
committerGuy Harris <guy@alum.mit.edu>2014-11-15 00:27:48 +0000
commit225c86f7a27e2fd8cae24a472443580f174e14e9 (patch)
treedc22901e2716290715149e96cdab9ed27a4aba02
parent355458061a76e82d42df24f50c2e9643c10114e7 (diff)
Do the "-z help" processing separately, and do it for Wireshark as well.
Yes, Wireshark does a bunch of GUI stuff, and then takes the window down before printing the help, but the same is true for some command-line error messages as well. Change-Id: Id501468416c83308e4c0a9e7a66116d8d33a9d84 Reviewed-on: https://code.wireshark.org/review/5317 Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--tfshark.c10
-rw-r--r--tshark.c10
-rw-r--r--ui/gtk/main.c5
-rw-r--r--ui/qt/main.cpp5
4 files changed, 20 insertions, 10 deletions
diff --git a/tfshark.c b/tfshark.c
index 38b94199c9..2cbe7e7485 100644
--- a/tfshark.c
+++ b/tfshark.c
@@ -1300,12 +1300,12 @@ main(int argc, char *argv[])
by the preferences set callback) from being used as
part of a tap filter. Instead, we just add the argument
to a list of stat arguments. */
+ if (strcmp("help", optarg) == 0) {
+ fprintf(stderr, "tfshark: The available statistics for the \"-z\" option are:\n");
+ list_stat_cmd_args();
+ return 0;
+ }
if (!process_stat_cmd_arg(optarg)) {
- if (strcmp("help", optarg)==0) {
- fprintf(stderr, "tfshark: The available statistics for the \"-z\" option are:\n");
- list_stat_cmd_args();
- return 0;
- }
cmdarg_err("Invalid -z argument \"%s\"; it must be one of:", optarg);
list_stat_cmd_args();
return 1;
diff --git a/tshark.c b/tshark.c
index c413218863..0cdbb901fb 100644
--- a/tshark.c
+++ b/tshark.c
@@ -1645,12 +1645,12 @@ main(int argc, char *argv[])
by the preferences set callback) from being used as
part of a tap filter. Instead, we just add the argument
to a list of stat arguments. */
+ if (strcmp("help", optarg) == 0) {
+ fprintf(stderr, "tshark: The available statistics for the \"-z\" option are:\n");
+ list_stat_cmd_args();
+ return 0;
+ }
if (!process_stat_cmd_arg(optarg)) {
- if (strcmp("help", optarg)==0) {
- fprintf(stderr, "tshark: The available statistics for the \"-z\" option are:\n");
- list_stat_cmd_args();
- return 0;
- }
cmdarg_err("Invalid -z argument \"%s\"; it must be one of:", optarg);
list_stat_cmd_args();
return 1;
diff --git a/ui/gtk/main.c b/ui/gtk/main.c
index a78edc01b8..622bb6ee16 100644
--- a/ui/gtk/main.c
+++ b/ui/gtk/main.c
@@ -2759,6 +2759,11 @@ main(int argc, char *argv[])
by the preferences set callback) from being used as
part of a tap filter. Instead, we just add the argument
to a list of stat arguments. */
+ if (strcmp("help", optarg) == 0) {
+ fprintf(stderr, "wireshark: The available statistics for the \"-z\" option are:\n");
+ list_stat_cmd_args();
+ exit(0);
+ }
if (!process_stat_cmd_arg(optarg)) {
cmdarg_err("Invalid -z argument.");
cmdarg_err_cont(" -z argument must be one of :");
diff --git a/ui/qt/main.cpp b/ui/qt/main.cpp
index 24fc283510..7b244c1f3f 100644
--- a/ui/qt/main.cpp
+++ b/ui/qt/main.cpp
@@ -1081,6 +1081,11 @@ int main(int argc, char *argv[])
by the preferences set callback) from being used as
part of a tap filter. Instead, we just add the argument
to a list of stat arguments. */
+ if (strcmp("help", optarg) == 0) {
+ fprintf(stderr, "wireshark: The available statistics for the \"-z\" option are:\n");
+ list_stat_cmd_args();
+ exit(0);
+ }
if (!process_stat_cmd_arg(optarg)) {
cmdarg_err("Invalid -z argument.");
cmdarg_err_cont(" -z argument must be one of :");