blob: d330f5821fec9f4ca97fc17dafd756984da22254 [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
Antonio Nino Diaz09a00ef2019-01-11 13:12:58 +00007#include <drivers/console.h>
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02008#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}