aboutsummaryrefslogtreecommitdiffstats
path: root/dumpcap.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 /dumpcap.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 'dumpcap.c')
-rw-r--r--dumpcap.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/dumpcap.c b/dumpcap.c
index 3a2a19f26e..100be01319 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -475,20 +475,8 @@ create_timestamp(void) {
}
static void
-print_usage(gboolean print_ver)
+print_usage(FILE *output)
{
- FILE *output;
-
- if (print_ver) {
- output = stdout;
- fprintf(output,
- "Dumpcap (Wireshark) %s\n"
- "Capture network packets and dump them into a pcapng file.\n"
- "See http://www.wireshark.org for more information.\n",
- get_ws_vcs_version_info());
- } else {
- output = stderr;
- }
fprintf(output, "\nUsage: dumpcap [options] ...\n");
fprintf(output, "\n");
fprintf(output, "Capture interface:\n");
@@ -4534,7 +4522,11 @@ main(int argc, char *argv[])
while ((opt = getopt_long(argc, argv, OPTSTRING, long_options, NULL)) != -1) {
switch (opt) {
case 'h': /* Print help and exit */
- print_usage(TRUE);
+ printf("Dumpcap (Wireshark) %s\n"
+ "Capture network packets and dump them into a pcapng or pcap file.\n"
+ "See http://www.wireshark.org for more information.\n",
+ get_ws_vcs_version_info());
+ print_usage(stdout);
exit_main(0);
break;
case 'v': /* Show version and exit */
@@ -4679,7 +4671,7 @@ main(int argc, char *argv[])
pcap_queue_packet_limit = 1000;
}
if (arg_error) {
- print_usage(FALSE);
+ print_usage(stderr);
exit_main(1);
}