initial
This commit is contained in:
34
main.c
Normal file
34
main.c
Normal file
@@ -0,0 +1,34 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "src/parser.h"
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
char* inp;
|
||||
long size;
|
||||
|
||||
if (argc != 2) {
|
||||
printf("usage: %s FILE\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
FILE* f = fopen(argv[1], "r");
|
||||
|
||||
if (!f) {
|
||||
puts("Error while opening the file.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
fseek(f, 0, SEEK_END);
|
||||
size = ftell(f);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
|
||||
inp = malloc(size+1);
|
||||
fread(inp, size, 1, f);
|
||||
fclose(f);
|
||||
|
||||
inp[size] = '\0';
|
||||
|
||||
printf("%p\n", (void*) parse(inp));
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user