blob: 6b6f75ebbc637792be712aa4e2c32357fa126e7b [file] [log] [blame]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02001/*
2 * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <console.h>
8#include <stdio.h>
9
10/* Putchar() should either return the character printed or EOF in case of error.
11 * Our current console_putc() function assumes success and returns the
12 * character. Write all other printing functions in terms of putchar(), if
13 * possible, so they all benefit when this is improved.
14 */
15int putchar(int c)
16{
17 int res;
18 if (console_putc((unsigned char)c) >= 0)
19 res = c;
20 else
21 res = EOF;
22
23 return res;
24}