diff options
| author | Daniel Cerqueira <dan.git@lispclub.com> | 2026-08-19 20:39:10 +0100 |
|---|---|---|
| committer | Daniel Cerqueira <dan.git@lispclub.com> | 2026-08-19 20:39:10 +0100 |
| commit | c9d6fd4188361a7066a0b52c74c3bc3b81f459bc (patch) | |
| tree | 28f9e243045ae11c4245b41283991f8647ef4c6a /lali.c | |
| parent | 322ce813f85f5122f7a99085d170e85a91b14729 (diff) | |
proper exit status codes
Diffstat (limited to 'lali.c')
| -rw-r--r-- | lali.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -39,10 +39,14 @@ #include <readline/readline.h> #include <readline/history.h> - #define YEARS "2025, 2026" #define SOURCE_URL "https://gitlab.com/alexandre1985/lali/" +#define EXIT_FAIL_UNKNOWN_ARGOPT 2 +#define EXIT_FAIL_OPEN_FILE 3 +#define EXIT_FAIL_REPL_WITH_PIPING 4 +#define EXIT_FAIL_LANG 5 + // MAIN /////////////////////////////////////////////////////////////////////// void runFile(int infd, Object **env, GC_PARAM) { @@ -167,7 +171,7 @@ source code at %s .\n", fprintf (stderr, "\ttry '%s --help' for a complete list of options.\n", argv[0]); - return EXIT_FAILURE; + return EXIT_FAIL_UNKNOWN_ARGOPT; } } @@ -178,7 +182,7 @@ source code at %s .\n", GC_PARAM = nil; if (setjmp(exceptionEnv)) - return EXIT_FAILURE; + return EXIT_FAIL_LANG; symbols = nil; symbols = newCons(&nil, &symbols, GC_ROOTS); @@ -195,7 +199,7 @@ source code at %s .\n", for (int i = ++options; i < argc; i++) { if ((fd = open(argv[i], O_RDONLY)) == -1) { fprintf(stderr, "%s: open() failed, %s\n", argv[0], strerror(errno)); - return EXIT_FAILURE; + return EXIT_FAIL_OPEN_FILE; } runFile(fd, gcEnv, GC_ROOTS); } @@ -205,7 +209,7 @@ source code at %s .\n", if (opt_repl) { if(!isatty(STDIN_FILENO)) { fprintf(stderr, "%s: repl does not accept piping\n", argv[0]); - return EXIT_FAILURE; + return EXIT_FAIL_REPL_WITH_PIPING; } if (!opt_quiet) |
