blob: 8265667b18f544b1a517212659e332c15baea4ae [file] [log] [blame]
Harry Liebel1bc9e1f2013-12-12 16:46:30 +00001/*
Dan Handleye83b0ca2014-01-14 18:17:09 +00002 * Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved.
Harry Liebel1bc9e1f2013-12-12 16:46:30 +00003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Harry Liebel1bc9e1f2013-12-12 16:46:30 +00005 */
6
7#include <stdio.h>
8#include <console.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}