Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 May 2014 13:32:37 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r265773 - in head/bin/sh: . tests/builtins
Message-ID:  <201405091332.s49DWbuW064738@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Fri May  9 13:32:36 2014
New Revision: 265773
URL: http://svnweb.freebsd.org/changeset/base/265773

Log:
  sh: Send getopts error messages to stderr, not stdout.
  
  Adjust a testcase for this change.

Modified:
  head/bin/sh/options.c
  head/bin/sh/tests/builtins/getopts1.0

Modified: head/bin/sh/options.c
==============================================================================
--- head/bin/sh/options.c	Fri May  9 13:27:30 2014	(r265772)
+++ head/bin/sh/options.c	Fri May  9 13:32:36 2014	(r265773)
@@ -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;

Modified: head/bin/sh/tests/builtins/getopts1.0
==============================================================================
--- head/bin/sh/tests/builtins/getopts1.0	Fri May  9 13:27:30 2014	(r265772)
+++ head/bin/sh/tests/builtins/getopts1.0	Fri May  9 13:32:36 2014	(r265773)
@@ -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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405091332.s49DWbuW064738>