mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 06:42:32 +08:00
libs/libc/stdio: In the recent changes we lost the implementation of vsscanf(). This commit restores vsscanf(). sscanf() is not just a front end for vsscanf().
This commit is contained in:
@@ -43,7 +43,8 @@ CSRCS += lib_vsnprintf.c lib_dprintf.c lib_vdprintf.c
|
||||
CSRCS += lib_meminstream.c lib_memoutstream.c lib_memsistream.c
|
||||
CSRCS += lib_memsostream.c lib_lowoutstream.c
|
||||
CSRCS += lib_zeroinstream.c lib_nullinstream.c lib_nulloutstream.c
|
||||
CSRCS += lib_sscanf.c lib_libsscanf.c lib_libnoflush.c lib_libsnoflush.c
|
||||
CSRCS += lib_sscanf.c lib_vsscanf.c lib_libsscanf.c lib_libnoflush.c
|
||||
CSRCS += lib_libsnoflush.c
|
||||
|
||||
ifeq ($(CONFIG_NANO_PRINTF),y)
|
||||
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include "libc.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@@ -52,7 +54,7 @@ int fscanf(FAR FILE *stream, FAR const IPTR char *fmt, ...)
|
||||
va_list ap;
|
||||
int n;
|
||||
|
||||
/* vfprintf into the stream */
|
||||
/* vscanf from the stream */
|
||||
|
||||
va_start(ap, fmt);
|
||||
n = vfscanf(stream, fmt, ap);
|
||||
|
||||
@@ -52,6 +52,8 @@
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/streams.h>
|
||||
|
||||
#include "libc.h"
|
||||
|
||||
/****************************************************************************
|
||||
@@ -74,17 +76,6 @@
|
||||
# define MAX(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
int lib_vsscanf(FAR struct lib_instream_s *obj, FAR int *lastc,
|
||||
FAR const IPTR char *fmt, va_list ap);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <nuttx/streams.h>
|
||||
#include "libc.h"
|
||||
|
||||
/****************************************************************************
|
||||
@@ -52,20 +53,14 @@
|
||||
|
||||
int sscanf(FAR const char *buf, FAR const IPTR char *fmt, ...)
|
||||
{
|
||||
struct lib_meminstream_s meminstream;
|
||||
va_list ap;
|
||||
int n;
|
||||
|
||||
/* Initialize a memory stream to write to the buffer */
|
||||
|
||||
lib_meminstream((FAR struct lib_meminstream_s *)&meminstream, buf,
|
||||
LIB_BUFLEN_UNKNOWN);
|
||||
|
||||
/* Then let lib_vsscanf do the real work */
|
||||
/* vsscanf from the buffer */
|
||||
|
||||
va_start(ap, fmt);
|
||||
n = lib_vsscanf((FAR struct lib_instream_s *)&meminstream.public, NULL,
|
||||
fmt, ap);
|
||||
n = vsscanf(buf, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@
|
||||
#include <stdio.h>
|
||||
#include <semaphore.h>
|
||||
|
||||
#include <nuttx/streams.h>
|
||||
|
||||
#include "libc.h"
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user