diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2013-03-27 09:38:39 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2013-03-27 09:38:39 +0000 |
commit | 409c27f83478e2962c446be23e104a97b3f5f2e0 (patch) | |
tree | 4548f42d093397fb049fdfae40f28968d59499ab /newlib/libc/stdio/puts.c | |
parent | 1ebc8da242a1e8dd7707f2bcc51c22d4e1e64990 (diff) | |
download | newlib-409c27f83478e2962c446be23e104a97b3f5f2e0.zip newlib-409c27f83478e2962c446be23e104a97b3f5f2e0.tar.gz newlib-409c27f83478e2962c446be23e104a97b3f5f2e0.tar.bz2 |
* acconfig.h (_FVWRITE_IN_STREAMIO): Undefine.
* newlib.hin (_FVWRITE_IN_STREAMIO): Undefine.
* configure.in (--disable-newlib-fvwrite-in-streamio): New option.
* configure: Regenerated.
* libc/stdio/fputs.c (_fputs_r): Use _FVWRITE_IN_STREAMIO to
control __sfvwrite_r. Add alternative implementation.
* libc/stdio/fputws.c (_fputws_r): Ditto.
* libc/stdio/fwrite.c (_fwrite_r): Ditto.
* libc/stdio/puts.c (_puts_r): Ditto.
* libc/stdio/vfprintf.c (__ssputs_r, __sfputs_r): New function.
(_VFPRINTF_R): Use _FVWRITE_IN_STREAMIO to control vector buffer.
(__SPRINT): Use _FVWRITE_IN_STREAMIO to control macro definition.
* libc/stdio/vfwprintf.c (_VFWPRINTF_R): Use _FVWRITE_IN_STREAMIO
to control vector buffer.
Diffstat (limited to 'newlib/libc/stdio/puts.c')
-rw-r--r-- | newlib/libc/stdio/puts.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/newlib/libc/stdio/puts.c b/newlib/libc/stdio/puts.c index 7b8b34b..4c60aaa 100644 --- a/newlib/libc/stdio/puts.c +++ b/newlib/libc/stdio/puts.c @@ -78,6 +78,7 @@ _DEFUN(_puts_r, (ptr, s), struct _reent *ptr _AND _CONST char * s) { +#ifdef _FVWRITE_IN_STREAMIO int result; size_t c = strlen (s); struct __suio uio; @@ -99,6 +100,33 @@ _DEFUN(_puts_r, (ptr, s), result = (__sfvwrite_r (ptr, fp, &uio) ? EOF : '\n'); _newlib_flockfile_end (fp); return result; +#else + int result = EOF; + const char *p = s; + FILE *fp; + _REENT_SMALL_CHECK_INIT (ptr); + + fp = _stdout_r (ptr); + _newlib_flockfile_start (fp); + ORIENT (fp, -1); + /* Make sure we can write. */ + if (cantwrite (ptr, fp)) + goto err; + + while (*p) + { + if (__sputc_r (ptr, *p++, fp) == EOF) + goto err; + } + if (__sputc_r (ptr, '\n', fp) == EOF) + goto err; + + result = '\n'; + +err: + _newlib_flockfile_end (fp); + return result; +#endif } #ifndef _REENT_ONLY |