Compare commits

...

10 Commits

Author SHA1 Message Date
ketrptr
3b8bd5dc40 Merge branch 'master' of https://gitea.fhgr.ch/schurtisimon/StudyPlanner
modified:   src/llist.c
	modified:   src/planner.c
	modified:   src/planner.h
	modified:   src/ui.c
2024-12-16 10:23:14 +01:00
ketrptr
d7cf85b44f modified: src/ui.c 2024-12-16 09:56:58 +01:00
ca261158c6 Merge remote-tracking branch 'origin/master' 2024-12-16 09:46:35 +01:00
52718c972e implemented: #define localtime_r(T,Tm) (localtime_s(Tm,T) ? NULL:Tm)
#define ctime_r(T,Tm) (localtime_s(Tm,T) ? NULL:Tm)
2024-12-16 09:46:22 +01:00
24150229d4 implemented: #define localtime_r(T,Tm) (localtime_s(Tm,T) ? NULL:Tm)
#define ctime_r(T,Tm) (localtime_s(Tm,T) ? NULL:Tm)
2024-12-16 09:46:16 +01:00
a925ca1678 implemented: #define localtime_r(T,Tm) (localtime_s(Tm,T) ? NULL:Tm)
#define ctime_r(T,Tm) (localtime_s(Tm,T) ? NULL:Tm)
2024-12-16 09:43:09 +01:00
053bf501b5 Merge branch 'master' of https://gitea.fhgr.ch/schurtisimon/StudyPlanner 2024-12-16 09:42:07 +01:00
503182c0ca Merge branch 'master' of https://gitea.fhgr.ch/schurtisimon/StudyPlanner 2024-12-16 09:41:52 +01:00
e27e6f0b28 Merge branch 'master' of https://gitea.fhgr.ch/schurtisimon/StudyPlanner
# Conflicts:
#	src/planner.c
2024-12-16 09:39:48 +01:00
33b0d3087b implemented: #define localtime_r(T,Tm) (localtime_s(Tm,T) ? NULL:Tm)
#define ctime_r(T,Tm) (localtime_s(Tm,T) ? NULL:Tm)
2024-12-16 09:39:30 +01:00
4 changed files with 17 additions and 10 deletions

View File

@ -1,5 +1,4 @@
#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,8 +257,9 @@ 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,6 +77,7 @@ 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,7 +20,6 @@
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;
@ -36,7 +35,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(" Wähle die gewünschte 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");
@ -45,26 +44,32 @@ 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);
if (fscanf(stdin, "%s", taskname) <= 0) { fgetc(stdin);
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("Ungültige Eingabe.\n"); printf("Ungueltige Eingabe.\n");
return -1; return -1;
} }
printf(" Gib die Priorität des Faches an: \n"); printf(" Gib die Prioritaet des Faches an: \n");
if (scanf("%d", &taskpriority) != 1) { if (scanf("%d", &taskpriority) != 1) {
printf("Ungültige Eingabe.\n"); printf("Ungueltige Eingabe.\n");
return -1; return -1;
} }
@ -87,7 +92,7 @@ int main(void) {
break; break;
case 2: case 2:
printf( printf(
"Geben Sie die zur verfuegung stehende Zeit für die Fächer an: \n"); "Geben Sie die zur verfuegung stehende Zeit für die Faecher 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) {
@ -141,6 +146,7 @@ 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: