diff --git a/src/modal.c b/src/modal.c index a9f1b15..b466070 100644 --- a/src/modal.c +++ b/src/modal.c @@ -179,34 +179,16 @@ parse_rulefrag(char *line) return res; } -static int -parse_line(char *line) -{ - char c; - if(line[0] == 0) return 1; - if(line[0] == '<' && line[1] == '>') - return !!addrule(line); - while((c = *line++)) - *prog_++ = c; - return 1; -} - static int parse(char *path) { FILE *f; - char c, line[0x400], *line_ = line; + int res; if(!(f = fopen(path, "r"))) return !printf("Invalid file: %s\n", path); - while(f && fread(&c, 1, 1, f)) { - if(c == 0xa) - *line_++ = 0x00, parse_line(line), line_ = line; - else if(line_ - line < 0x400) - *line_++ = c; - } - *line_++ = 0x00, parse_line(line), line_ = line; + res = fread(&prog, 1, 0x1000, f); fclose(f); - return 1; + return res; } int