diff --git a/include/nuttx/streams.h b/include/nuttx/streams.h index c0bd6d53317..8ed689cf14a 100644 --- a/include/nuttx/streams.h +++ b/include/nuttx/streams.h @@ -857,6 +857,13 @@ int lib_vsprintf_internal(FAR struct lib_outstream_s *stream, int lib_vsprintf(FAR struct lib_outstream_s *stream, FAR const IPTR char *src, va_list ap) printf_like(2, 0); +/**************************************************************************** + * Name: lib_scanf + ****************************************************************************/ + +int lib_scanf(FAR struct lib_instream_s *stream, FAR int *lastc, + FAR const IPTR char *fmt, ...) scanf_like(3, 4); + /**************************************************************************** * Name: lib_vscanf * @@ -867,7 +874,7 @@ int lib_vsprintf(FAR struct lib_outstream_s *stream, ****************************************************************************/ int lib_vscanf(FAR struct lib_instream_s *stream, FAR int *lastc, - FAR const IPTR char *src, va_list ap) scanf_like(3, 0); + FAR const IPTR char *fmt, va_list ap) scanf_like(3, 0); /**************************************************************************** * Name: lib_bscanf diff --git a/libs/libc/stream/lib_libvscanf.c b/libs/libc/stream/lib_libvscanf.c index aaa7857b631..05bf2198c7a 100644 --- a/libs/libc/stream/lib_libvscanf.c +++ b/libs/libc/stream/lib_libvscanf.c @@ -1279,6 +1279,24 @@ int lib_vscanf(FAR struct lib_instream_s *stream, FAR int *lastc, return ret; } +/**************************************************************************** + * Name: lib_scanf + ****************************************************************************/ + +int lib_scanf(FAR struct lib_instream_s *stream, FAR int *lastc, + FAR const IPTR char *fmt, ...) +{ + va_list ap; + int n; + + /* Let lib_vscanf do the real work */ + + va_start(ap, fmt); + n = lib_vscanf(stream, lastc, fmt, ap); + va_end(ap); + return n; +} + /**************************************************************************** * Name: lib_bscanf *