2013-12-17 18:19:04 +00:00
|
|
|
/*
|
2014-01-14 18:17:09 +00:00
|
|
|
* Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved.
|
2013-12-17 18:19:04 +00:00
|
|
|
*
|
2017-05-03 09:38:09 +01:00
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
2013-12-17 18:19:04 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
int puts(const char *s)
|
|
|
|
{
|
|
|
|
int count = 0;
|
2018-03-06 16:23:28 +00:00
|
|
|
while(*s) {
|
|
|
|
if (putchar(*s++) == EOF)
|
|
|
|
return EOF;
|
|
|
|
count++;
|
2013-12-17 18:19:04 +00:00
|
|
|
}
|
2013-12-12 16:46:30 +00:00
|
|
|
|
|
|
|
/* According to the puts(3) manpage, the function should write a
|
|
|
|
* trailing newline.
|
|
|
|
*/
|
2018-03-06 16:23:28 +00:00
|
|
|
if (putchar('\n') == EOF)
|
|
|
|
return EOF;
|
2013-12-12 16:46:30 +00:00
|
|
|
|
2018-03-06 16:23:28 +00:00
|
|
|
return count + 1;
|
2013-12-17 18:19:04 +00:00
|
|
|
}
|