diff options
author | kaotisk <kaotisk@arching-kaos.org> | 2025-04-02 20:54:37 +0300 |
---|---|---|
committer | kaotisk <kaotisk@arching-kaos.org> | 2025-04-02 20:54:37 +0300 |
commit | b9f80a2b37edf9682f189b406542b3f7a93b24a3 (patch) | |
tree | 2c96484ccb77af8a59ed6fb7fe4632b5bafb9858 /c_implementation/src/aklogcatter.c | |
parent | 0ec3188626275fa2678882c9827ade8d045ffc7d (diff) | |
download | arching-kaos-tools-b9f80a2b37edf9682f189b406542b3f7a93b24a3.tar.gz arching-kaos-tools-b9f80a2b37edf9682f189b406542b3f7a93b24a3.tar.bz2 arching-kaos-tools-b9f80a2b37edf9682f189b406542b3f7a93b24a3.zip |
Moved directory and some experimental changes
Diffstat (limited to 'c_implementation/src/aklogcatter.c')
-rw-r--r-- | c_implementation/src/aklogcatter.c | 35 |
1 files changed, 35 insertions, 0 deletions
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 <aklogcatter.h> +#include <stdio.h> +#include <libaklog.h> +#include <stdlib.h> + +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; +} |