aboutsummaryrefslogtreecommitdiffstats
path: root/dumpcap.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-03-17 13:11:12 -0700
committerGuy Harris <guy@alum.mit.edu>2015-03-17 20:11:40 +0000
commit7a14f89f12f72bf14b4fc69f9a0c4a4974bae089 (patch)
tree4ef9fe25a65e08634b18db32ee13b4a4a57373c7 /dumpcap.c
parent6637f4d144c96a4bb467540c46bb47779d2be573 (diff)
Allow multiple -D/-L/-d/-S flags, only allow one -k flag.
Multiple instances of a single flag from -D/-L/-d/-S should behave like a single instance of that flag; -D plus -L, for example, is not supported, but -D plus another -D should be. -k, however, takes an argument, and we only support one. Change-Id: I8baced346fbffd75f8d768497213f67bb9a0555f Reviewed-on: https://code.wireshark.org/review/7723 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'dumpcap.c')
-rw-r--r--dumpcap.c37
1 files changed, 25 insertions, 12 deletions
diff --git a/dumpcap.c b/dumpcap.c
index 1f7da91e69..4b969fa629 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -4646,28 +4646,41 @@ DIAG_ON(cast-qual)
break;
/*** all non capture option specific ***/
case 'D': /* Print a list of capture devices and exit */
- list_interfaces = TRUE;
- run_once_args++;
+ if (!list_interfaces) {
+ list_interfaces = TRUE;
+ run_once_args++;
+ }
break;
case 'L': /* Print list of link-layer types and exit */
- list_link_layer_types = TRUE;
- run_once_args++;
+ if (!list_link_layer_types) {
+ list_link_layer_types = TRUE;
+ run_once_args++;
+ }
break;
#ifdef HAVE_BPF_IMAGE
case 'd': /* Print BPF code for capture filter and exit */
- print_bpf_code = TRUE;
- run_once_args++;
+ if (!print_bpf_code) {
+ print_bpf_code = TRUE;
+ run_once_args++;
+ }
break;
#endif
case 'S': /* Print interface statistics once a second */
- print_statistics = TRUE;
- run_once_args++;
+ if (!print_statistics) {
+ print_statistics = TRUE;
+ run_once_args++;
+ }
break;
case 'k': /* Set wireless channel */
- set_chan = TRUE;
- set_chan_arg = optarg;
- run_once_args++;
- break;
+ if (!set_chan) {
+ set_chan = TRUE;
+ set_chan_arg = optarg;
+ run_once_args++;
+ } else {
+ cmdarg_err("Only one -k flag may be specified");
+ arg_error = TRUE;
+ }
+ break;
case 'M': /* For -D, -L, and -S, print machine-readable output */
machine_readable = TRUE;
break;