aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimbeerserverDE <himbeerserverde@gmail.com>2022-04-24 21:52:59 +0200
committerHimbeerserverDE <himbeerserverde@gmail.com>2022-04-24 21:52:59 +0200
commit58ec0a557b08638c3a5b5547f05d087c71f4d437 (patch)
treee6e3e6275fdff8a2e71b82e253900d32b955f515
parent750b25871dae2ff69ca35c3c8d83ba548b8ac5fb (diff)
Turn lprintf into vlprintf for future extensibility
-rw-r--r--clog.c8
-rw-r--r--clog.h4
2 files changed, 4 insertions, 8 deletions
diff --git a/clog.c b/clog.c
index b4d0dd4..3d2e009 100644
--- a/clog.c
+++ b/clog.c
@@ -1,4 +1,3 @@
-#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -7,11 +6,8 @@
#define TIMESTRLEN 20
-int lprintf(const char *format, ...)
+int vlprintf(const char *format, va_list ap)
{
- va_list ap;
- va_start(ap, format);
-
time_t timer = time(NULL);
struct tm *tm_info = localtime(&timer);
@@ -29,7 +25,5 @@ int lprintf(const char *format, ...)
strcat(fmt, "\n");
n += vprintf(format, ap);
-
- va_end(ap);
return n;
}
diff --git a/clog.h b/clog.h
index 50b8455..216eed8 100644
--- a/clog.h
+++ b/clog.h
@@ -1,6 +1,8 @@
#ifndef _CLOG_H_
#define _CLOG_H_
-int lprintf(const char *format, ...);
+#include <stdarg.h>
+
+int vlprintf(const char *format, va_list ap);
#endif