From b9f80a2b37edf9682f189b406542b3f7a93b24a3 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Wed, 2 Apr 2025 20:54:37 +0300 Subject: Moved directory and some experimental changes --- c_implementation/src/aklogcatter.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 c_implementation/src/aklogcatter.c (limited to 'c_implementation/src/aklogcatter.c') diff --git a/c_implementation/src/aklogcatter.c b/c_implementation/src/aklogcatter.c new file mode 100644 index 0000000..016c6d3 --- /dev/null +++ b/c_implementation/src/aklogcatter.c @@ -0,0 +1,35 @@ +#include +#include +#include +#include + +int ak_logcatter() +{ + printf("Testing: %s\n", __func__); + FILE *fp; + fp = fopen("/home/kaotisk/.arching-kaos/logs", "r"); + if (!fp) + { + perror("fopen"); + return EXIT_FAILURE; + } + char buffer[1] = {0}; + char line[1024] = {0}; + unsigned int i = 0; + while ( fread(buffer, sizeof(char), sizeof(char), fp) ) + { + if ( buffer[0] == '\n' ) + { + line[i] = '\0'; + ak_log_print_log_line(line); + i = 0; + } + else + { + line[i] = buffer[0]; + i++; + } + } + fclose(fp); + return 0; +} -- cgit v1.2.3