puts.c 329 Bytes
Newer Older
1
/*
2
 * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
3
 *
dp-arm's avatar
dp-arm committed
4
 * SPDX-License-Identifier: BSD-3-Clause
5
6
7
8
9
10
11
 */

#include <stdio.h>

int puts(const char *s)
{
	int count = 0;
12
13

	while (*s) {
14
15
16
		if (putchar(*s++) == EOF)
			return EOF;
		count++;
17
	}
18

19
20
	if (putchar('\n') == EOF)
		return EOF;
21

22
	return count + 1;
23
}