This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 3e6561c lib_libvscanf.c: Implement "j" modifier for scanf
3e6561c is described below
commit 3e6561c3cf9bcc5fa81ecf9f5e90dc496bd3d8d3
Author: YAMAMOTO Takashi <[email protected]>
AuthorDate: Wed Sep 23 17:52:33 2020 +0900
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 a4302b3..5bba9ce 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;