summaryrefslogtreecommitdiff
path: root/comp/lucas-standen-NEA/code/parser/preprocessor.c
blob: 92c6127edd264f86e16b847b6bf1eb5b9aaa4b31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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;
}