Compare commits

..

No commits in common. "3b8bd5dc40d19edadd6d6e54813cb37d8f035022" and "2b162f532ffa61e9990bd24eb69de9a4a0936b3e" have entirely different histories.

4 changed files with 10 additions and 17 deletions

View File

@ -1,4 +1,5 @@
#include "llist.h" #include "llist.h"
#include <asm-generic/errno.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@ -226,7 +226,7 @@ llist *genPlan(llist *head, time_t timeAvail) {
0); // use elem with wighest priority 0); // use elem with wighest priority
} }
llistAppend(events_ll, c); llistAppend(events_ll, c);
printEvent(c); // printEvent(c);
// printEvent((Event *)((events_ll)->next)->data); // printEvent((Event *)((events_ll)->next)->data);
// decrement priority of first elem and resort list // decrement priority of first elem and resort list
@ -257,9 +257,8 @@ 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);
printf("====EVENTSLL:\n");
llistPrintE(events_ll); llistPrintE(events_ll);
printf("====EVENTSLL:\n");
// update prioriteis in original llist // update prioriteis in original llist
for (int i = 0; i < lLen; i++) { for (int i = 0; i < lLen; i++) {
llist *tmp = llistGet(head, sortedPrio + i); llist *tmp = llistGet(head, sortedPrio + i);

View File

@ -77,7 +77,6 @@ Event *newEvent(Task *t, time_t s, time_t e, uint64_t sp);
*/ */
void freeEvent(Event *e); void freeEvent(Event *e);
void llistFreeE(llist *head); void llistFreeE(llist *head);
void llistPrintE(llist *head);
int cmpEvent(const void *a, const void *b); int cmpEvent(const void *a, const void *b);
/* /*
* takes llist of tasks and returns llist of events * takes llist of tasks and returns llist of events

View File

@ -20,6 +20,7 @@
const char *dbName = "db.csv"; const char *dbName = "db.csv";
int main(void) { int main(void) {
char taskname[256]; // taskName Buffer
int taskcreation_date = 0; int taskcreation_date = 0;
int taskdeadline_date = 0; int taskdeadline_date = 0;
int taskpriority = 0; int taskpriority = 0;
@ -35,7 +36,7 @@ int main(void) {
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(" Wähle die gewünschte 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");
@ -44,32 +45,26 @@ int main(void) {
continue; continue;
}; };
char *taskname = NULL; // taskName Buffer
size_t nameLen;
size_t nnread;
switch (choice) { switch (choice) {
case 1: case 1:
printf(" Geben sie das gewünschte Fach ein: \n"); printf(" Geben sie das gewünschte Fach ein: \n");
time_t now = time(NULL); time_t now = time(NULL);
struct tm lc; struct tm lc;
localtime_r(&now, &lc); localtime_r(&now, &lc);
fgetc(stdin); if (fscanf(stdin, "%s", taskname) <= 0) {
nnread = getline(&taskname, &nameLen, stdin);
taskname[nnread - 1] = '\0';
if (nnread < 0) {
printf("Ungültige Eingabe für den Namen.\n"); printf("Ungültige Eingabe für den Namen.\n");
return -1; return -1;
} }
printf(" Wie viel Zeit bleibt ihnen (tage bis deadline):\n"); printf(" Wie viel Zeit bleibt ihnen (tage bis deadline):\n");
if (scanf("%d", &taskdeadline_date) != 1) { if (scanf("%d", &taskdeadline_date) != 1) {
printf("Ungueltige Eingabe.\n"); printf("Ungültige Eingabe.\n");
return -1; return -1;
} }
printf(" Gib die Prioritaet des Faches an: \n"); printf(" Gib die Priorität des Faches an: \n");
if (scanf("%d", &taskpriority) != 1) { if (scanf("%d", &taskpriority) != 1) {
printf("Ungueltige Eingabe.\n"); printf("Ungültige Eingabe.\n");
return -1; return -1;
} }
@ -92,7 +87,7 @@ int main(void) {
break; break;
case 2: case 2:
printf( printf(
"Geben Sie die zur verfuegung stehende Zeit für die Faecher an: \n"); "Geben Sie die zur verfuegung stehende Zeit für die Fächer an: \n");
scanf("%d", &taskspare); scanf("%d", &taskspare);
// if list exists use it to generate plan // if list exists use it to generate plan
if (listT != NULL) { if (listT != NULL) {
@ -146,7 +141,6 @@ int main(void) {
"eingeben!\n"); "eingeben!\n");
break; break;
} }
llistPrintE(listE);
exportiCal(listE); exportiCal(listE);
// printf( // printf(
// "Geben Sie die zur verfuegung stehende Zeit für die Fächer an: // "Geben Sie die zur verfuegung stehende Zeit für die Fächer an: