#include "config.h" #include "db.h" #include "iCal.h" #include "llist.h" #include "planner.h" // for subject and event structs #include "ui.h" #include #include int main() { time_t now = time(NULL); // create new task named LinAlg with priority 3, created now with deadline in // 5 days sp is currently unused spare var Task *t1 = newTask("LinAlg", now, now + days(5), 3, 0); // Stack Allocated vars only for local use! Task t2 = { .name = "Phys", .created = now, .deadline = now + days(2), .priority = 7}; printf("%s\n", ctime(&now)); // new llist test llist *list1 = llistNew(t1, cmpTask); llistAppend(list1, &t2); // print test tasks printTask(t1); printTask(&t2); // find in list & modify Task search = {.name = "Phys"}; // key to look for. cmpTask only compares // names using strcmp(a.name, b.name) llist *found = llistGet(list1, &search); if (found != NULL) { ((Task *)found->data)->deadline = time(NULL) + days(10); ((Task *)found->data)->priority = 9; printTask(found->data); } else { printf("%s not in List!\n", search.name); } char *t1Str = taskToStr(t1); printf("%s\n", t1Str); free(t1Str); free(t1); return 0; }