1 /* 2 * Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 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 */ 15 int 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 } 25