X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=int%2Finterface_linux.c;h=381df88ce64219169b9b758c3ae962a60610a1b4;hb=525d00c72526e69f4b852178306bc7c34f6d1fcc;hp=33fd00349f3bea4eb8949fbf76d4007da6297e71;hpb=fb5465ae10e39a9505634e0aaf8e1cab9710f5d7;p=mTask.git diff --git a/int/interface_linux.c b/int/interface_linux.c index 33fd003..381df88 100644 --- a/int/interface_linux.c +++ b/int/interface_linux.c @@ -49,7 +49,6 @@ bool input_available(void){ pdie("select"); if(!FD_ISSET(fd, &fds)) return false; - read(fd, &bt, 1); return true; } @@ -144,7 +143,26 @@ void setup(void) pdie("accept"); } -void test(void) +void debug(char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + fprintf(stderr, "\n"); + va_end(ap); +} + +void pdie(char *s) { + perror(s); + die(""); +} +void die(char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + exit(EXIT_FAILURE); }