blob: 08283a38ce0ec4570667f5cc0b1591675eb3ae04 [file] [log] [blame]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02001/*
2 * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <stdio.h>
8
9int 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}