diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-10-11 14:49:26 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-10-11 15:19:40 -0700 |
commit | 011c1d1c0766c65517ebd495465c99e86edb63ec (patch) | |
tree | 30d8f6a13235af90897c3223554871ef52225462 /builtins/echo.def | |
parent | 40cfaccf7b178b6239b5cd0013ef80b7ff8e503e (diff) | |
download | vyatta-bash-011c1d1c0766c65517ebd495465c99e86edb63ec.tar.gz vyatta-bash-011c1d1c0766c65517ebd495465c99e86edb63ec.zip |
Update to bash-4.1
Diffstat (limited to 'builtins/echo.def')
-rw-r--r-- | builtins/echo.def | 90 |
1 files changed, 51 insertions, 39 deletions
diff --git a/builtins/echo.def b/builtins/echo.def index 923c43a..62c6199 100644 --- a/builtins/echo.def +++ b/builtins/echo.def @@ -1,23 +1,22 @@ This file is echo.def, from which is created echo.c. It implements the builtin "echo" in Bash. -Copyright (C) 1987-2002 Free Software Foundation, Inc. +Copyright (C) 1987-2009 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. -Bash is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 2, or (at your option) any later -version. +Bash is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. -Bash is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. +Bash is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. -You should have received a copy of the GNU General Public License along -with Bash; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. +You should have received a copy of the GNU General Public License +along with Bash. If not, see <http://www.gnu.org/licenses/>. $PRODUCES echo.c #include <config.h> @@ -37,31 +36,48 @@ $BUILTIN echo $FUNCTION echo_builtin $DEPENDS_ON V9_ECHO $SHORT_DOC echo [-neE] [arg ...] -Output the ARGs. If -n is specified, the trailing newline is -suppressed. If the -e option is given, interpretation of the -following backslash-escaped characters is turned on: - \a alert (bell) - \b backspace - \c suppress trailing newline - \E escape character - \f form feed - \n new line - \r carriage return - \t horizontal tab - \v vertical tab - \\ backslash - \0nnn the character whose ASCII code is NNN (octal). NNN can be - 0 to 3 octal digits - -You can explicitly turn off the interpretation of the above characters -with the -E option. +Write arguments to the standard output. + +Display the ARGs on the standard output followed by a newline. + +Options: + -n do not append a newline + -e enable interpretation of the following backslash escapes + -E explicitly suppress interpretation of backslash escapes + +`echo' interprets the following backslash-escaped characters: + \a alert (bell) + \b backspace + \c suppress further output + \e escape character + \f form feed + \n new line + \r carriage return + \t horizontal tab + \v vertical tab + \\ backslash + \0nnn the character whose ASCII code is NNN (octal). NNN can be + 0 to 3 octal digits + \xHH the eight-bit character whose value is HH (hexadecimal). HH + can be one or two hex digits + +Exit Status: +Returns success unless a write error occurs. $END $BUILTIN echo $FUNCTION echo_builtin $DEPENDS_ON !V9_ECHO $SHORT_DOC echo [-n] [arg ...] -Output the ARGs. If -n is specified, the trailing newline is suppressed. +Write arguments to the standard output. + +Display the ARGs on the standard output followed by a newline. + +Options: + -n do not append a newline + +Exit Status: +Returns success unless a write error occurs. $END #if defined (V9_ECHO) @@ -143,6 +159,7 @@ just_echo: clearerr (stdout); /* clear error before writing and testing success */ + terminate_immediately++; while (list) { i = len = 0; @@ -175,12 +192,7 @@ just_echo: if (display_return) putchar ('\n'); - fflush (stdout); - if (ferror (stdout)) - { - sh_wrerror (); - clearerr (stdout); - return (EXECUTION_FAILURE); - } - return (EXECUTION_SUCCESS); + + terminate_immediately--; + return (sh_chkwrite (EXECUTION_SUCCESS)); } |