xref: /rk3399_ARM-atf/lib/libc/puts.c (revision 4c700c1563aff7b51df95f17e952e050b9b4e37f)
161f72a34SRoberto Vargas /*
2*4c700c15SGovindraj Raja  * 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;
124661abc7SAntonio Nino Diaz 
13d5ccb754SAntonio Nino Diaz 	while (*s != '\0') {
14d5ccb754SAntonio Nino Diaz 		if (putchar(*s) == EOF)
1561f72a34SRoberto Vargas 			return EOF;
16d5ccb754SAntonio Nino Diaz 		s++;
1761f72a34SRoberto Vargas 		count++;
1861f72a34SRoberto Vargas 	}
1961f72a34SRoberto Vargas 
2061f72a34SRoberto Vargas 	if (putchar('\n') == EOF)
2161f72a34SRoberto Vargas 		return EOF;
2261f72a34SRoberto Vargas 
2361f72a34SRoberto Vargas 	return count + 1;
2461f72a34SRoberto Vargas }
25