diff --git a/include/stdio.h b/include/stdio.h index b228fcdecae..5931ac91a74 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -192,10 +192,11 @@ int vfprintf(FAR FILE *stream, FAR const IPTR char *fmt, va_list ap); int vfscanf(FAR FILE *stream, FAR const IPTR char *fmt, va_list ap); int vprintf(FAR const IPTR char *fmt, va_list ap); +int vscanf(FAR const IPTR char *fmt, va_list ap); int vsnprintf(FAR char *buf, size_t size, FAR const IPTR char *fmt, va_list ap); int vsprintf(FAR char *buf, FAR const IPTR char *fmt, va_list ap); -int vsscanf(FAR const char *buf, FAR const char *fmt, va_list ap); +int vsscanf(FAR const char *buf, FAR const IPTR char *fmt, va_list ap); /* Operations on file descriptors including: * diff --git a/libs/libc/libc.csv b/libs/libc/libc.csv index f1f63751fab..37002078c13 100644 --- a/libs/libc/libc.csv +++ b/libs/libc/libc.csv @@ -9,7 +9,7 @@ "aio_return","aio.h","defined(CONFIG_FS_AIO)","ssize_t","FAR struct aiocb *" "aio_suspend","aio.h","defined(CONFIG_FS_AIO)","int","FAR const struct aiocb * const []|FAR const struct aiocb * const *","int","FAR const struct timespec *" "alarm","unistd.h","!defined(CONFIG_DISABLE_POSIX_TIMERS)","unsigned int","unsigned int" -"asprintf","stdio.h","","int","FAR char **","FAR const char *","..." +"asprintf","stdio.h","","int","FAR char **","FAR const IPTR char *","..." "b16atan2","fixedmath.h","!defined(CONFIG_HAVE_LONG_LONG)","b16_t","b16_t","b16_t" "b16cos","fixedmath.h","","b16_t","b16_t" "b16divb16","fixedmath.h","!defined(CONFIG_HAVE_LONG_LONG)","b16_t","b16_t","b16_t" @@ -42,7 +42,7 @@ "fgets","stdio.h","CONFIG_NFILE_STREAMS > 0","FAR char *","FAR char *","int","FAR FILE *" "fileno","stdio.h","","int","FAR FILE *" "fopen","stdio.h","CONFIG_NFILE_STREAMS > 0","FAR FILE *","FAR const char *","FAR const char *" -"fprintf","stdio.h","CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","FAR const char *","..." +"fprintf","stdio.h","CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","FAR const IPTR char *","..." "fputc","stdio.h","CONFIG_NFILE_STREAMS > 0","int","int","FAR FILE *" "fputs","stdio.h","CONFIG_NFILE_STREAMS > 0","int","FAR const char *","FAR FILE *" "fread","stdio.h","CONFIG_NFILE_STREAMS > 0","size_t","FAR void *","size_t","size_t","FAR FILE *" @@ -105,7 +105,7 @@ "ntohs","arpa/inet.h","","uint16_t","uint16_t" "perror","stdio.h","CONFIG_NFILE_STREAMS > 0","void","FAR const char *" "pipe","unistd.h","","int","int [2]|FAR int *" -"printf","stdio.h","","int","FAR const char *","..." +"printf","stdio.h","","int","FAR const IPTR char *","..." "pthread_attr_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_attr_t *" "pthread_attr_getinheritsched","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR const pthread_attr_t *","FAR int *" "pthread_attr_getschedparam","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR const pthread_attr_t *","FAR struct sched_param *" @@ -155,8 +155,8 @@ "sigfillset","signal.h","","int","FAR sigset_t *" "sigismember","signal.h","","int","FAR const sigset_t *","int" "sleep","unistd.h","","unsigned int","unsigned int" -"snprintf","stdio.h","","int","FAR char *","size_t","FAR const char *","..." -"sprintf","stdio.h","","int","FAR char *","FAR const char *","..." +"snprintf","stdio.h","","int","FAR char *","size_t","FAR const IPTR char *","..." +"sprintf","stdio.h","","int","FAR char *","FAR const IPTR char *","..." "sq_addafter","queue.h","","void","FAR sq_entry_t *","FAR sq_entry_t *","FAR sq_queue_t *" "sq_addfirst","queue.h","","void","FAR sq_entry_t *","FAR sq_queue_t *" "sq_addlast","queue.h","","void","FAR sq_entry_t *","FAR sq_queue_t *" @@ -165,7 +165,7 @@ "sq_remfirst","queue.h","","FAR sq_entry_t *","FAR sq_queue_t *" "sq_remlast","queue.h","","FAR sq_entry_t *","FAR sq_queue_t *" "srand","stdlib.h","","void","unsigned int" -"sscanf","stdio.h","","int","FAR const char *","FAR const char *","..." +"sscanf","stdio.h","","int","FAR const IPTR char *","FAR const char *","..." "strcasecmp","strings.h","","int","FAR const char *","FAR const char *" "strcasestr","string.h","","FAR char *","FAR const char *","FAR const char *" "strcat","string.h","","FAR char *","FAR char *","FAR const char *" @@ -199,7 +199,7 @@ "strxfrm","string.h","defined(CONFIG_LIBC_LOCALE)","size_t","FAR char *","FAR const char *","size_t" "swab","unistd.h","","void","FAR const void *","FAR void *","ssize_t" "swprintf","wchar.h","defined(CONFIG_LIBC_WCHAR)","int","FAR wchar_t *","size_t","FAR const wchar_t *","..." -"syslog","syslog.h","","void","int","FAR const char *","..." +"syslog","syslog.h","","void","int","FAR const IPTR char *","..." "tcflush","termios.h","defined(CONFIG_SERIAL_TERMIOS)","int","int","int" "tcgetattr","termios.h","defined(CONFIG_SERIAL_TERMIOS)","int","int","FAR struct termios *" "tcsetattr","termios.h","defined(CONFIG_SERIAL_TERMIOS)","int","int","int","FAR const struct termios *" @@ -212,13 +212,14 @@ "ub16sqr","fixedmath.h","!defined(CONFIG_HAVE_LONG_LONG)","ub16_t","ub16_t" "ungetc","stdio.h","CONFIG_NFILE_STREAMS > 0","int","int","FAR FILE *" "usleep","unistd.h","","int","useconds_t" -"vasprintf","stdio.h","","int","FAR char **","FAR const char *","va_list" -"vfprintf","stdio.h","CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","FAR const char *","va_list" -"vprintf","stdio.h","CONFIG_NFILE_STREAMS > 0","int","FAR const char *","va_list" -"vsnprintf","stdio.h","","int","FAR char *","size_t","FAR const char *","va_list" -"vsprintf","stdio.h","","int","FAR char *","FAR const char *","va_list" -"vsscanf","stdio.h","","int","FAR const char *","FAR const char *","va_list" -"vsyslog","syslog.h","","void","int","FAR const char *","va_list" +"vasprintf","stdio.h","","int","FAR char **","FAR const IPTR char *","va_list" +"vfprintf","stdio.h","CONFIG_NFILE_STREAMS > 0","int","FAR FILE *","FAR const IPTR char *","va_list" +"vprintf","stdio.h","CONFIG_NFILE_STREAMS > 0","int","FAR const IPTR char *","va_list" +"vscanf","stdio.h","CONFIG_NFILE_STREAMS > 0","int","FAR const IPTR char *","va_list" +"vsnprintf","stdio.h","","int","FAR char *","size_t","FAR const IPTR char *","va_list" +"vsprintf","stdio.h","","int","FAR char *","FAR const IPTR char *","va_list" +"vsscanf","stdio.h","","int","FAR const char *","FAR const IPTR char *","va_list" +"vsyslog","syslog.h","","void","int","FAR const IPTR char *","va_list" "wcrtomb","wchar.h","defined(CONFIG_LIBC_WCHAR)","size_t","FAR char *","wchar_t","FAR mbstate_t *" "wcscmp","wchar.h","defined(CONFIG_LIBC_WCHAR)","int","FAR const wchar_t *","FAR const wchar_t *" "wcscoll","wchar.h","defined(CONFIG_LIBC_WCHAR)","int","FAR const wchar_t *","FAR const wchar_t *" diff --git a/libs/libc/stdio/Make.defs b/libs/libc/stdio/Make.defs index e00af30574d..5af1ae7e18a 100644 --- a/libs/libc/stdio/Make.defs +++ b/libs/libc/stdio/Make.defs @@ -60,7 +60,7 @@ CSRCS += lib_stdinstream.c lib_stdoutstream.c lib_stdsistream.c CSRCS += lib_stdsostream.c lib_perror.c lib_feof.c lib_ferror.c CSRCS += lib_rawinstream.c lib_rawoutstream.c lib_rawsistream.c CSRCS += lib_rawsostream.c lib_remove.c lib_clearerr.c lib_scanf.c -CSRCS += lib_fscanf.c lib_vfscanf.c lib_tmpfile.c +CSRCS += lib_vscanf.c lib_fscanf.c lib_vfscanf.c lib_tmpfile.c endif diff --git a/libs/libc/stdio/lib_vscanf.c b/libs/libc/stdio/lib_vscanf.c new file mode 100644 index 00000000000..bd491059d4a --- /dev/null +++ b/libs/libc/stdio/lib_vscanf.c @@ -0,0 +1,40 @@ +/**************************************************************************** + * libs/libc/stdio/lib_vscanf.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: vscanf + ****************************************************************************/ + +int vscanf(FAR const IPTR char *fmt, va_list ap) +{ + /* vfscanf from stdin */ + + return vfscanf(stdin, fmt, ap); +} diff --git a/libs/libc/stdio/lib_vsscanf.c b/libs/libc/stdio/lib_vsscanf.c index 979a0190907..80187ce4520 100644 --- a/libs/libc/stdio/lib_vsscanf.c +++ b/libs/libc/stdio/lib_vsscanf.c @@ -53,7 +53,7 @@ * Name: vsscanf ****************************************************************************/ -int vsscanf(FAR const char *buf, FAR const char *fmt, va_list ap) +int vsscanf(FAR const char *buf, FAR const IPTR char *fmt, va_list ap) { struct lib_meminstream_s meminstream; int n; @@ -65,7 +65,6 @@ int vsscanf(FAR const char *buf, FAR const char *fmt, va_list ap) /* Then let lib_vscanf do the real work */ - n = lib_vscanf((FAR struct lib_instream_s *)&meminstream.public, NULL, fmt, ap); return n;