Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
97869f4530 | ||
|
|
59cac98023 |
No files matched your search
@@ -1,7 +1,5 @@
|
|||||||
testing
|
testing
|
||||||
debugOut
|
debugOut
|
||||||
*.ics
|
|
||||||
*.csv
|
|
||||||
# ---> C
|
# ---> C
|
||||||
# Prerequisites
|
# Prerequisites
|
||||||
*.d
|
*.d
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ CFLAGS=-Wall -Wextra -g
|
|||||||
|
|
||||||
#files
|
#files
|
||||||
UIF=src/ui.c src/ui.h #UI files
|
UIF=src/ui.c src/ui.h #UI files
|
||||||
UISF=src/uis.c src/uis.h #UI files
|
|
||||||
PLF=src/planner.c src/planner.h #planner files
|
PLF=src/planner.c src/planner.h #planner files
|
||||||
DBF=src/db.c src/db.h #db files
|
DBF=src/db.c src/db.h #db files
|
||||||
CALF=src/iCal.c src/iCal.h
|
CALF=src/iCal.c src/iCal.h
|
||||||
@@ -14,8 +13,8 @@ CONFIG=src/config.h #config file
|
|||||||
|
|
||||||
|
|
||||||
#targets
|
#targets
|
||||||
debug: test planner db iCal config llist uis
|
debug: test ui planner db iCal config llist
|
||||||
gcc test.o planner.o db.o iCal.o llist.o uis.o -o debugOut
|
gcc test.o ui.o planner.o db.o iCal.o llist.o -o debugOut
|
||||||
|
|
||||||
config: $(CONFIG)
|
config: $(CONFIG)
|
||||||
llist: $(LLST)
|
llist: $(LLST)
|
||||||
@@ -25,8 +24,6 @@ test: src/test.c
|
|||||||
iCal: $(CALF)
|
iCal: $(CALF)
|
||||||
gcc -c $(CFLAGS) $(CALF)
|
gcc -c $(CFLAGS) $(CALF)
|
||||||
ui: $(UIF)
|
ui: $(UIF)
|
||||||
uis: $(UISF)
|
|
||||||
gcc -c $(CFLAGS) $(UISF)
|
|
||||||
gcc -c $(CFLAGS) $(UIF)
|
gcc -c $(CFLAGS) $(UIF)
|
||||||
planner: $(PLF)
|
planner: $(PLF)
|
||||||
gcc -c $(CFLAGS) $(PLF)
|
gcc -c $(CFLAGS) $(PLF)
|
||||||
@@ -35,10 +32,10 @@ db: $(DBF)
|
|||||||
|
|
||||||
|
|
||||||
edit:
|
edit:
|
||||||
nvim $(PLF) Makefile $(LLST) src/test.c src/uis.c
|
nvim $(PLF) Makefile $(LLST) src/test.c
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf *.o debugOut src/*.gch *.ics *.csv
|
rm -rf *.o debugOut src/*.gch
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+1
-139
@@ -31,8 +31,6 @@ void llistPrintT(llist *head) {
|
|||||||
c = c->next;
|
c = c->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int exportiCal(llist *ev_ll);
|
|
||||||
int taskLlToFile(llist *tll);
|
|
||||||
// print Event to stdout
|
// print Event to stdout
|
||||||
void printEvent(Event *s) {
|
void printEvent(Event *s) {
|
||||||
char st[26];
|
char st[26];
|
||||||
@@ -243,7 +241,7 @@ llist *genPlan(llist *head, time_t timeAvail) {
|
|||||||
events_ll = events_ll->next;
|
events_ll = events_ll->next;
|
||||||
tmp->next = NULL;
|
tmp->next = NULL;
|
||||||
llistFreeE(tmp);
|
llistFreeE(tmp);
|
||||||
llistPrintE(events_ll);
|
// llistPrintE(events_ll);
|
||||||
|
|
||||||
// update prioriteis in original llist
|
// update prioriteis in original llist
|
||||||
for (int i = 0; i < lLen; i++) {
|
for (int i = 0; i < lLen; i++) {
|
||||||
@@ -256,144 +254,8 @@ llist *genPlan(llist *head, time_t timeAvail) {
|
|||||||
|
|
||||||
planLog("END GEN PLAN", 0);
|
planLog("END GEN PLAN", 0);
|
||||||
|
|
||||||
exportiCal(events_ll);
|
|
||||||
taskLlToFile(head);
|
|
||||||
// llistFreeT(head);
|
// llistFreeT(head);
|
||||||
// send updated tasks to db for storage
|
// send updated tasks to db for storage
|
||||||
|
|
||||||
return events_ll;
|
return events_ll;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *iCalHeader = "BEGIN:VCALENDAR\r\n"
|
|
||||||
"VERSION:2.0\r\n"
|
|
||||||
"PRODID:-//hacksw/handcal//NONSGML v1.0//EN\r\n";
|
|
||||||
const char *iCalEvent = "BEGIN:VEVENT\r\n"
|
|
||||||
"UID:%s%d\r\n"
|
|
||||||
"DTSTAMP:%s\r\n"
|
|
||||||
"DTSTART:%s\r\n"
|
|
||||||
"DTEND:%s\r\n"
|
|
||||||
"SUMMARY:%s\r\n"
|
|
||||||
"END:VEVENT\r\n";
|
|
||||||
|
|
||||||
const char *iCalFileExtension = "ics";
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Wikipedia
|
|
||||||
*
|
|
||||||
*The body of the iCalendar object (the icalbody) contains single-line Calendar
|
|
||||||
* Properties that apply to the entire calendar, as well as one or more blocks
|
|
||||||
* of multiple lines that each define a Calendar Component such as an event,
|
|
||||||
* journal entry, alarm, or one of several other types. Here is a simple example
|
|
||||||
* of an iCalendar object with a single calendar containing a single Calendar
|
|
||||||
* Component, a "Bastille Day Party" event starting at 5pm on July 14, 1997, and
|
|
||||||
* ending at 4am the following morning:[10]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BEGIN:VCALENDAR
|
|
||||||
VERSION:2.0
|
|
||||||
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
|
|
||||||
BEGIN:VEVENT
|
|
||||||
UID:uid1@example.com
|
|
||||||
ORGANIZER;CN=John Doe:MAILTO:john.doe@example.com
|
|
||||||
DTSTART:19970714T170000Z
|
|
||||||
DTEND:19970715T040000Z
|
|
||||||
SUMMARY:Bastille Day Party
|
|
||||||
GEO:48.85299;2.36885
|
|
||||||
END:VEVENT
|
|
||||||
END:VCALENDAR
|
|
||||||
|
|
||||||
|
|
||||||
The UID field distributes updates when a scheduled event changes. When the event
|
|
||||||
is first generated a globally unique identifier is created. If a later event is
|
|
||||||
distributed with the same UID, it replaces the original one. An example UID
|
|
||||||
might be Y2007S2C131M5@example.edu, for the 5th meeting of class 131 in semester
|
|
||||||
2 at a hypothetical college. Email-style UIDs are now considered bad practice,
|
|
||||||
with a UUID recommended instead.[11]
|
|
||||||
|
|
||||||
The most common representation of date and time is a tz timestamp such as
|
|
||||||
20010911T124640Z with the format <year (4 digits)><month (2)><day (2)>T<hour
|
|
||||||
(2)><minute (2)><second (2)>Z for a total fixed length of 16 characters. Z
|
|
||||||
indicates the use of UTC (referring to its Zulu time zone).[12] When used in
|
|
||||||
DTSTART and DTEND properties, start times are inclusive while end times are not.
|
|
||||||
This allows an event's end time to be the same as a consecutive event's start
|
|
||||||
without those events overlapping and potentially creating (false) scheduling
|
|
||||||
conflicts.[13]
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
int exportiCal(llist *events_ll) {
|
|
||||||
|
|
||||||
llist *ev_ll = events_ll;
|
|
||||||
|
|
||||||
llistPrintE(ev_ll);
|
|
||||||
|
|
||||||
printf("%s", iCalHeader);
|
|
||||||
|
|
||||||
time_t now = time(NULL);
|
|
||||||
struct tm lc;
|
|
||||||
localtime_r(&now, &lc);
|
|
||||||
|
|
||||||
// gen filename & open for write
|
|
||||||
char nameBuf[32];
|
|
||||||
strftime(nameBuf, 32 - 12, "%F", &lc);
|
|
||||||
strcat(nameBuf, "dayplan.ics");
|
|
||||||
FILE *fp = fopen(nameBuf, "w");
|
|
||||||
if (fp == NULL) {
|
|
||||||
planLog("fopen failed!!", 1);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
// write iCal header to file
|
|
||||||
fprintf(fp, "%s", iCalHeader);
|
|
||||||
|
|
||||||
// for every event in events_ll create VEVENT str and write to fp
|
|
||||||
int count = 0;
|
|
||||||
while (ev_ll != NULL) {
|
|
||||||
// gen iCal compatible time str
|
|
||||||
Event *current = ev_ll->data;
|
|
||||||
struct tm startlc;
|
|
||||||
struct tm endlc;
|
|
||||||
localtime_r(¤t->plannedStartTime, &startlc);
|
|
||||||
localtime_r(¤t->plannedEndTime, &endlc);
|
|
||||||
char timeStartBuf[17];
|
|
||||||
char timeEndBuf[17];
|
|
||||||
char timeStamp[17];
|
|
||||||
strftime(timeStamp, 17, "%Y%m%dT%k%M%SZ", &lc);
|
|
||||||
printf("%s\n", timeStamp);
|
|
||||||
strftime(timeStartBuf, 17, "%Y%m%dT%k%M%SZ", &startlc);
|
|
||||||
printf("%s\n", timeStartBuf);
|
|
||||||
strftime(timeEndBuf, 17, "%Y%m%dT%k%M%SZ", &endlc);
|
|
||||||
printf("%s\n", timeEndBuf);
|
|
||||||
|
|
||||||
fprintf(fp, iCalEvent, current->task->name, count, timeStamp, timeStartBuf,
|
|
||||||
timeEndBuf, current->task->name);
|
|
||||||
ev_ll = ev_ll->next;
|
|
||||||
count += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// after all events are written end cal with
|
|
||||||
// END:VCALENDAR
|
|
||||||
fprintf(fp, "END:VCALENDAR\r\n");
|
|
||||||
fclose(fp);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *taskFileFormat = "%s,%lu,%lu,%d,%lu\n";
|
|
||||||
int taskLlToFile(llist *tll) {
|
|
||||||
// open file
|
|
||||||
FILE *fp = fopen("db.csv", "w");
|
|
||||||
if (fp == NULL)
|
|
||||||
return -1;
|
|
||||||
llist *c = tll;
|
|
||||||
while (c != NULL) {
|
|
||||||
Task *ct = (Task *)c->data;
|
|
||||||
fprintf(fp, taskFileFormat, ct->name, ct->created, ct->deadline,
|
|
||||||
ct->priority, ct->spare);
|
|
||||||
c = c->next;
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
+3
-2
@@ -9,7 +9,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
int test() {
|
int main() {
|
||||||
|
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
|
|
||||||
@@ -18,6 +18,7 @@ int test() {
|
|||||||
Task *t1 = newTask("LinAlg", now, now + days(5), 3, 0);
|
Task *t1 = newTask("LinAlg", now, now + days(5), 3, 0);
|
||||||
assert(t1 != NULL);
|
assert(t1 != NULL);
|
||||||
|
|
||||||
|
// Stack Allocated vars only for local use!
|
||||||
Task *t2 = newTask("Phys", now, now + days(2), 7, 0);
|
Task *t2 = newTask("Phys", now, now + days(2), 7, 0);
|
||||||
assert(t2 != NULL);
|
assert(t2 != NULL);
|
||||||
Task *t3 = newTask("Analysis", now, now + days(10), 5, 0);
|
Task *t3 = newTask("Analysis", now, now + days(10), 5, 0);
|
||||||
@@ -38,7 +39,7 @@ int test() {
|
|||||||
|
|
||||||
// gnerate plan from task list in time
|
// gnerate plan from task list in time
|
||||||
struct tm *lc = localtime(&now);
|
struct tm *lc = localtime(&now);
|
||||||
lc->tm_hour += 7; // add available time;
|
lc->tm_hour += 4; // add available time;
|
||||||
time_t maxTime = mktime(lc); // create timestamp
|
time_t maxTime = mktime(lc); // create timestamp
|
||||||
llist *l1 = genPlan(list1, maxTime); // return inked list of event;
|
llist *l1 = genPlan(list1, maxTime); // return inked list of event;
|
||||||
llistPrintE(l1);
|
llistPrintE(l1);
|
||||||
|
|||||||
@@ -2,4 +2,138 @@
|
|||||||
* command line interface for user input
|
* command line interface for user input
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
/* Created by Juergen Buechel, 13.12.2024/
|
||||||
|
*/
|
||||||
#include "planner.h" // for subject and event structs
|
#include "planner.h" // for subject and event structs
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "ui.h"
|
||||||
|
#include "planner.h"
|
||||||
|
#include "iCal.h"
|
||||||
|
#include "db.h"
|
||||||
|
|
||||||
|
void dump_buffer(FILE *fp){
|
||||||
|
int ch;
|
||||||
|
while((ch = fgetc(fp)) != EOF && ch != '\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void insertTask(task_ptr newtask)
|
||||||
|
{
|
||||||
|
task_ptr TaskPointer;
|
||||||
|
if (firsttask == NULL){
|
||||||
|
firsttask = newtask;
|
||||||
|
newtask->nextTask ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
TaskPointer = firsttask;
|
||||||
|
while(TaskPointer->nextTask!=NULL)
|
||||||
|
{
|
||||||
|
TaskPointer = TaskPointer->nextTask;
|
||||||
|
}
|
||||||
|
TaskPointer->nextTask = newtask;
|
||||||
|
newtask ->nextTask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void newTask (void)
|
||||||
|
{
|
||||||
|
task_ptr new = malloc(sizeof(task_1));
|
||||||
|
if (new == NULL){
|
||||||
|
printf("Die Liste ist leer?!\n");
|
||||||
|
}
|
||||||
|
printf(" Neues Fach eigeben: ");
|
||||||
|
if(scanf("%d", &newTask)!=1)
|
||||||
|
{
|
||||||
|
dump_buffer(stdin);
|
||||||
|
printf("Fehlerhafte eingabe\n");
|
||||||
|
free(new);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dump_buffer (stdin);
|
||||||
|
insertTask(new);
|
||||||
|
}
|
||||||
|
|
||||||
|
void inserttime(time_ptr newtime)
|
||||||
|
{
|
||||||
|
time_ptr TimePointer;
|
||||||
|
if (firsttime == NULL){
|
||||||
|
firsttime = newtime;
|
||||||
|
newtime->nextTime =NULL;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
TimePointer = firsttime;
|
||||||
|
while(TimePointer->nextTime!=NULL)
|
||||||
|
{
|
||||||
|
TimePointer = TimePointer->nextTime;
|
||||||
|
}
|
||||||
|
TimePointer->nextTime = newtime;
|
||||||
|
newtime ->nextTime = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void newTime(void)
|
||||||
|
{
|
||||||
|
time_ptr newtime = malloc(sizeof(task_1));
|
||||||
|
if (newtime == NULL){
|
||||||
|
printf("Die Liste ist leer?!\n");
|
||||||
|
}
|
||||||
|
printf(" Neue Zeit eingeben: ");
|
||||||
|
if(scanf("%d",&newTime)!=1)
|
||||||
|
{
|
||||||
|
dump_buffer(stdin);
|
||||||
|
printf("Fehlerhafte eingabe\n");
|
||||||
|
free(newtime);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dump_buffer (stdin);
|
||||||
|
inserttime(newtime);
|
||||||
|
}
|
||||||
|
|
||||||
|
void tasklisting(void){
|
||||||
|
task_ptr TaskPointer = firsttask;
|
||||||
|
printf("Erfasste Fächer:\n");
|
||||||
|
while(TaskPointer!=NULL)
|
||||||
|
printf("\t->%d\n", TaskPointer->name);
|
||||||
|
TaskPointer = TaskPointer->nextTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
void getlink (void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
int choice = 0, i = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
printf(" -1- Neues Fach eingeben\n");
|
||||||
|
printf(" -2- Verfuegbare Zeit eingeben\n");
|
||||||
|
printf(" -3- Alle vorhandenen Faecher aufliesten\n");
|
||||||
|
printf(" -4- Kalenderlink ausgeben\n");
|
||||||
|
printf(" -5- Planer beenden\n");
|
||||||
|
if( scanf("%d", &choice) != 1){
|
||||||
|
printf("Falsche Eingabe\n");};
|
||||||
|
choice = 0;
|
||||||
|
dump_buffer(stdin);
|
||||||
|
|
||||||
|
switch (choice)
|
||||||
|
{
|
||||||
|
case 1: newTask();break;
|
||||||
|
case 2: newTime();break;
|
||||||
|
case 3: if( firsttask == NULL){
|
||||||
|
printf("Die Liste ist leer");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
tasklisting();
|
||||||
|
}break;
|
||||||
|
case 4: iCAl();break;
|
||||||
|
}
|
||||||
|
}while (choice !=5);
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,124 +0,0 @@
|
|||||||
#include "llist.h"
|
|
||||||
#include "planner.h"
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
char *name;
|
|
||||||
char *helpStr;
|
|
||||||
void (*handler)(int argc, char **argv, void *ret);
|
|
||||||
} Command;
|
|
||||||
|
|
||||||
void addTask(int argc, char **argv, void *ret);
|
|
||||||
void getTasks(int argc, char **argv, void *ret);
|
|
||||||
void createPlan(int argc, char **argv, void *ret);
|
|
||||||
void help_handler(int argc, char **argv, void *ret);
|
|
||||||
void quit_handler(int argc, char **argv, void *ret);
|
|
||||||
// Define a list of commands
|
|
||||||
Command commands[] = {
|
|
||||||
{"add",
|
|
||||||
"add task with: add <taskName> <deadline(days from today> <priority>",
|
|
||||||
addTask},
|
|
||||||
{"getTasks", "TO BE IMPLEMENTED", getTasks},
|
|
||||||
{"gen", "Generate timetable with: gen <available time in h>", createPlan},
|
|
||||||
{"help", "Display Help", help_handler},
|
|
||||||
{"quit", "Quit program", quit_handler},
|
|
||||||
};
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
printf("Time Management optimizer!\n");
|
|
||||||
llist *taskL = llistNew(NULL, cmpTaskN);
|
|
||||||
assert(taskL != NULL);
|
|
||||||
|
|
||||||
while (1) {
|
|
||||||
// Read user input
|
|
||||||
char *input = NULL;
|
|
||||||
size_t inputLen;
|
|
||||||
printf("> ");
|
|
||||||
getline(&input, &inputLen, stdin);
|
|
||||||
assert(input != NULL);
|
|
||||||
|
|
||||||
// Parse input into individual commands and arguments
|
|
||||||
char *token = strtok(input, " \n");
|
|
||||||
int argc = 0;
|
|
||||||
char **argv = NULL;
|
|
||||||
while (token) {
|
|
||||||
argv = realloc(argv, (argc + 1) * sizeof(char *));
|
|
||||||
argv[argc++] = token;
|
|
||||||
token = strtok(NULL, " ");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find matchin command handler
|
|
||||||
for (int i = 0; i < sizeof(commands) / sizeof(commands[0]); i++) {
|
|
||||||
if (strcmp(commands[i].name, argv[0]) == 0) {
|
|
||||||
commands[i].handler(argc, argv, taskL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(input);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* to add task write <add> name deadline(days from now) priority
|
|
||||||
*/
|
|
||||||
void addTask(int argc, char **argv, void *ret) {
|
|
||||||
if (argc != 4) { // invalig input
|
|
||||||
help_handler(1, &argv[0], NULL);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
llist *tasksLL = ret;
|
|
||||||
int days, prio;
|
|
||||||
char *name = strdup(argv[1]);
|
|
||||||
// parse task
|
|
||||||
if (sscanf(argv[2], "%d", &days) < 0 || sscanf(argv[3], "%d", &prio) < 0) {
|
|
||||||
printf("addTasksscanferr\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
time_t now = time(NULL);
|
|
||||||
struct tm *lc = localtime(&now);
|
|
||||||
lc->tm_mon += days;
|
|
||||||
time_t deadline = mktime(lc);
|
|
||||||
|
|
||||||
Task *r = newTask(name, now, deadline, prio, 0);
|
|
||||||
llistAppend(tasksLL, r);
|
|
||||||
printf("added task:\n");
|
|
||||||
printTask(r);
|
|
||||||
printf("currentTaskList:\n");
|
|
||||||
llistPrintT(tasksLL->next);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* generate plan, store to ical and store updated tasks to db
|
|
||||||
*/
|
|
||||||
void createPlan(int argc, char **argv, void *ret) {
|
|
||||||
printf("creating plan\n");
|
|
||||||
llist *taskLL = ret;
|
|
||||||
taskLL = taskLL->next;
|
|
||||||
llistPrintT(taskLL);
|
|
||||||
time_t now = time(NULL);
|
|
||||||
struct tm *lc = localtime(&now);
|
|
||||||
lc->tm_hour += atoi(argv[1]);
|
|
||||||
genPlan(taskLL, mktime(lc));
|
|
||||||
}
|
|
||||||
void help_handler(int argc, char **argv, void *ret) {
|
|
||||||
printf("available Commands:\n");
|
|
||||||
for (int i = 0; i < sizeof(commands) / sizeof(commands[0]); i++) {
|
|
||||||
printf("%s:%s\n", commands[i].name, commands[i].helpStr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void getTasks(int argc, char **argv, void *ret) {
|
|
||||||
// TODO get form db
|
|
||||||
}
|
|
||||||
|
|
||||||
void quit_handler(int argc, char **argv, void *ret) {
|
|
||||||
printf("Goodbye!\n");
|
|
||||||
llistFreeT((llist *)ret);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user