sh: Send getopts error messages to stderr, not stdout.
Adjust a testcase for this change.
This commit is contained in:
parent
bc7f6652dd
commit
8c4e5fc061
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=265773
@ -474,7 +474,7 @@ getopts(char *optstr, char *optvar, char **optfirst, char ***optnext,
|
||||
err |= setvarsafe("OPTARG", s, 0);
|
||||
}
|
||||
else {
|
||||
out1fmt("Illegal option -%c\n", c);
|
||||
out2fmt_flush("Illegal option -%c\n", c);
|
||||
INTOFF;
|
||||
(void) unsetvar("OPTARG");
|
||||
INTON;
|
||||
@ -495,7 +495,7 @@ getopts(char *optstr, char *optvar, char **optfirst, char ***optnext,
|
||||
c = ':';
|
||||
}
|
||||
else {
|
||||
out1fmt("No arg for -%c option\n", c);
|
||||
out2fmt_flush("No arg for -%c option\n", c);
|
||||
INTOFF;
|
||||
(void) unsetvar("OPTARG");
|
||||
INTON;
|
||||
|
@ -15,7 +15,7 @@ printf -- '-2-\n'
|
||||
set -- -ab
|
||||
getopts "ab:" OPTION
|
||||
echo ${OPTION}
|
||||
getopts "ab:" OPTION
|
||||
getopts "ab:" OPTION 3>&2 2>&1 >&3 3>&-
|
||||
echo ${OPTION}
|
||||
|
||||
# The 'shift' is aimed at causing an error.
|
||||
|
Loading…
Reference in New Issue
Block a user