From 95732b497d12c98613bb3c5db16b61f377501a59 Mon Sep 17 00:00:00 2001
From: Jari Aalto <jari.aalto@cante.net>
Date: Wed, 7 Dec 2005 14:08:12 +0000
Subject: Imported from ../bash-3.1.tar.gz.

---
 builtins/echo.def | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

(limited to 'builtins/echo.def')

diff --git a/builtins/echo.def b/builtins/echo.def
index a91c8e4..6792659 100644
--- a/builtins/echo.def
+++ b/builtins/echo.def
@@ -72,12 +72,14 @@ $END
    existing system shells won't barf.  Regrettably, the SUS v2 has
    standardized the Sys V echo behavior.  This variable is external
    so that we can have a `shopt' variable to control it at runtime. */
-#if defined (DEFAULT_ECHO_TO_XPG)
+#if defined (DEFAULT_ECHO_TO_XPG) || defined (STRICT_POSIX)
 int xpg_echo = 1;
 #else
 int xpg_echo = 0;
 #endif /* DEFAULT_ECHO_TO_XPG */
 
+extern int posixly_correct;
+
 /* Print the words in LIST to standard output.  If the first word is
    `-n', then don't print a trailing newline.  We also support the
    echo syntax from Version 9 Unix systems. */
@@ -91,6 +93,9 @@ echo_builtin (list)
   do_v9 = xpg_echo;
   display_return = 1;
 
+  if (posixly_correct && xpg_echo)
+    goto just_echo;
+
   for (; list && (temp = list->word->word) && *temp == '-'; list = list->next)
     {
       /* If it appears that we are handling options, then make sure that
@@ -170,6 +175,7 @@ just_echo:
   fflush (stdout);
   if (ferror (stdout))
     {
+      sh_wrerror ();
       clearerr (stdout);
       return (EXECUTION_FAILURE);
     }
-- 
cgit v1.2.3

