aboutsummaryrefslogtreecommitdiffstats
path: root/rawshark.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-07-02 19:29:21 -0700
committerGuy Harris <guy@alum.mit.edu>2014-07-03 02:29:54 +0000
commit6b3391c60ab4302ebe06baaaecad25210b3edbed (patch)
tree6b44da6ea1203c5c5530c93234a60a87fee39c43 /rawshark.c
parent66c342ed59ed0e61f0b32c68b8197016a7299a6d (diff)
Regularize the help output of programs.
Only print to the standard output, and only give the version information, if a "print help" command-line option is specified. Otherwise, leave out the version information, and print to the standard error. Leave out the copyright information; it's extra cruft, and http://www.gnu.org/prep/standards/html_node/_002d_002dhelp.html doesn't say anything about it (and bash, at least, doesn't print it). Change-Id: Ic5029ccf96e096453f3bd38383cc2dd355542e8a Reviewed-on: https://code.wireshark.org/review/2789 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'rawshark.c')
-rw-r--r--rawshark.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/rawshark.c b/rawshark.c
index 814fb38dc1..b85c87b2ed 100644
--- a/rawshark.c
+++ b/rawshark.c
@@ -189,22 +189,8 @@ int encap;
GPtrArray *string_fmts;
static void
-print_usage(gboolean print_ver)
+print_usage(FILE *output)
{
- FILE *output;
-
- if (print_ver) {
- output = stdout;
- fprintf(output,
- "Rawshark (Wireshark) %s\n"
- "Dump and analyze network traffic.\n"
- "See http://www.wireshark.org for more information.\n"
- "\n"
- "%s",
- get_ws_vcs_version_info(), get_copyright_info());
- } else {
- output = stderr;
- }
fprintf(output, "\n");
fprintf(output, "Usage: rawshark [options] ...\n");
fprintf(output, "\n");
@@ -643,7 +629,11 @@ main(int argc, char *argv[])
g_ptr_array_add(disp_fields, g_strdup(optarg));
break;
case 'h': /* Print help and exit */
- print_usage(TRUE);
+ printf("Rawshark (Wireshark) %s\n"
+ "Dump and analyze network traffic.\n"
+ "See http://www.wireshark.org for more information.\n",
+ get_ws_vcs_version_info());
+ print_usage(stdout);
exit(0);
break;
case 'l': /* "Line-buffer" standard output */
@@ -764,7 +754,7 @@ main(int argc, char *argv[])
}
default:
case '?': /* Bad flag - print usage message */
- print_usage(TRUE);
+ print_usage(stderr);
exit(1);
break;
}
@@ -807,7 +797,7 @@ main(int argc, char *argv[])
}
if (arg_error) {
- print_usage(FALSE);
+ print_usage(stderr);
exit(1);
}