diff --git a/justfile b/justfile index 7169a53..47b9b69 100644 --- a/justfile +++ b/justfile @@ -17,6 +17,17 @@ test: install: default meson install -C src/builddir +[working-directory: 'src'] +generate-llvm: clean + clang -g -Wall -S -emit-llvm -std=gnu23 *.c + llvm-link -S -v *.ll -o icscli.ll + +[working-directory: 'src'] +llvm-to-binary: generate-llvm + clang icscli.ll -o icscli -luuid + clean: rm -rf src/builddir rm -rf unit_tests/builddir + rm -f src/*.ll + rm -f src/icscli diff --git a/src/file_handling.c b/src/file_handling.c index 87c0201..595f819 100644 --- a/src/file_handling.c +++ b/src/file_handling.c @@ -36,7 +36,8 @@ void read_until_string(int fd, char buffer[], char search_string[]) { i++; } size_t truncate_position = strlen(buffer) - strlen(search_string); - memset(&buffer[truncate_position], '\0', truncate_position); + + memset(&buffer[truncate_position], '\0', strlen(buffer) - truncate_position); } // Seeks for a string in an open file.