Home | History | Annotate | Download | only in stdlib
      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 	{
     14 		if (putchar(*s++) != EOF) {
     15 			count++;
     16 		} else {
     17 			count = EOF;
     18 			break;
     19 		}
     20 	}
     21 
     22 	/* According to the puts(3) manpage, the function should write a
     23 	 * trailing newline.
     24 	 */
     25 	if ((count != EOF) && (putchar('\n') != EOF))
     26 		count++;
     27 	else
     28 		count = EOF;
     29 
     30 	return count;
     31 }
     32