1 /* 2 * Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #include <stdio.h> 8 9 int puts(const char *s) 10 { 11 int count = 0; 12 while(*s) { 13 if (putchar(*s++) == EOF) 14 return EOF; 15 count++; 16 } 17 18 /* According to the puts(3) manpage, the function should write a 19 * trailing newline. 20 */ 21 if (putchar('\n') == EOF) 22 return EOF; 23 24 return count + 1; 25 } 26