mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
Add syslog.h; rename lib_rawprintf() to syslog()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5578 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
# This first group of C files do not depend on having file descriptors or
|
||||
# C streams.
|
||||
|
||||
CSRCS += lib_fileno.c lib_printf.c lib_rawprintf.c lib_lowprintf.c \
|
||||
CSRCS += lib_fileno.c lib_printf.c lib_syslog.c lib_lowsyslog.c\
|
||||
lib_sprintf.c lib_asprintf.c lib_snprintf.c lib_libsprintf.c \
|
||||
lib_vsprintf.c lib_avsprintf.c lib_vsnprintf.c lib_libvsprintf.c \
|
||||
lib_meminstream.c lib_memoutstream.c lib_lowinstream.c \
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* libc/stdio/lib_lowprintf.c
|
||||
* libc/stdio/lib_lowsyslog.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@@ -85,12 +85,12 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lib_lowvprintf
|
||||
* Name: lowvsyslog
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_ARCH_LOWPUTC) || defined(CONFIG_SYSLOG)
|
||||
|
||||
int lib_lowvprintf(const char *fmt, va_list ap)
|
||||
int lowvsyslog(const char *fmt, va_list ap)
|
||||
{
|
||||
struct lib_outstream_s stream;
|
||||
|
||||
@@ -105,21 +105,21 @@ int lib_lowvprintf(const char *fmt, va_list ap)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lib_lowprintf
|
||||
* Name: lowsyslog
|
||||
****************************************************************************/
|
||||
|
||||
int lib_lowprintf(const char *fmt, ...)
|
||||
int lowsyslog(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int ret;
|
||||
|
||||
#ifdef CONFIG_DEBUG_ENABLE
|
||||
#ifdef CONFIG_SYSLOG_ENABLE
|
||||
ret = 0;
|
||||
if (g_dbgenable)
|
||||
if (g_syslogenable)
|
||||
#endif
|
||||
{
|
||||
va_start(ap, fmt);
|
||||
ret = lib_lowvprintf(fmt, ap);
|
||||
ret = lowvsyslog(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
@@ -93,9 +93,9 @@ int printf(const char *fmt, ...)
|
||||
#if CONFIG_NFILE_STREAMS > 0
|
||||
ret = vfprintf(stdout, fmt, ap);
|
||||
#elif CONFIG_NFILE_DESCRIPTORS > 0
|
||||
ret = lib_rawvprintf(fmt, ap);
|
||||
ret = vsyslog(fmt, ap);
|
||||
#elif defined(CONFIG_ARCH_LOWPUTC)
|
||||
ret = lib_lowvprintf(fmt, ap);
|
||||
ret = lowvsyslog(fmt, ap);
|
||||
#else
|
||||
# ifdef CONFIG_CPP_HAVE_WARNING
|
||||
# warning "printf has no data sink"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* libc/stdio/lib_rawprintf.c
|
||||
* libc/stdio/lib_syslog.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -40,7 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include "lib_internal.h"
|
||||
|
||||
@@ -88,10 +88,10 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lib_rawvprintf
|
||||
* Name: vsyslog
|
||||
****************************************************************************/
|
||||
|
||||
int lib_rawvprintf(const char *fmt, va_list ap)
|
||||
int vsyslog(const char *fmt, va_list ap)
|
||||
{
|
||||
#if defined(CONFIG_SYSLOG)
|
||||
|
||||
@@ -132,21 +132,21 @@ int lib_rawvprintf(const char *fmt, va_list ap)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lib_rawprintf
|
||||
* Name: syslog
|
||||
****************************************************************************/
|
||||
|
||||
int lib_rawprintf(const char *fmt, ...)
|
||||
int syslog(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int ret;
|
||||
|
||||
#ifdef CONFIG_DEBUG_ENABLE
|
||||
#ifdef CONFIG_SYSLOG_ENABLE
|
||||
ret = 0;
|
||||
if (g_dbgenable)
|
||||
if (g_syslogenable)
|
||||
#endif
|
||||
{
|
||||
va_start(ap, fmt);
|
||||
ret = lib_rawvprintf(fmt, ap);
|
||||
ret = vsyslog(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user