From 012f9e4156919157bfff0d5ce8f105a04b0c4a70 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Fri, 17 Mar 2017 23:16:21 +0100 Subject: client: Start working on a simple client --- client/global.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 client/global.c (limited to 'client/global.c') diff --git a/client/global.c b/client/global.c new file mode 100644 index 0000000..bf5bf2e --- /dev/null +++ b/client/global.c @@ -0,0 +1,33 @@ +#include +#include +#include +#include +#include +#include "global.h" + +__attribute__((noreturn, format(printf, 1, 2))) +void die(const char *format,...){ + fprintf(stderr,"DIE: "); + va_list ap; + va_start(ap,format); + vfprintf(stderr,format,ap); + va_end(ap); + fputc('\n',stderr); + exit(1); +} + +__attribute__((noreturn)) +void die_perror(const char *func){ + fprintf(stderr,"DIE: %s: %s\n",func,strerror(errno)); + exit(1); +} + +__attribute__((format (printf, 1, 2))) +void debug(const char *format,...){ + fprintf(stderr,"DEBUG: "); + va_list ap; + va_start(ap,format); + vfprintf(stderr,format,ap); + va_end(ap); + fputc('\n',stderr); +} -- cgit v1.2.3-54-g00ecf