06b738d514c22d7c98183f7998a556916a50c29d
12 struct task tasks
[MAXTASKS
];
16 memset(&tasks
, 0, sizeof(struct task
)*MAXTASKS
);
23 for(ct
= 0; ct
<MAXTASKS
; ct
++)
27 die("Trying to add too much tasks...\n");
29 memset(&tasks
[ct
], 0, sizeof(struct task
));
31 tasks
[ct
].interval
= read16();
33 tasks
[ct
].tlen
= read16();
35 if(tasks
[ct
].tlen
> MAXTASKSIZE
)
36 die("Task is too long: %d\n", tasks
[ct
].tlen
);
38 for(unsigned int i
= 0; i
<tasks
[ct
].tlen
; i
++){
39 tasks
[ct
].bc
[i
] = read_byte();
40 debug("t[][%i]: 0x%02x %d\n", i
,
41 tasks
[ct
].bc
[i
], tasks
[ct
].bc
[i
]);
43 //Return the task number for later removal
44 debug("Received a task of length %d\n", tasks
[ct
].tlen
);
45 tasks
[ct
].used
= true;
46 tasks
[ct
].lastrun
= 0L;
52 tasks
[read_byte()].used
= false;
55 struct task
*task_get(int num
)
57 return tasks
[num
].used
? &tasks
[num
] : NULL
;