Constrain the options so that -M cannot be used with -U (as it is a different action) and -M will report the right error message if mixed with -R or -Q (#67).
This commit is contained in:
@@ -439,6 +439,8 @@ the latter can't show the input:output ratio.
|
||||
The values \*(lq\fB0\fR\*(rq, \*(lq\fB1\fR\*(rq, and \*(lq\fB2\fR\*(rq may
|
||||
be used as synonyms for \*(lq\fBin\fR\*(rq, \*(lq\fBout\fR\*(rq, and
|
||||
\*(lq\fBboth\fR\*(rq.
|
||||
.IP
|
||||
This option cannot be used with \*(lq\fB\-\-store\-and\-forward\*(rq.
|
||||
.\"TODO: formatting option for input:output ratio
|
||||
.\"
|
||||
.SS "Other options"
|
||||
|
||||
@@ -40,6 +40,7 @@ typedef enum {
|
||||
* Sides of a monitored command to monitor with PV_ACTION_MONITOR.
|
||||
*/
|
||||
typedef enum {
|
||||
PV_SIDE_NONE, /* don't monitor a command */
|
||||
PV_SIDE_IN, /* monitor only the input side */
|
||||
PV_SIDE_OUT, /* monitor only the output side */
|
||||
PV_SIDE_BOTH /* monitor both sides */
|
||||
|
||||
@@ -762,6 +762,7 @@ opts_t opts_parse(unsigned int argc, char **argv)
|
||||
numopts = 0;
|
||||
|
||||
opts->action = PV_ACTION_TRANSFER;
|
||||
opts->side = PV_SIDE_NONE;
|
||||
opts->interval = 1;
|
||||
opts->delay_start = 0;
|
||||
opts->average_rate_window = 30;
|
||||
@@ -1293,6 +1294,31 @@ opts_t opts_parse(unsigned int argc, char **argv)
|
||||
if (opts->error_skip_block > 0 && 0 == opts->skip_errors)
|
||||
opts->skip_errors = 1;
|
||||
|
||||
/*
|
||||
* Don't allow -R or -Q with -M.
|
||||
*/
|
||||
if ((PV_ACTION_MONITOR == opts->action) && ((0 != opts->remote) || (0 != opts->query))) {
|
||||
/*@-mustfreefresh@ *//* see above */
|
||||
fprintf(stderr, "%s: %s: %s\n", opts->program_name, 0 != opts->remote ? "-R" : "-Q",
|
||||
_("monitor mode cannot be specified with this option"));
|
||||
opts_free(opts);
|
||||
return NULL;
|
||||
/*@+mustfreefresh@ */
|
||||
}
|
||||
|
||||
/*
|
||||
* Don't allow -U with -M.
|
||||
*/
|
||||
if ((PV_ACTION_STORE_AND_FORWARD == opts->action && PV_SIDE_NONE != opts->side)
|
||||
|| (PV_ACTION_MONITOR == opts->action && NULL != opts->store_and_forward_file)) {
|
||||
/*@-mustfreefresh@ *//* see above */
|
||||
fprintf(stderr, "%s: %s\n", opts->program_name,
|
||||
_("monitor mode cannot be used with store-and-forward"));
|
||||
opts_free(opts);
|
||||
return NULL;
|
||||
/*@+mustfreefresh@ */
|
||||
}
|
||||
|
||||
/*
|
||||
* Don't allow any non-option arguments with -R or -Q.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user