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 0d0071a302)
This commit is contained in:
Guy Harris 2020-12-24 01:55:20 +00:00
parent 4ee9ca7681
commit ac3579da34
1 changed files with 12 additions and 2 deletions

View File

@ -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':