Validate that two of the -L, -p, and -U options are not used at the same
time after the parsing of options. -U used to be allowed after -p or -L, but not before.
This commit is contained in:
@@ -981,9 +981,6 @@ static void process_flags (int argc, char **argv)
|
||||
user_newname = optarg;
|
||||
break;
|
||||
case 'L':
|
||||
if (Uflg || pflg)
|
||||
usage ();
|
||||
|
||||
Lflg++;
|
||||
break;
|
||||
case 'm':
|
||||
@@ -996,9 +993,6 @@ static void process_flags (int argc, char **argv)
|
||||
oflg++;
|
||||
break;
|
||||
case 'p':
|
||||
if (Lflg || Uflg)
|
||||
usage ();
|
||||
|
||||
user_pass = optarg;
|
||||
pflg++;
|
||||
break;
|
||||
@@ -1021,9 +1015,6 @@ static void process_flags (int argc, char **argv)
|
||||
uflg++;
|
||||
break;
|
||||
case 'U':
|
||||
if (Lflg && pflg)
|
||||
usage ();
|
||||
|
||||
Uflg++;
|
||||
break;
|
||||
default:
|
||||
@@ -1056,6 +1047,14 @@ static void process_flags (int argc, char **argv)
|
||||
exit (E_USAGE);
|
||||
}
|
||||
|
||||
if ((Lflg && (pflg || Uflg)) || (pflg && Uflg)) {
|
||||
fprintf (stderr,
|
||||
_("%s: the -L, -p, and -U flags are exclusive\n"),
|
||||
Prog);
|
||||
usage ();
|
||||
exit (E_USAGE);
|
||||
}
|
||||
|
||||
if (mflg && !dflg) {
|
||||
fprintf (stderr,
|
||||
_("%s: -m flag is ONLY allowed with the -d flag\n"),
|
||||
|
Reference in New Issue
Block a user