From ac6fbacce69ad8d53099f1e6ab922c2e4bd6f9cc Mon Sep 17 00:00:00 2001 From: kaotisk Date: Sun, 27 Apr 2025 06:57:51 +0300 Subject: Updates.. better file names --- c_implementation/src/ak_logcatter.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 c_implementation/src/ak_logcatter.c (limited to 'c_implementation/src/ak_logcatter.c') diff --git a/c_implementation/src/ak_logcatter.c b/c_implementation/src/ak_logcatter.c new file mode 100644 index 0000000..c002eda --- /dev/null +++ b/c_implementation/src/ak_logcatter.c @@ -0,0 +1,36 @@ +#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]; + line[i+1] = '\0'; + i++; + } + } + fclose(fp); + return 0; +} -- cgit v1.2.3