summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lali.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/lali.c b/lali.c
index d601dcd..2b67f2a 100644
--- a/lali.c
+++ b/lali.c
@@ -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)