diff options
author | standenboy <standenboy@seacrossedlovers.xyz> | 2024-04-30 14:22:45 +0100 |
---|---|---|
committer | standenboy <standenboy@seacrossedlovers.xyz> | 2024-04-30 14:22:45 +0100 |
commit | c460a26850eca5ded047d0eb0d183b861087aa53 (patch) | |
tree | 000c4a117746de71870fbee820809f7df49bcfcf /comp/lucas-standen-NEA/code/parser/preprocessor.c | |
parent | 2e239a4ed2265f7c7dc2aabedfdb7d7b011704cb (diff) |
write up update
Diffstat (limited to 'comp/lucas-standen-NEA/code/parser/preprocessor.c')
-rw-r--r-- | comp/lucas-standen-NEA/code/parser/preprocessor.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/comp/lucas-standen-NEA/code/parser/preprocessor.c b/comp/lucas-standen-NEA/code/parser/preprocessor.c new file mode 100644 index 0000000..92c6127 --- /dev/null +++ b/comp/lucas-standen-NEA/code/parser/preprocessor.c @@ -0,0 +1,24 @@ +#include <stdbool.h> +#include <string.h> + +#include "readfile.h" + +char *preprocessor(int argc, char **argv){ + char *buf = readfile(argv[1]); + if (buf == NULL) + return NULL; + + int i = 0; + + while (buf[i] != '\0'){ + if (buf[i] == '\n'){ + buf[i] = ' '; + } + if (buf[i] == '\t'){ + buf[i] = ' '; + } + i++; + } + + return buf; +} |