From ce48250dbf5d93a0617c7683db9959f2fcacacc6 Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Fri, 18 Nov 2016 19:43:24 +0100 Subject: [PATCH] infrastructuur voor het lezen van taken --- int/int.c | 93 +++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 63 insertions(+), 30 deletions(-) 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