fix install script
[mTask.git] / int / interface_linux.c
index 33fd003..dd94993 100644 (file)
@@ -49,7 +49,6 @@ bool input_available(void){
                pdie("select");
        if(!FD_ISSET(fd, &fds))
                return false;
-       read(fd, &bt, 1);
        return true;
 }
 
@@ -74,7 +73,7 @@ void write_dpin(uint8_t i, bool b)
 bool read_dpin(uint8_t i)
 {
        debug("dread %d", i);
-       return false;
+       return true;
        (void) i;
 }
 
@@ -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);
 }