diff options
author | Jari Aalto <jari.aalto@cante.net> | 1997-06-05 14:59:13 +0000 |
---|---|---|
committer | Jari Aalto <jari.aalto@cante.net> | 2009-09-12 16:46:50 +0000 |
commit | d166f048818e10cf3799aa24a174fb22835f1acc (patch) | |
tree | 1ca27f9243900f8b236d0cde6a3862002aea9e19 /builtins/echo.def | |
parent | ccc6cda312fea9f0468ee65b8f368e9653e1380b (diff) | |
download | android_external_bash-d166f048818e10cf3799aa24a174fb22835f1acc.tar.gz android_external_bash-d166f048818e10cf3799aa24a174fb22835f1acc.tar.bz2 android_external_bash-d166f048818e10cf3799aa24a174fb22835f1acc.zip |
Imported from ../bash-2.01.tar.gz.
Diffstat (limited to 'builtins/echo.def')
-rw-r--r-- | builtins/echo.def | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/builtins/echo.def b/builtins/echo.def index 74ca0f4..e8b6edb 100644 --- a/builtins/echo.def +++ b/builtins/echo.def @@ -26,6 +26,8 @@ $PRODUCES echo.c # include <unistd.h> #endif +#include "../bashansi.h" + #include <stdio.h> #include "../shell.h" @@ -72,8 +74,8 @@ int echo_builtin (list) WORD_LIST *list; { - int display_return, do_v9, i; - char *temp; + 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 @@ -130,13 +132,21 @@ just_echo: while (list) { - i = 0; - temp = do_v9 ? ansicstr (list->word->word, STRLEN (list->word->word), &i) + i = len = 0; + temp = do_v9 ? ansicstr (list->word->word, STRLEN (list->word->word), &i, &len) : list->word->word; if (temp) { - printf ("%s", temp); + if (do_v9) + { + for (s = temp; len > 0; len--) + putchar (*s++); + } + else + printf ("%s", temp); +#if defined (SunOS5) fflush (stdout); /* Fix for bug in SunOS 5.5 printf(3) */ +#endif } if (do_v9 && temp) free (temp); |