diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -56,6 +56,7 @@ int main(int argc, char **argv) { char *file_content; size_t filesize; TslProgram program; + int result = 0; if(argc != 2) { usage(); @@ -64,16 +65,22 @@ int main(int argc, char **argv) { file_content = file_get_content(argv[1], &filesize); if(!file_content) - return 1; + return 2; tsl_program_init(&program); - if(!tsl_parse(file_content, filesize, &program)) - return 2; - if(!tsl_program_run(&program)) - return 3; + if(!tsl_parse(file_content, filesize, &program)) { + result = 3; + goto cleanup; + } + + if(!tsl_program_run(&program)) { + result = 4; + goto cleanup; + } + cleanup: free(file_content); tsl_program_deinit(&program); - return 0; + return result; } |