Harry Liebel | 0f702c6 | 2013-12-17 18:19:04 +0000 | [diff] [blame] | 1 | /* |
Antonio Nino Diaz | 9eddb1e | 2018-08-16 14:53:05 +0100 | [diff] [blame] | 2 | * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved. |
Harry Liebel | 0f702c6 | 2013-12-17 18:19:04 +0000 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Harry Liebel | 0f702c6 | 2013-12-17 18:19:04 +0000 | [diff] [blame] | 5 | */ |
6 | |||||
7 | #include <stdio.h> | ||||
Harry Liebel | 0f702c6 | 2013-12-17 18:19:04 +0000 | [diff] [blame] | 8 | |
9 | int puts(const char *s) | ||||
10 | { | ||||
11 | int count = 0; | ||||
Antonio Nino Diaz | 9eddb1e | 2018-08-16 14:53:05 +0100 | [diff] [blame] | 12 | |
Antonio Nino Diaz | 2e74f9b | 2018-08-23 15:11:46 +0100 | [diff] [blame] | 13 | while (*s != '\0') { |
14 | if (putchar(*s) == EOF) | ||||
Jonathan Wright | 9b2770e | 2018-03-06 16:23:28 +0000 | [diff] [blame] | 15 | return EOF; |
Antonio Nino Diaz | 2e74f9b | 2018-08-23 15:11:46 +0100 | [diff] [blame] | 16 | s++; |
Jonathan Wright | 9b2770e | 2018-03-06 16:23:28 +0000 | [diff] [blame] | 17 | count++; |
Harry Liebel | 0f702c6 | 2013-12-17 18:19:04 +0000 | [diff] [blame] | 18 | } |
Harry Liebel | 1bc9e1f | 2013-12-12 16:46:30 +0000 | [diff] [blame] | 19 | |
Jonathan Wright | 9b2770e | 2018-03-06 16:23:28 +0000 | [diff] [blame] | 20 | if (putchar('\n') == EOF) |
21 | return EOF; | ||||
Harry Liebel | 1bc9e1f | 2013-12-12 16:46:30 +0000 | [diff] [blame] | 22 | |
Jonathan Wright | 9b2770e | 2018-03-06 16:23:28 +0000 | [diff] [blame] | 23 | return count + 1; |
Harry Liebel | 0f702c6 | 2013-12-17 18:19:04 +0000 | [diff] [blame] | 24 | } |