blob: fa9f10f76d10c630c8cb834130cbdff92008001b (
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
25
26
27
28
29
30
|
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lexer.h"
#include "misc.h"
void usage(const char *name) {
printf("Usage: %s <file>\n", name);
}
int main(int argc, char **argv) {
char *buf;
long file_size = 0;
int dbg = 0;
int ret = 0;
if (argc < 2) {
usage(argv[0]);
ret = 1;
}
buf = read_file(argc[1], &file_size);
if (buf == NULL) {
printf("Error: read_file() returned NULL.\n");
usage(argv[0]);
ret = 1;
}
ret = lex(buf, dbg);
return ret;
}
|