/* * task.h: declares functions for manipulation with tasks */ #ifndef TASK_H #define TASK_H #include #include #include #include enum task_check { // whether to check formula in signal handler or when variable changes SIGNAL, VARCHG }; struct task { uint64_t id; // Time info struct itimerspec times; timer_t timerid; // Command to run int argc; // count of elements in argv 'true' has 1, 'echo Lorem Ipsum' has 3, 'echo Lorem\ ipsum' has 2. char **argv; //NULL terminated list of NUL terminated strings // Formula to be checked when running char *formula; // in RPN, NUL terminated enum task_check when; bool run; // whether to run task in case of when == VARCHG // Disabling/enabling bool enabled; }; bool task_add(struct task t); bool task_disable(uint64_t id); bool task_enable(uint64_t id); bool task_delete(uint64_t id); struct grow *task_list(void); struct task task_details(uint64_t id); bool task_recalc(uint64_t id); bool task_write(struct task t, int fd); struct task *task_read(int fd); bool task_load(const char fn[]); bool task_save(const char fn[]); void task_flush(void); #endif