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>
This commit is contained in:
Guy Harris 2014-11-14 15:59:38 -08:00
parent 355458061a
commit 225c86f7a2
4 changed files with 20 additions and 10 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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 :");

View File

@ -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 :");