blob: f57fc98210a67b47484c96fb0fb446590af28410 [file] [log] [blame]
Harry Liebel0f702c62013-12-17 18:19:04 +00001/*
Govindraj Rajaeee28e72023-08-01 15:52:40 -05002 * 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}