blob: 2a0ca11c62e2315fca8e4ccf75a61613f8676a83 [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
Antonio Nino Diaz2e74f9b2018-08-23 15:11:46 +010013 while (*s != '\0') {
14 if (putchar(*s) == EOF)
Jonathan Wright9b2770e2018-03-06 16:23:28 +000015 return EOF;
Antonio Nino Diaz2e74f9b2018-08-23 15:11:46 +010016 s++;
Jonathan Wright9b2770e2018-03-06 16:23:28 +000017 count++;
Harry Liebel0f702c62013-12-17 18:19:04 +000018 }
Harry Liebel1bc9e1f2013-12-12 16:46:30 +000019
Jonathan Wright9b2770e2018-03-06 16:23:28 +000020 if (putchar('\n') == EOF)
21 return EOF;
Harry Liebel1bc9e1f2013-12-12 16:46:30 +000022
Jonathan Wright9b2770e2018-03-06 16:23:28 +000023 return count + 1;
Harry Liebel0f702c62013-12-17 18:19:04 +000024}