From d605727d4bb3b7ae19dc0227d55030a7ebc73148 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Thu, 28 Sep 2023 10:27:39 +0530 Subject: server: init --- util.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 util.h (limited to 'util.h') diff --git a/util.h b/util.h new file mode 100644 index 0000000..fbaf60c --- /dev/null +++ b/util.h @@ -0,0 +1,16 @@ +#include +#include + +enum plog { PLOG_INFO, PLOG_WARN, PLOG_ERR }; +static const char *msg[] = { "info", "warn", "eror"}; + +void plog(enum plog type, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + fprintf(stderr, "%s: ",msg[type]); + vfprintf(stderr, fmt, args); + putc('\n', stderr); + va_end(args); +} -- cgit v1.2.3