xref: /rk3399_ARM-atf/lib/libc/puts.c (revision 4661abc7c44926ac34ce96deb9e332a6804a2520)
161f72a34SRoberto Vargas /*
2*4661abc7SAntonio Nino Diaz  * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
361f72a34SRoberto Vargas  *
461f72a34SRoberto Vargas  * SPDX-License-Identifier: BSD-3-Clause
561f72a34SRoberto Vargas  */
661f72a34SRoberto Vargas 
761f72a34SRoberto Vargas #include <stdio.h>
861f72a34SRoberto Vargas 
961f72a34SRoberto Vargas int puts(const char *s)
1061f72a34SRoberto Vargas {
1161f72a34SRoberto Vargas 	int count = 0;
12*4661abc7SAntonio Nino Diaz 
1361f72a34SRoberto Vargas 	while (*s) {
1461f72a34SRoberto Vargas 		if (putchar(*s++) == EOF)
1561f72a34SRoberto Vargas 			return EOF;
1661f72a34SRoberto Vargas 		count++;
1761f72a34SRoberto Vargas 	}
1861f72a34SRoberto Vargas 
1961f72a34SRoberto Vargas 	if (putchar('\n') == EOF)
2061f72a34SRoberto Vargas 		return EOF;
2161f72a34SRoberto Vargas 
2261f72a34SRoberto Vargas 	return count + 1;
2361f72a34SRoberto Vargas }
24