diff --git a/README.md b/README.md index 34e4603..8f24a50 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # C JSON Parser Just a simple project to practice writing parsers. -Not guaranteed to be safe or efficient. +Not guaranteed to be safe, reliable or efficient. ## Usage @@ -16,7 +16,7 @@ To make a debug build just run `make`. ### Run ```sh -./bin/{release|debug}/json_parser +./bin/{release|debug}/json_parser sample.json ``` ## Limitations diff --git a/src/main.c b/src/main.c index 16efdf4..9896bf4 100644 --- a/src/main.c +++ b/src/main.c @@ -4,13 +4,17 @@ #include "util.h" #include // atexit -#include // _exit +#include // errx -int main() +int main(int argc, char* argv[]) { + if (argc != 2) { + errx(EXIT_FAILURE, "Usage: %s ", argv[0]); + } + atexit(print_trace); - FILE* fp = fopen("sample.json", "r"); + FILE* fp = fopen(argv[1], "r"); volatile struct json_value x = parse_json_value(fp);