From 409c27f83478e2962c446be23e104a97b3f5f2e0 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 27 Mar 2013 09:38:39 +0000 Subject: * 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. --- newlib/libc/stdio/fputs.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'newlib/libc/stdio/fputs.c') diff --git a/newlib/libc/stdio/fputs.c b/newlib/libc/stdio/fputs.c index 6e623a530..de6357a05 100644 --- a/newlib/libc/stdio/fputs.c +++ b/newlib/libc/stdio/fputs.c @@ -77,6 +77,7 @@ _DEFUN(_fputs_r, (ptr, s, fp), char _CONST * s _AND FILE * fp) { +#ifdef _FVWRITE_IN_STREAMIO int result; struct __suio uio; struct __siov iov; @@ -93,6 +94,29 @@ _DEFUN(_fputs_r, (ptr, s, fp), result = __sfvwrite_r (ptr, fp, &uio); _newlib_flockfile_end (fp); return result; +#else + _CONST char *p = s; + + CHECK_INIT(ptr, fp); + + _newlib_flockfile_start (fp); + ORIENT (fp, -1); + /* Make sure we can write. */ + if (cantwrite (ptr, fp)) + goto error; + + while (*p) + { + if (__sputc_r (ptr, *p++, fp) == EOF) + goto error; + } + _newlib_flockfile_exit (fp); + return 0; + +error: + _newlib_flockfile_end (fp); + return EOF; +#endif } #ifndef _REENT_ONLY -- cgit v1.2.3