From: Mart Lubbers Date: Fri, 18 Nov 2016 18:43:24 +0000 (+0100) Subject: infrastructuur voor het lezen van taken X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=ce48250dbf5d93a0617c7683db9959f2fcacacc6;p=mTask.git infrastructuur voor het lezen van taken --- diff --git a/int/int.c b/int/int.c index 6ef8cc4..2bf2cef 100644 --- a/int/int.c +++ b/int/int.c @@ -24,6 +24,7 @@ #define die(s, ...) {fprintf(stderr, s, ##__VA_ARGS__); exit(1);} char tasks[MAXTASKS][MAXTASKSIZE] = {0}; +bool tasks_used[MAXTASKS] = {0}; void killHandler(int i) { @@ -44,15 +45,58 @@ bool input_available(int fd){ return FD_ISSET(fd, &fds); } -int main(void) +void read_message(int fd_in, int fd_out) { + //Find next task uint8_t c; -// char taskindex = 0; -// int pl, sp, pc; -// - int fd_in = 0; - int next_free_new_task = 0; - uint16_t tasklen = 0; + uint16_t tasklen; + uint8_t ct; + + for(ct = 0; ct MAXTASKSIZE) + die("Task is too long: %d\n", tasklen); + for(int i = 0; i MAXTASKSIZE){ - die("Task is too long: %d\n", tasklen); - } - for(int i = 0; i