aboutsummaryrefslogtreecommitdiffstats
path: root/editcap.c
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2020-12-23 17:55:20 -0800
committerGuy Harris <gharris@sonic.net>2020-12-23 17:55:20 -0800
commit0d0071a3023d19f54c02b6edaa37c20429f8da92 (patch)
tree66107fcc44e4bf3afbc317f6b4a111b8274ae97f /editcap.c
parentd98106876c333bdc9a0c947aa8eaba62cd10aafc (diff)
editcap: make verbose a Boolean as well.
And, to catch people habituated to -r and -v toggling the flag, fail if it's already been set, to dishabituate them. Not having them toggle makes it easier to document their semantics.
Diffstat (limited to 'editcap.c')
-rw-r--r--editcap.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/editcap.c b/editcap.c
index 1fe41268c0..b65b665c16 100644
--- a/editcap.c
+++ b/editcap.c
@@ -158,7 +158,7 @@ static guint max_selected = 0;
static gboolean keep_em = FALSE;
static int out_file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_PCAPNG; /* default to pcapng */
static int out_frame_type = -2; /* Leave frame type alone */
-static int verbose = 0; /* Not so verbose */
+static gboolean verbose = FALSE; /* Not so verbose */
static struct time_adjustment time_adj = {NSTIME_INIT_ZERO, 0}; /* no adjustment */
static nstime_t relative_time_window = NSTIME_INIT_ZERO; /* de-dup time window */
static double err_prob = -1.0;
@@ -1467,6 +1467,11 @@ invalid_time:
break;
case 'r':
+ if (keep_em) {
+ cmdarg_err("-r was specified twice");
+ ret = INVALID_OPTION;
+ goto clean_exit;
+ }
keep_em = TRUE;
break;
@@ -1501,7 +1506,12 @@ invalid_time:
break;
case 'v':
- verbose = !verbose; /* Just invert */
+ if (verbose) {
+ cmdarg_err("-v was specified twice");
+ ret = INVALID_OPTION;
+ goto clean_exit;
+ }
+ verbose = TRUE;
break;
case 'V':