Imported from ../bash-2.04.tar.gz.
This commit is contained in:
parent
b72432fdcc
commit
bb70624e96
387 changed files with 28522 additions and 9334 deletions
|
|
@ -7,7 +7,7 @@ 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 1, or (at your option) any later
|
||||
Software Foundation; either version 2, or (at your option) any later
|
||||
version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
|
|
@ -17,7 +17,7 @@ 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, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
|
||||
$PRODUCES echo.c
|
||||
#include <config.h>
|
||||
|
|
@ -67,6 +67,17 @@ $END
|
|||
# define VALID_ECHO_OPTIONS "n"
|
||||
#endif /* !V9_ECHO */
|
||||
|
||||
/* System V machines already have a /bin/sh with a v9 behaviour. We
|
||||
give Bash the identical behaviour for these machines so that the
|
||||
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)
|
||||
int xpg_echo = 1;
|
||||
#else
|
||||
int xpg_echo = 0;
|
||||
#endif /* DEFAULT_ECHO_TO_XPG */
|
||||
|
||||
/* 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. */
|
||||
|
|
@ -77,15 +88,7 @@ echo_builtin (list)
|
|||
int display_return, do_v9, i, len;
|
||||
char *temp, *s;
|
||||
|
||||
#if defined (DEFAULT_ECHO_TO_USG)
|
||||
/* System V machines already have a /bin/sh with a v9 behaviour. We
|
||||
give Bash the identical behaviour for these machines so that the
|
||||
existing system shells won't barf. */
|
||||
do_v9 = 1;
|
||||
#else
|
||||
do_v9 = 0;
|
||||
#endif /* DEFAULT_ECHO_TO_USG */
|
||||
|
||||
do_v9 = xpg_echo;
|
||||
display_return = 1;
|
||||
|
||||
for (; list && (temp = list->word->word) && *temp == '-'; list = list->next)
|
||||
|
|
@ -133,7 +136,7 @@ just_echo:
|
|||
while (list)
|
||||
{
|
||||
i = len = 0;
|
||||
temp = do_v9 ? ansicstr (list->word->word, STRLEN (list->word->word), &i, &len)
|
||||
temp = do_v9 ? ansicstr (list->word->word, STRLEN (list->word->word), 1, &i, &len)
|
||||
: list->word->word;
|
||||
if (temp)
|
||||
{
|
||||
|
|
@ -163,5 +166,10 @@ just_echo:
|
|||
if (display_return)
|
||||
putchar ('\n');
|
||||
fflush (stdout);
|
||||
if (ferror (stdout))
|
||||
{
|
||||
clearerr (stdout);
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
return (EXECUTION_SUCCESS);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue