summaryrefslogtreecommitdiffstats
path: root/bin/sh
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2014-05-09 13:32:36 +0000
committerjilles <jilles@FreeBSD.org>2014-05-09 13:32:36 +0000
commit0d127c3d771123baf79c9bf71f6db3745b483705 (patch)
tree6646832cf4545ead3c37a0d0aa11e56b4ee9992c /bin/sh
parent6a9f9b97f66628a3136322c7d20c7360fe424419 (diff)
downloadFreeBSD-src-0d127c3d771123baf79c9bf71f6db3745b483705.zip
FreeBSD-src-0d127c3d771123baf79c9bf71f6db3745b483705.tar.gz
sh: Send getopts error messages to stderr, not stdout.
Adjust a testcase for this change.
Diffstat (limited to 'bin/sh')
-rw-r--r--bin/sh/options.c4
-rw-r--r--bin/sh/tests/builtins/getopts1.02
2 files changed, 3 insertions, 3 deletions
diff --git a/bin/sh/options.c b/bin/sh/options.c
index 2fb8010..caaa884 100644
--- a/bin/sh/options.c
+++ b/bin/sh/options.c
@@ -474,7 +474,7 @@ atend:
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 @@ atend:
c = ':';
}
else {
- out1fmt("No arg for -%c option\n", c);
+ out2fmt_flush("No arg for -%c option\n", c);
INTOFF;
(void) unsetvar("OPTARG");
INTON;
diff --git a/bin/sh/tests/builtins/getopts1.0 b/bin/sh/tests/builtins/getopts1.0
index af31d55..64763bc 100644
--- a/bin/sh/tests/builtins/getopts1.0
+++ b/bin/sh/tests/builtins/getopts1.0
@@ -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.
OpenPOWER on IntegriCloud