Compare commits
No commits in common. "1f54110aa5c350b87a251347a9a3e446b3e13f74" and "ca261158c6f64f80565547cd4cc8a7794828f8c3" have entirely different histories.
1f54110aa5
...
ca261158c6
4
src/db.c
4
src/db.c
|
@ -63,7 +63,7 @@ llist *write_csv_to_llist(const char *filename) {
|
|||
int count = 0; // task counter
|
||||
fgets(line, sizeof(line), file); // read and ignore file head
|
||||
|
||||
while (fgets(line, sizeof(line), file)){
|
||||
while (fgets(line, sizeof(line), file)) {
|
||||
count++;
|
||||
// remove newline sign
|
||||
line[strcspn(line, "\n")] = '\0';
|
||||
|
@ -74,7 +74,6 @@ llist *write_csv_to_llist(const char *filename) {
|
|||
char *taskdeadline_dateSTR = strtok(NULL, ",");
|
||||
char *taskprioritySTR = strtok(NULL, ",");
|
||||
char *taskspareSTR = strtok(NULL, ",");
|
||||
printf(" Der Name des Task ist %s\n",taskname);
|
||||
|
||||
// convert char in integer and date
|
||||
unsigned long int taskcreation_date =
|
||||
|
@ -101,4 +100,3 @@ llist *write_csv_to_llist(const char *filename) {
|
|||
}
|
||||
return list; // null on error
|
||||
}
|
||||
|
||||
|
|
|
@ -226,7 +226,7 @@ llist *genPlan(llist *head, time_t timeAvail) {
|
|||
0); // use elem with wighest priority
|
||||
}
|
||||
llistAppend(events_ll, c);
|
||||
printEvent(c);
|
||||
// printEvent(c);
|
||||
// printEvent((Event *)((events_ll)->next)->data);
|
||||
|
||||
// decrement priority of first elem and resort list
|
||||
|
@ -257,9 +257,8 @@ llist *genPlan(llist *head, time_t timeAvail) {
|
|||
events_ll = events_ll->next;
|
||||
tmp->next = NULL;
|
||||
llistFreeE(tmp);
|
||||
printf("====EVENTSLL:\n");
|
||||
llistPrintE(events_ll);
|
||||
printf("====EVENTSLL:\n");
|
||||
|
||||
// update prioriteis in original llist
|
||||
for (int i = 0; i < lLen; i++) {
|
||||
llist *tmp = llistGet(head, sortedPrio + i);
|
||||
|
|
|
@ -77,7 +77,6 @@ Event *newEvent(Task *t, time_t s, time_t e, uint64_t sp);
|
|||
*/
|
||||
void freeEvent(Event *e);
|
||||
void llistFreeE(llist *head);
|
||||
void llistPrintE(llist *head);
|
||||
int cmpEvent(const void *a, const void *b);
|
||||
/*
|
||||
* takes llist of tasks and returns llist of events
|
||||
|
|
22
src/ui.c
22
src/ui.c
|
@ -11,7 +11,6 @@
|
|||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -21,11 +20,11 @@
|
|||
const char *dbName = "db.csv";
|
||||
|
||||
int main(void) {
|
||||
char taskname[256]; // 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 *listE = NULL;
|
||||
|
@ -46,20 +45,14 @@ int main(void) {
|
|||
continue;
|
||||
};
|
||||
|
||||
taskname = NULL;
|
||||
size_t nameLen;
|
||||
size_t nnread;
|
||||
switch (choice) {
|
||||
case 1:
|
||||
printf(" Geben sie das gewünschte Fach ein: \n");
|
||||
printf(" Geben sie das gewuenschte Fach ein: \n");
|
||||
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");
|
||||
if (fscanf(stdin, "%s", taskname) <= 0) {
|
||||
printf("Ungueltige Eingabe für den Namen.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -98,11 +91,7 @@ int main(void) {
|
|||
scanf("%d", &taskspare);
|
||||
// if list exists use it to generate plan
|
||||
if (listT != NULL) {
|
||||
struct tm lc;
|
||||
localtime_r(&now, &lc);
|
||||
lc.tm_hour += taskspare;
|
||||
time_t avail = mktime(&lc);
|
||||
listE = genPlan(listT, avail);
|
||||
listE = genPlan(listT, taskspare);
|
||||
write_linkedlist_to_csv(listT, dbName);
|
||||
} else {
|
||||
printf("list is empty!");
|
||||
|
@ -152,7 +141,6 @@ int main(void) {
|
|||
"eingeben!\n");
|
||||
break;
|
||||
}
|
||||
llistPrintE(listE);
|
||||
exportiCal(listE);
|
||||
// printf(
|
||||
// "Geben Sie die zur verfuegung stehende Zeit für die Fächer an:
|
||||
|
|
Loading…
Reference in New Issue