summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/ppp/log.c')
-rw-r--r--usr.sbin/ppp/log.c80
1 files changed, 69 insertions, 11 deletions
diff --git a/usr.sbin/ppp/log.c b/usr.sbin/ppp/log.c
index 338cc3b..235321f 100644
--- a/usr.sbin/ppp/log.c
+++ b/usr.sbin/ppp/log.c
@@ -18,13 +18,19 @@
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id:$
- *
- * TODO:
- *
+ *
*/
#include "defs.h"
#include <time.h>
#include <netdb.h>
+#ifdef __STDC__
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+#ifdef NO_VSPRINTF
+#include <stdio.h>
+#endif
#include "hdlc.h"
@@ -118,17 +124,55 @@ LogClose()
#endif
}
+#ifdef NO_VSPRINTF
void
-logprintf(format, arg1, arg2, arg3, arg4, arg5, arg6)
+vsprintf(buf, fmt, av)
+char *buf;
+char *fmt;
+va_list av;
+{
+ FILE foo;
+
+ foo._cnt = BUFSIZ;
+ foo._base = foo._ptr = buf; /* may have to cast(unsigned char *) */
+ foo._flag = _IOWRT+_IOSTRG;
+ (void) _doprnt(fmt, (va_list)av, &foo);
+ *foo._ptr = '\0'; /* plant terminating null character */
+}
+#endif
+
+static void
+vlogprintf(format, ap)
char *format;
-void *arg1, *arg2, *arg3, *arg4, *arg5, *arg6;
+va_list ap;
{
- sprintf(logptr, format, arg1, arg2, arg3, arg4, arg5, arg6);
+ vsprintf(logptr, format, ap);
logptr += strlen(logptr);
LogFlush();
}
void
+#ifdef __STDC__
+logprintf(char *format, ...)
+#else
+logprintf(va_alist)
+va_dcl
+#endif
+{
+ va_list ap;
+#ifdef __STDC__
+ va_start(ap, format);
+#else
+ char *format;
+
+ va_start(ap);
+ format = va_arg(ap, char *);
+#endif
+ vlogprintf(format, ap);
+ va_end(ap);
+}
+
+void
LogDumpBp(level, header, bp)
int level;
char *header;
@@ -211,13 +255,27 @@ LogTimeStamp()
}
void
-LogPrintf(level, format, arg1, arg2, arg3, arg4, arg5, arg6)
-int level;
-char *format;
-void *arg1, *arg2, *arg3, *arg4, *arg5, *arg6;
+#ifdef __STDC__
+LogPrintf(int level, char *format, ...)
+#else
+LogPrintf(va_alist)
+va_dcl
+#endif
{
+ va_list ap;
+#ifdef __STDC__
+ va_start(ap, format);
+#else
+ int level;
+ char *format;
+
+ va_start(ap);
+ int = va_arg(ap, int);
+ format = va_arg(ap, char *);
+#endif
if (!(loglevel & (1 << level)))
return;
LogTimeStamp();
- logprintf(format, arg1, arg2, arg3, arg4, arg5, arg6);
+ vlogprintf(format, ap);
+ va_end(ap);
}
OpenPOWER on IntegriCloud