From ac3579da34075616f9d6b9b9e90462f941ec2523 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 24 Dec 2020 01:55:20 +0000 Subject: [PATCH] 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. (cherry picked from commit 0d0071a3023d19f54c02b6edaa37c20429f8da92) --- editcap.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/editcap.c b/editcap.c index f6a00ea528..aa152b254a 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':