blob: 717b5228e26bb191f271432cd7fa55c98cc4a8ee [file] [log] [blame]
Harry Liebel0f702c62013-12-17 18:19:04 +00001/*
Antonio Nino Diaz9eddb1e2018-08-16 14:53:05 +01002 * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
Harry Liebel0f702c62013-12-17 18:19:04 +00003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Harry Liebel0f702c62013-12-17 18:19:04 +00005 */
6
7#include <stdio.h>
Harry Liebel0f702c62013-12-17 18:19:04 +00008
9int puts(const char *s)
10{
11 int count = 0;
Antonio Nino Diaz9eddb1e2018-08-16 14:53:05 +010012
13 while (*s) {
Jonathan Wright9b2770e2018-03-06 16:23:28 +000014 if (putchar(*s++) == EOF)
15 return EOF;
16 count++;
Harry Liebel0f702c62013-12-17 18:19:04 +000017 }
Harry Liebel1bc9e1f2013-12-12 16:46:30 +000018
Jonathan Wright9b2770e2018-03-06 16:23:28 +000019 if (putchar('\n') == EOF)
20 return EOF;
Harry Liebel1bc9e1f2013-12-12 16:46:30 +000021
Jonathan Wright9b2770e2018-03-06 16:23:28 +000022 return count + 1;
Harry Liebel0f702c62013-12-17 18:19:04 +000023}