libc: Call vdprintf in printf/vprintf for CONFIG_NFILE_STREAMS == 0

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I3c49ec02a9444f039ac7aac7b8ea6de5d1090340
This commit is contained in:
Xiang Xiao 2020-06-03 02:46:05 +08:00 committed by patacongo
parent a55f8d24a2
commit 29f9d97420
3 changed files with 5 additions and 14 deletions

View File

@ -214,7 +214,7 @@
"usleep","unistd.h","","int","useconds_t"
"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"
"vprintf","stdio.h","","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"

Can't render this file because it has a wrong number of fields in line 2.

View File

@ -39,11 +39,7 @@
****************************************************************************/
#include <stdio.h>
#include <syslog.h>
#include <nuttx/syslog/syslog.h>
#include "libc.h"
#include <unistd.h>
/****************************************************************************
* Public Functions
@ -59,11 +55,7 @@ int printf(FAR const IPTR char *fmt, ...)
int ret;
va_start(ap, fmt);
#if CONFIG_NFILE_STREAMS > 0
ret = vfprintf(stdout, fmt, ap);
#else
ret = nx_vsyslog(LOG_INFO, fmt, &ap);
#endif
ret = vdprintf(STDOUT_FILENO, fmt, ap);
va_end(ap);
return ret;

View File

@ -38,6 +38,7 @@
****************************************************************************/
#include <stdio.h>
#include <unistd.h>
/****************************************************************************
* Public Functions
@ -49,7 +50,5 @@
int vprintf(FAR const IPTR char *fmt, va_list ap)
{
/* vfprintf into stdout */
return vfprintf(stdout, fmt, ap);
return vdprintf(STDOUT_FILENO, fmt, ap);
}