From ae6a7a452632bb36e4d2534cc6cecd8ef86dcb50 Mon Sep 17 00:00:00 2001 From: wangjianyu3 Date: Tue, 16 Jul 2024 20:26:08 +0800 Subject: [PATCH] libs/libc/sscanf: Support pointer format Signed-off-by: wangjianyu3 --- libs/libc/stdio/lib_libvscanf.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libs/libc/stdio/lib_libvscanf.c b/libs/libc/stdio/lib_libvscanf.c index c00abd6c56..755f1c3c82 100644 --- a/libs/libc/stdio/lib_libvscanf.c +++ b/libs/libc/stdio/lib_libvscanf.c @@ -292,9 +292,9 @@ int lib_vscanf(FAR struct lib_instream_s *stream, FAR int *lastc, linfo("Processing %c\n", fmt_char(fmt)); #ifdef CONFIG_LIBC_SCANSET - if (strchr("dibouxXcseEfFgGaAn[%", fmt_char(fmt))) + if (strchr("diboupxXcseEfFgGaAn[%", fmt_char(fmt))) #else - if (strchr("dibouxXcseEfFgGaAn%", fmt_char(fmt))) + if (strchr("diboupxXcseEfFgGaAn%", fmt_char(fmt))) #endif { if (fmt_char(fmt) != '%') @@ -561,9 +561,9 @@ int lib_vscanf(FAR struct lib_instream_s *stream, FAR int *lastc, } } - /* Process %d, %o, %b, %x, %u: Various integer conversions */ + /* Process %d, %o, %b, %p, %x, %u: Various integer conversions */ - else if (strchr("dobxXui", fmt_char(fmt))) + else if (strchr("dobpxXui", fmt_char(fmt))) { bool sign; @@ -682,6 +682,7 @@ int lib_vscanf(FAR struct lib_instream_s *stream, FAR int *lastc, base = 10; break; + case 'p': case 'x': case 'X': while (fwidth < width && !stopconv)