diff options
author | Guy Harris <guy@alum.mit.edu> | 2006-01-05 23:44:16 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2006-01-05 23:44:16 +0000 |
commit | 6919c9c80f971c57aab1f85aad049d08221c40b7 (patch) | |
tree | e409d63c5efd34e1e7de1c7a96f15302a06a72a4 | |
parent | 4f3c493e1d2fb30c00be9d9135dad13a7003fea5 (diff) | |
download | wireshark-6919c9c80f971c57aab1f85aad049d08221c40b7.tar.gz wireshark-6919c9c80f971c57aab1f85aad049d08221c40b7.tar.bz2 wireshark-6919c9c80f971c57aab1f85aad049d08221c40b7.zip |
Catch a combination of "-S" and "-w -" - you'll just get
non-human-readable and non-machine-readable garbage from that
combination.
Use an exit code of 1 for command-line argument syntax errors in some
more cases.
svn path=/trunk/; revision=16961
-rw-r--r-- | tethereal.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tethereal.c b/tethereal.c index 9e0ddb57fe..c3d892763c 100644 --- a/tethereal.c +++ b/tethereal.c @@ -1022,7 +1022,7 @@ main(int argc, char *argv[]) if (rfilter != NULL) { cmdarg_err("Read filters were specified both with \"-R\" " "and with additional command-line arguments"); - exit(2); + exit(1); } rfilter = get_args_as_string(argc, argv, optind); } else { @@ -1030,7 +1030,7 @@ main(int argc, char *argv[]) if (capture_filter_specified) { cmdarg_err("Capture filters were specified both with \"-f\"" " and with additional command-line arguments"); - exit(2); + exit(1); } capture_opts.cfilter = get_args_as_string(argc, argv, optind); #else @@ -1046,7 +1046,16 @@ main(int argc, char *argv[]) if (save_file != NULL) { /* We're writing to a capture file. */ if (strcmp(save_file, "-") == 0) { - /* Write to the standard output. */ + /* Write to the standard output. + If we'll also be writing dissected packets to the standard + output, reject the request. At best, we could redirect that + to the standard error; we *can't* write both to the standard + output and have either of them be useful. */ + if (print_packet_info) { + cmdarg_err("You can't write both raw packet data and dissected packets" + " to the standard error."); + exit(1); + } g_free(save_file); save_file = g_strdup(""); #ifdef HAVE_LIBPCAP @@ -1102,7 +1111,7 @@ main(int argc, char *argv[]) if (capture_filter_specified) { cmdarg_err("Only read filters, not capture filters, " "can be specified when reading a capture file."); - exit(2); + exit(1); } } #endif |