aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeyi Guo <guoheyi@linux.alibaba.com>2020-10-27 08:36:40 +0800
committerHeyi Guo <guoheyi@linux.alibaba.com>2021-01-20 13:09:13 +0800
commit128c5f02859579ce15df18c5d443565778b2d3bf (patch)
tree97ba549824127ed30daa7d79f77a394f5de26eca /lib
parentf03c4ea8e604bcf5d13af3012e0ba7ec56e3180f (diff)
downloadtrusted-firmware-a-128c5f02859579ce15df18c5d443565778b2d3bf.tar.gz
libc/printf: add support to print "%" character
Enable printf() in TF-A to print "%" character as C standard, which may be used in platform porting to print percentage information. Signed-off-by: Heyi Guo <guoheyi@linux.alibaba.com> Change-Id: I7af2f1d153548e426f423fce15dc48b0da56c622
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/printf.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libc/printf.c b/lib/libc/printf.c
index 2715a72d4f..45e153ec7d 100644
--- a/lib/libc/printf.c
+++ b/lib/libc/printf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2014-2021, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -108,6 +108,9 @@ int vprintf(const char *fmt, va_list args)
/* Check the format specifier */
loop:
switch (*fmt) {
+ case '%':
+ (void)putchar('%');
+ break;
case 'i': /* Fall through to next one */
case 'd':
num = get_num_va_args(args, l_count);