netinet/in.h: add IPPROTO_MH
[uclibc-ng.git] / libc / stdio / fputs.c
blobb3ede687189ae51c61f0c20404afe32f7581341a
1 /* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
3 * GNU Library General Public License (LGPL) version 2 or later.
5 * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
6 */
8 #include "_stdio.h"
12 /* Note: The standard says fputs returns a nonnegative number on
13 * success. In this implementation, we return the length of the
14 * string written on success.
17 #ifdef __DO_UNLOCKED
19 int fputs_unlocked(register const char * __restrict s,
20 FILE * __restrict stream)
22 size_t n = strlen(s);
24 return ((fwrite_unlocked(s, 1, n, stream) == n) ? n : EOF);
26 libc_hidden_def(fputs_unlocked)
28 #ifndef __UCLIBC_HAS_THREADS__
29 strong_alias(fputs_unlocked,fputs)
30 libc_hidden_def(fputs)
31 #endif
33 #elif defined __UCLIBC_HAS_THREADS__
35 int fputs(const char * __restrict s, register FILE * __restrict stream)
37 int retval;
38 __STDIO_AUTO_THREADLOCK_VAR;
40 __STDIO_AUTO_THREADLOCK(stream);
42 retval = fputs_unlocked(s, stream);
44 __STDIO_AUTO_THREADUNLOCK(stream);
46 return retval;
48 libc_hidden_def(fputs)
50 #endif