From 86b7c20b7d090c5720e297829757323253b2ba0c Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Tue, 2 Jun 2020 13:51:12 +0900 Subject: [PATCH] Implement "j" modifier for printf format It's a part of C99 and commonly used these days. --- libs/libc/stdio/lib_libvsprintf.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libs/libc/stdio/lib_libvsprintf.c b/libs/libc/stdio/lib_libvsprintf.c index e1101d8ef9..7a0f01850e 100644 --- a/libs/libc/stdio/lib_libvsprintf.c +++ b/libs/libc/stdio/lib_libvsprintf.c @@ -410,6 +410,18 @@ static int vsprintf_internal(FAR struct lib_outstream_s *stream, } } + if (c == 'j') + { + /* Same as long long if available. Otherwise, long. */ + +#ifdef CONFIG_LIBC_LONG_LONG + flags |= FL_REPD_TYPE; +#endif + flags |= FL_LONG; + flags &= ~FL_SHORT; + continue; + } + if (c == 'l') { if ((flags & FL_LONG) != 0)