From 3e6561c3cf9bcc5fa81ecf9f5e90dc496bd3d8d3 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Wed, 23 Sep 2020 17:52:33 +0900 Subject: [PATCH] lib_libvscanf.c: Implement "j" modifier for scanf It's a part of C99 and commonly used these days. --- libs/libc/stdio/lib_libvscanf.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libs/libc/stdio/lib_libvscanf.c b/libs/libc/stdio/lib_libvscanf.c index a4302b3de9c..5bba9ce5eda 100644 --- a/libs/libc/stdio/lib_libvscanf.c +++ b/libs/libc/stdio/lib_libvscanf.c @@ -332,6 +332,15 @@ int lib_vscanf(FAR struct lib_instream_s *obj, FAR int *lastc, fmt++; } } + else if (fmt_char(fmt) == 'j') + { + /* Same as long long if available. Otherwise, long. */ +#ifdef CONFIG_LIBC_LONG_LONG + modifier = LL_MOD; +#else + modifier = L_MOD; +#endif + } else if (fmt_char(fmt) == 'h' || fmt_char(fmt) == 'H') { modifier = H_MOD;