From 67a5765ba5ad7edfd92989e1843934006c866922 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Tue, 10 Dec 2024 19:00:32 +0100 Subject: [PATCH] change read from stdin --- src/xml.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/xml.c b/src/xml.c index 8896fe7..de0e524 100644 --- a/src/xml.c +++ b/src/xml.c @@ -51,11 +51,11 @@ void free_feierabend(feierabend* fabend) fabend->timestr = NULL; } -void readFileIntoMemory(const char* file_path, memFile* mem) +void readStdInIntoMemory(memFile* mem) { char* buf = malloc(sizeof(char)); FILE* memstream = open_memstream(mem->data, mem->size); - FILE* file = fopen(file_path, "r"); + FILE* file = fdopen(0, "r"); while(fread(buf, sizeof(char), 1, file) != 0) { fwrite(buf, sizeof(char), 1, memstream); @@ -399,7 +399,7 @@ void addEntry(const char* date, { memFile* fileContent = malloc(sizeof(memFile)); init_memFile(fileContent); - readFileIntoMemory("/dev/stdin", fileContent); + readStdInIntoMemory(fileContent); char* saldostr = malloc(sizeof(char) * MAX_STRING_LENGTH); memset(saldostr, 0, MAX_STRING_LENGTH); -- 2.39.5