modified: Makefile
modified: README.md new file: src/StudyPlanner.h modified: src/db.h modified: src/ui.c bugfixes. added release target to Makefile to use in other tools.
This commit is contained in:
		
							parent
							
								
									0922b8d6b8
								
							
						
					
					
						commit
						c616b98589
					
				
							
								
								
									
										10
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								Makefile
									
									
									
									
									
								
							@ -12,11 +12,17 @@ CALF=src/iCal.c src/iCal.h
 | 
				
			|||||||
LLST=src/llist.c src/llist.h
 | 
					LLST=src/llist.c src/llist.h
 | 
				
			||||||
CONFIG=src/config.h #config file
 | 
					CONFIG=src/config.h #config file
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ALLF=$(UIF) $(PLF) $(DBF) $(LLST)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#targets
 | 
					#targets
 | 
				
			||||||
debug: test ui planner db iCal llist
 | 
					debug: test ui planner db iCal llist
 | 
				
			||||||
	gcc test.o ui.o planner.o db.o iCal.o llist.o -o debugOut 
 | 
						gcc test.o ui.o planner.o db.o iCal.o llist.o -o debugOut 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					release: $(ALLF)
 | 
				
			||||||
 | 
						gcc -DRELEASE -fPIC -shared -o StudyPlanner.so $(ALLF)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# config: $(CONFIG)
 | 
					# config: $(CONFIG)
 | 
				
			||||||
llist: $(LLST)
 | 
					llist: $(LLST)
 | 
				
			||||||
	gcc -c $(CFLAGS) $(LLST)
 | 
						gcc -c $(CFLAGS) $(LLST)
 | 
				
			||||||
@ -25,7 +31,7 @@ test: src/test.c
 | 
				
			|||||||
iCal: $(CALF)
 | 
					iCal: $(CALF)
 | 
				
			||||||
	gcc -c $(CFLAGS) $(CALF)
 | 
						gcc -c $(CFLAGS) $(CALF)
 | 
				
			||||||
ui: $(UIF) 
 | 
					ui: $(UIF) 
 | 
				
			||||||
	gcc -c $(CFLAGS) $(UIF)
 | 
						gcc -DDEBUG -c $(CFLAGS) $(UIF)
 | 
				
			||||||
planner: $(PLF)
 | 
					planner: $(PLF)
 | 
				
			||||||
	gcc -c $(CFLAGS) $(PLF)
 | 
						gcc -c $(CFLAGS) $(PLF)
 | 
				
			||||||
db: $(DBF)
 | 
					db: $(DBF)
 | 
				
			||||||
@ -36,7 +42,7 @@ edit:
 | 
				
			|||||||
	nvim $(PLF) Makefile $(LLST) src/test.c
 | 
						nvim $(PLF) Makefile $(LLST) src/test.c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
clean: 
 | 
					clean: 
 | 
				
			||||||
	rm -rf *.o debugOut src/*.gch  *.csv *.ics
 | 
						rm -rf *.o debugOut src/*.gch  *.csv *.ics *.so
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										10
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								README.md
									
									
									
									
									
								
							@ -13,6 +13,16 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Time management optimisation tool.
 | 
					Time management optimisation tool.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# How to use
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - to use program directly compile with
 | 
				
			||||||
 | 
					          make debug
 | 
				
			||||||
 | 
					      . this creates executable binary.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - to integrate in other software use:
 | 
				
			||||||
 | 
					          make release
 | 
				
			||||||
 | 
					      . This creates shared library. use StudyPlanner.h (untested)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Procedure
 | 
					# Procedure
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## User input
 | 
					## User input
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										6
									
								
								src/StudyPlanner.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								src/StudyPlanner.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					#ifndef PLANNER
 | 
				
			||||||
 | 
					#define PLANNER
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int StudyPlanner();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif // StudyPlanner
 | 
				
			||||||
							
								
								
									
										3
									
								
								src/db.h
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								src/db.h
									
									
									
									
									
								
							@ -3,7 +3,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "planner.h"
 | 
					#include "planner.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void write_linkedlist_to_csv(llist *head, const char *filename);
 | 
					void write_linkedlist_to_csv(llist *head, const char *filename);
 | 
				
			||||||
llist *write_csv_to_llist(const char *filename);
 | 
					llist *write_csv_to_llist(const char *filename);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										309
									
								
								src/ui.c
									
									
									
									
									
								
							
							
						
						
									
										309
									
								
								src/ui.c
									
									
									
									
									
								
							@ -23,103 +23,165 @@
 | 
				
			|||||||
#define hours(n) (60 * minutes(n))
 | 
					#define hours(n) (60 * minutes(n))
 | 
				
			||||||
#define days(n) (24 * hours(n))
 | 
					#define days(n) (24 * hours(n))
 | 
				
			||||||
const char *dbName = "db.csv";
 | 
					const char *dbName = "db.csv";
 | 
				
			||||||
 | 
					// #define DEBUG
 | 
				
			||||||
 | 
					#ifdef DEBUG
 | 
				
			||||||
int main(void) {
 | 
					int main(void) {
 | 
				
			||||||
  int taskcreation_date = 0;
 | 
					#endif
 | 
				
			||||||
  int taskdeadline_date = 0;
 | 
					#ifdef RELEASE
 | 
				
			||||||
  int taskpriority = 0;
 | 
					  int StudyPlanner() {
 | 
				
			||||||
  int taskspare = 0;
 | 
					#endif
 | 
				
			||||||
  char *taskname = NULL; // taskName Buffer
 | 
					    int taskcreation_date = 0;
 | 
				
			||||||
 | 
					    int taskdeadline_date = 0;
 | 
				
			||||||
 | 
					    int taskpriority = 0;
 | 
				
			||||||
 | 
					    int taskspare = 0;
 | 
				
			||||||
 | 
					    char *taskname = NULL; // taskName Buffer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  llist *listT = NULL;
 | 
					    llist *listT = NULL;
 | 
				
			||||||
  llist *listE = NULL;
 | 
					    llist *listE = NULL;
 | 
				
			||||||
  int choice = 0, i = 0;
 | 
					    int choice = 0, i = 0;
 | 
				
			||||||
  do {
 | 
					    do {
 | 
				
			||||||
    printf(" -1- Neues Fach eingeben\n");
 | 
					      printf(" -1- Neues Fach eingeben\n");
 | 
				
			||||||
    printf(" -2- Verfuegbare Zeit eingeben\n");
 | 
					      printf(" -2- Verfuegbare Zeit eingeben\n");
 | 
				
			||||||
    printf(" -3- Alle vorhandenen Faecher aufliesten\n");
 | 
					      printf(" -3- Alle vorhandenen Faecher aufliesten\n");
 | 
				
			||||||
    printf(" -4- Kalenderlink ausgeben\n");
 | 
					      printf(" -4- Kalenderlink ausgeben\n");
 | 
				
			||||||
    printf(" -5- Faecher Importieren\n");
 | 
					      printf(" -5- Faecher Importieren\n");
 | 
				
			||||||
    printf(" -6- Planer beenden\n");
 | 
					      printf(" -6- Planer beenden\n");
 | 
				
			||||||
    printf(" Waehle die gewuenschte Option aus\n");
 | 
					      printf(" Waehle die gewuenschte Option aus\n");
 | 
				
			||||||
    volatile int r = scanf("%d", &choice);
 | 
					      volatile int r = scanf("%d", &choice);
 | 
				
			||||||
    if (r != 1) {
 | 
					      if (r != 1) {
 | 
				
			||||||
      printf("Falsche Eingabe\n");
 | 
					        printf("Falsche Eingabe\n");
 | 
				
			||||||
      fgetc(stdin);
 | 
					        fgetc(stdin);
 | 
				
			||||||
      choice = 0;
 | 
					        choice = 0;
 | 
				
			||||||
      continue;
 | 
					        continue;
 | 
				
			||||||
    };
 | 
					      };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    taskname = NULL;
 | 
					      taskname = NULL;
 | 
				
			||||||
    size_t nameLen;
 | 
					      size_t nameLen;
 | 
				
			||||||
    ssize_t nnread;
 | 
					      ssize_t nnread;
 | 
				
			||||||
    switch (choice) {
 | 
					      switch (choice) {
 | 
				
			||||||
    case 1:
 | 
					      case 1:
 | 
				
			||||||
      printf(" Geben sie das gewünschte Fach ein (Name): \n");
 | 
					        printf(" Geben sie das gewünschte Fach ein (Name): \n");
 | 
				
			||||||
      time_t now = time(NULL);
 | 
					        time_t now = time(NULL);
 | 
				
			||||||
      struct tm lc;
 | 
					 | 
				
			||||||
      localtime_r(&now, &lc);
 | 
					 | 
				
			||||||
      fgetc(stdin);
 | 
					 | 
				
			||||||
      nnread = getline(&taskname, &nameLen, stdin);
 | 
					 | 
				
			||||||
      taskname[nnread - 1] = '\0';
 | 
					 | 
				
			||||||
      if (nnread < 0) {
 | 
					 | 
				
			||||||
        printf("Ungültige Eingabe für den Namen.\n");
 | 
					 | 
				
			||||||
        return -1;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      printf(" Wie viel Zeit bleibt ihnen (tage bis deadline):\n");
 | 
					 | 
				
			||||||
      if (scanf("%d", &taskdeadline_date) != 1) {
 | 
					 | 
				
			||||||
        printf("Ungueltige Eingabe.\n");
 | 
					 | 
				
			||||||
        return -1;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      printf(" Gib die Prioritaet des Faches an(1-10): \n");
 | 
					 | 
				
			||||||
      if (scanf("%d", &taskpriority) != 1) {
 | 
					 | 
				
			||||||
        printf("Ungueltige Eingabe.\n");
 | 
					 | 
				
			||||||
        return -1;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      // printf(" Wie viel Zeit habe Sie für dieses Fach: \n");
 | 
					 | 
				
			||||||
      // if (scanf("%d", &taskspare) != 1) {
 | 
					 | 
				
			||||||
      //   printf("Ungültige Eingabe.\n");
 | 
					 | 
				
			||||||
      //   return -1;
 | 
					 | 
				
			||||||
      // }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      // create deadline timestamp
 | 
					 | 
				
			||||||
      time_t deadline = now + days(taskdeadline_date);
 | 
					 | 
				
			||||||
      Task *newT = newTask(taskname, now, deadline, taskpriority, 0);
 | 
					 | 
				
			||||||
      if (listT == NULL) {
 | 
					 | 
				
			||||||
        listT = llistNew(newT, cmpTaskN);
 | 
					 | 
				
			||||||
      } else {
 | 
					 | 
				
			||||||
        llistAppend(listT, newT);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      break;
 | 
					 | 
				
			||||||
    case 2:
 | 
					 | 
				
			||||||
      printf("Geben Sie die zur verfuegung stehende Zeit für die Faecher an "
 | 
					 | 
				
			||||||
             "(geplante arbeitsstunden huete): \n");
 | 
					 | 
				
			||||||
      scanf("%d", &taskspare);
 | 
					 | 
				
			||||||
      // if list exists use it to generate plan
 | 
					 | 
				
			||||||
      if (listT != NULL) {
 | 
					 | 
				
			||||||
        struct tm lc;
 | 
					        struct tm lc;
 | 
				
			||||||
        now = time(NULL);
 | 
					 | 
				
			||||||
        localtime_r(&now, &lc);
 | 
					        localtime_r(&now, &lc);
 | 
				
			||||||
        lc.tm_hour += taskspare;
 | 
					        fgetc(stdin);
 | 
				
			||||||
        time_t avail = mktime(&lc);
 | 
					        nnread = getline(&taskname, &nameLen, stdin);
 | 
				
			||||||
        listE = genPlan(listT, avail);
 | 
					        taskname[nnread - 1] = '\0';
 | 
				
			||||||
        write_linkedlist_to_csv(listT, dbName);
 | 
					        if (nnread < 0) {
 | 
				
			||||||
      } else {
 | 
					          printf("Ungültige Eingabe für den Namen.\n");
 | 
				
			||||||
        printf("list is empty!");
 | 
					          return -1;
 | 
				
			||||||
        return -1;
 | 
					        }
 | 
				
			||||||
      }
 | 
					
 | 
				
			||||||
      break;
 | 
					        printf(" Wie viel Zeit bleibt ihnen (tage bis deadline):\n");
 | 
				
			||||||
 | 
					        if (scanf("%d", &taskdeadline_date) != 1) {
 | 
				
			||||||
 | 
					          printf("Ungueltige Eingabe.\n");
 | 
				
			||||||
 | 
					          return -1;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        printf(" Gib die Prioritaet des Faches an(1-10): \n");
 | 
				
			||||||
 | 
					        if (scanf("%d", &taskpriority) != 1) {
 | 
				
			||||||
 | 
					          printf("Ungueltige Eingabe.\n");
 | 
				
			||||||
 | 
					          return -1;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // printf(" Wie viel Zeit habe Sie für dieses Fach: \n");
 | 
				
			||||||
 | 
					        // if (scanf("%d", &taskspare) != 1) {
 | 
				
			||||||
 | 
					        //   printf("Ungültige Eingabe.\n");
 | 
				
			||||||
 | 
					        //   return -1;
 | 
				
			||||||
 | 
					        // }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // create deadline timestamp
 | 
				
			||||||
 | 
					        time_t deadline = now + days(taskdeadline_date);
 | 
				
			||||||
 | 
					        Task *newT = newTask(taskname, now, deadline, taskpriority, 0);
 | 
				
			||||||
 | 
					        if (listT == NULL) {
 | 
				
			||||||
 | 
					          listT = llistNew(newT, cmpTaskN);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					          llistAppend(listT, newT);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    case 3:
 | 
					 | 
				
			||||||
      if (listT == NULL) {
 | 
					 | 
				
			||||||
        printf("Die Liste ist leer");
 | 
					 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
      } else {
 | 
					      case 2:
 | 
				
			||||||
        llistPrintT(listT);
 | 
					        printf("Geben Sie die zur verfuegung stehende Zeit für die Faecher an "
 | 
				
			||||||
 | 
					               "(geplante arbeitsstunden huete): \n");
 | 
				
			||||||
 | 
					        scanf("%d", &taskspare);
 | 
				
			||||||
 | 
					        // if list exists use it to generate plan
 | 
				
			||||||
 | 
					        if (listT != NULL) {
 | 
				
			||||||
 | 
					          struct tm lc;
 | 
				
			||||||
 | 
					          now = time(NULL);
 | 
				
			||||||
 | 
					          localtime_r(&now, &lc);
 | 
				
			||||||
 | 
					          lc.tm_hour += taskspare;
 | 
				
			||||||
 | 
					          time_t avail = mktime(&lc);
 | 
				
			||||||
 | 
					          listE = genPlan(listT, avail);
 | 
				
			||||||
 | 
					          write_linkedlist_to_csv(listT, dbName);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					          printf("list is empty!");
 | 
				
			||||||
 | 
					          return -1;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      case 3:
 | 
				
			||||||
 | 
					        if (listT == NULL) {
 | 
				
			||||||
 | 
					          printf("Die Liste ist leer");
 | 
				
			||||||
 | 
					          break;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					          llistPrintT(listT);
 | 
				
			||||||
 | 
					          //   llist *iterator = list;
 | 
				
			||||||
 | 
					          //   while (iterator != NULL) {
 | 
				
			||||||
 | 
					          //     Task *currentTask = (Task *)(iterator->data); // Cast zu Task
 | 
				
			||||||
 | 
					          //     printf("Fach: %s, Deadline: %ld, Priorität: %d\n",
 | 
				
			||||||
 | 
					          //            currentTask->name, currentTask->deadline,
 | 
				
			||||||
 | 
					          //            currentTask->priority);
 | 
				
			||||||
 | 
					          //     iterator = iterator->next; // Gehe zum nächsten Listenelement
 | 
				
			||||||
 | 
					          //   }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					        // // case 4: iCAl();break;
 | 
				
			||||||
 | 
					        //
 | 
				
			||||||
 | 
					        // printf(" Wie viel Zeit bleibt ihnen:\n");
 | 
				
			||||||
 | 
					        // if (scanf("%d", &taskdeadline_date) != 1) {
 | 
				
			||||||
 | 
					        //   printf("Ungültige Eingabe.\n");
 | 
				
			||||||
 | 
					        //   return -1;
 | 
				
			||||||
 | 
					        // }
 | 
				
			||||||
 | 
					        //
 | 
				
			||||||
 | 
					        // printf(" Gib die Priorität des Faches an: \n");
 | 
				
			||||||
 | 
					        // if (scanf("%d", &taskpriority) != 1) {
 | 
				
			||||||
 | 
					        //   printf("Ungültige Eingabe.\n");
 | 
				
			||||||
 | 
					        //   return -1;
 | 
				
			||||||
 | 
					        // }
 | 
				
			||||||
 | 
					        //
 | 
				
			||||||
 | 
					        // printf(" Wie viel Zeit habe Sie für dieses Fach: \n");
 | 
				
			||||||
 | 
					        // if (scanf("%d", &taskspare) != 1) {
 | 
				
			||||||
 | 
					        //   printf("Ungültige Eingabe.\n");
 | 
				
			||||||
 | 
					        //   return -1;
 | 
				
			||||||
 | 
					        // }
 | 
				
			||||||
 | 
					        // break;
 | 
				
			||||||
 | 
					      case 4:
 | 
				
			||||||
 | 
					        if (listE == NULL || taskspare <= 0) {
 | 
				
			||||||
 | 
					          printf("vor Export erst task list erstellen, dann verfuegbare zeit "
 | 
				
			||||||
 | 
					                 "eingeben!\n");
 | 
				
			||||||
 | 
					          break;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        llistPrintE(listE);
 | 
				
			||||||
 | 
					        exportiCal(listE);
 | 
				
			||||||
 | 
					        // printf(
 | 
				
			||||||
 | 
					        //     "Geben Sie die zur verfuegung stehende Zeit für die Fächer an:
 | 
				
			||||||
 | 
					        //     \n");
 | 
				
			||||||
 | 
					        // scanf("%d", &taskspare);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					      case 5:
 | 
				
			||||||
 | 
					        listT = write_csv_to_llist(dbName);
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      case 6:
 | 
				
			||||||
 | 
					        printf("Goodbye!\n");
 | 
				
			||||||
 | 
					        if (listE != NULL)
 | 
				
			||||||
 | 
					          llistFreeE(listE);
 | 
				
			||||||
 | 
					        if (listT != NULL)
 | 
				
			||||||
 | 
					          llistPrintT(listT);
 | 
				
			||||||
 | 
					        // if (task == NULL) {//task?
 | 
				
			||||||
 | 
					        //   printf("Die Liste ist leer");
 | 
				
			||||||
 | 
					        // } else {
 | 
				
			||||||
        //   llist *iterator = list;
 | 
					        //   llist *iterator = list;
 | 
				
			||||||
        //   while (iterator != NULL) {
 | 
					        //   while (iterator != NULL) {
 | 
				
			||||||
        //     Task *currentTask = (Task *)(iterator->data); // Cast zu Task
 | 
					        //     Task *currentTask = (Task *)(iterator->data); // Cast zu Task
 | 
				
			||||||
@ -128,66 +190,9 @@ int main(void) {
 | 
				
			|||||||
        //            currentTask->priority);
 | 
					        //            currentTask->priority);
 | 
				
			||||||
        //     iterator = iterator->next; // Gehe zum nächsten Listenelement
 | 
					        //     iterator = iterator->next; // Gehe zum nächsten Listenelement
 | 
				
			||||||
        //   }
 | 
					        //   }
 | 
				
			||||||
 | 
					        // }
 | 
				
			||||||
 | 
					        return EXIT_SUCCESS;
 | 
				
			||||||
 | 
					        // case 4: iCAl();break;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      break;
 | 
					    } while (choice < 6);
 | 
				
			||||||
      // // case 4: iCAl();break;
 | 
					  }
 | 
				
			||||||
      //
 | 
					 | 
				
			||||||
      // printf(" Wie viel Zeit bleibt ihnen:\n");
 | 
					 | 
				
			||||||
      // if (scanf("%d", &taskdeadline_date) != 1) {
 | 
					 | 
				
			||||||
      //   printf("Ungültige Eingabe.\n");
 | 
					 | 
				
			||||||
      //   return -1;
 | 
					 | 
				
			||||||
      // }
 | 
					 | 
				
			||||||
      //
 | 
					 | 
				
			||||||
      // printf(" Gib die Priorität des Faches an: \n");
 | 
					 | 
				
			||||||
      // if (scanf("%d", &taskpriority) != 1) {
 | 
					 | 
				
			||||||
      //   printf("Ungültige Eingabe.\n");
 | 
					 | 
				
			||||||
      //   return -1;
 | 
					 | 
				
			||||||
      // }
 | 
					 | 
				
			||||||
      //
 | 
					 | 
				
			||||||
      // printf(" Wie viel Zeit habe Sie für dieses Fach: \n");
 | 
					 | 
				
			||||||
      // if (scanf("%d", &taskspare) != 1) {
 | 
					 | 
				
			||||||
      //   printf("Ungültige Eingabe.\n");
 | 
					 | 
				
			||||||
      //   return -1;
 | 
					 | 
				
			||||||
      // }
 | 
					 | 
				
			||||||
      // break;
 | 
					 | 
				
			||||||
    case 4:
 | 
					 | 
				
			||||||
      if (listE == NULL || taskspare <= 0) {
 | 
					 | 
				
			||||||
        printf("vor Export erst task list erstellen, dann verfuegbare zeit "
 | 
					 | 
				
			||||||
               "eingeben!\n");
 | 
					 | 
				
			||||||
        break;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      llistPrintE(listE);
 | 
					 | 
				
			||||||
      exportiCal(listE);
 | 
					 | 
				
			||||||
      // printf(
 | 
					 | 
				
			||||||
      //     "Geben Sie die zur verfuegung stehende Zeit für die Fächer an:
 | 
					 | 
				
			||||||
      //     \n");
 | 
					 | 
				
			||||||
      // scanf("%d", &taskspare);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      break;
 | 
					 | 
				
			||||||
    case 5:
 | 
					 | 
				
			||||||
      listT = write_csv_to_llist(dbName);
 | 
					 | 
				
			||||||
      break;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    case 6:
 | 
					 | 
				
			||||||
      printf("Goodbye!\n");
 | 
					 | 
				
			||||||
      if (listE != NULL)
 | 
					 | 
				
			||||||
        llistFreeE(listE);
 | 
					 | 
				
			||||||
      if (listT != NULL)
 | 
					 | 
				
			||||||
        llistPrintT(listT);
 | 
					 | 
				
			||||||
      // if (task == NULL) {//task?
 | 
					 | 
				
			||||||
      //   printf("Die Liste ist leer");
 | 
					 | 
				
			||||||
      // } else {
 | 
					 | 
				
			||||||
      //   llist *iterator = list;
 | 
					 | 
				
			||||||
      //   while (iterator != NULL) {
 | 
					 | 
				
			||||||
      //     Task *currentTask = (Task *)(iterator->data); // Cast zu Task
 | 
					 | 
				
			||||||
      //     printf("Fach: %s, Deadline: %ld, Priorität: %d\n",
 | 
					 | 
				
			||||||
      //            currentTask->name, currentTask->deadline,
 | 
					 | 
				
			||||||
      //            currentTask->priority);
 | 
					 | 
				
			||||||
      //     iterator = iterator->next; // Gehe zum nächsten Listenelement
 | 
					 | 
				
			||||||
      //   }
 | 
					 | 
				
			||||||
      // }
 | 
					 | 
				
			||||||
      return EXIT_SUCCESS;
 | 
					 | 
				
			||||||
      // case 4: iCAl();break;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  } while (choice < 6);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user