summaryrefslogtreecommitdiff
path: root/comp/cw/code/parser/preprocessor.c
diff options
context:
space:
mode:
authorstandenboy <standenboy@seacrossedlovers.xyz>2024-04-25 08:45:36 +0100
committerstandenboy <standenboy@seacrossedlovers.xyz>2024-04-25 08:45:36 +0100
commit7d3856203d28281e3ffc6b365cc55b1d192a5599 (patch)
tree226ffda231a717f625bd1a965a32d02d0d1348b0 /comp/cw/code/parser/preprocessor.c
parenta241ad8e874a2220d81254c2ebfbe69d0470fd9b (diff)
started cw
Diffstat (limited to 'comp/cw/code/parser/preprocessor.c')
-rw-r--r--comp/cw/code/parser/preprocessor.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/comp/cw/code/parser/preprocessor.c b/comp/cw/code/parser/preprocessor.c
new file mode 100644
index 0000000..92c6127
--- /dev/null
+++ b/comp/cw/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;
+}