chiark / gitweb /
[PATCH] added vsyslog support to klibc.
authorgreg@kroah.com <greg@kroah.com>
Thu, 23 Oct 2003 07:12:41 +0000 (00:12 -0700)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 04:06:22 +0000 (21:06 -0700)
klibc/klibc/include/syslog.h
klibc/klibc/syslog.c

index b6c0acfea1df759501fdb2625cbe942ebc95455a..a58ef056743f986a4aa86de6776c934efb954cc5 100644 (file)
@@ -6,6 +6,7 @@
 #define _SYSLOG_H
 
 #include <klibc/extern.h>
+#include <stdarg.h>
 
 /* Alert levels */
 #define LOG_EMERG      0
@@ -49,5 +50,6 @@
 __extern void openlog(const char *, int, int);
 __extern void syslog(int, const char *, ...);
 __extern void closelog(void);
+__extern void vsyslog(int, const char *format, va_list ap);
 
 #endif /* _SYSLOG_H */
index b031d4f0e7946ac45356220445ca9df7df3f7153..d40d8633d1cd2e39d1a118ac202fbed24ff2d2dc 100644 (file)
@@ -40,9 +40,8 @@ void openlog(const char *ident, int option, int facility)
   id[MAXID] = '\0';            /* Make sure it's null-terminated */
 }
 
-void syslog(int prio, const char *format, ...)
+void vsyslog(int prio, const char *format, va_list ap)
 {
-  va_list ap;
   char buf[BUFLEN];
   int rv, len;
   int fd;
@@ -62,9 +61,7 @@ void syslog(int prio, const char *format, ...)
   if ( *id )
     len += sprintf(buf+3, "%s: ", id);
   
-  va_start(ap, format);
   rv = vsnprintf(buf+len, BUFLEN-len, format, ap);
-  va_end(ap);
 
   len += rv;
   if ( len > BUFLEN-1 ) len = BUFLEN-1;
@@ -72,3 +69,12 @@ void syslog(int prio, const char *format, ...)
 
   write(fd, buf, len+1);
 }
+
+void syslog(int prio, const char *format, ...)
+{
+  va_list ap;
+
+  va_start(ap, format);
+  vsyslog(prio, format, ap);
+  va_end(ap);
+}