diff options
| author | Jari Aalto <jari.aalto@cante.net> | 2005-12-07 14:08:12 +0000 |
|---|---|---|
| committer | Jari Aalto <jari.aalto@cante.net> | 2009-09-12 16:46:57 +0000 |
| commit | 95732b497d12c98613bb3c5db16b61f377501a59 (patch) | |
| tree | 5e1cdf79eb0407e09dca4c0ec29e11442c7d1d15 /builtins/echo.def | |
| parent | eb87367179effbe5f430236db8259006d71438b7 (diff) | |
| download | android_external_bash-95732b497d12c98613bb3c5db16b61f377501a59.tar.gz android_external_bash-95732b497d12c98613bb3c5db16b61f377501a59.tar.bz2 android_external_bash-95732b497d12c98613bb3c5db16b61f377501a59.zip | |
Imported from ../bash-3.1.tar.gz.
Diffstat (limited to 'builtins/echo.def')
| -rw-r--r-- | builtins/echo.def | 8 |
1 files changed, 7 insertions, 1 deletions
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); } |
