Harry Liebel | 1bc9e1f | 2013-12-12 16:46:30 +0000 | [diff] [blame] | 1 | /* |
Dan Handley | e83b0ca | 2014-01-14 18:17:09 +0000 | [diff] [blame] | 2 | * Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved. |
Harry Liebel | 1bc9e1f | 2013-12-12 16:46:30 +0000 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Harry Liebel | 1bc9e1f | 2013-12-12 16:46:30 +0000 | [diff] [blame] | 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 | } |