aboutsummaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
Diffstat (limited to 'sh')
-rw-r--r--sh/parser.c9
-rw-r--r--sh/sh.c3
2 files changed, 6 insertions, 6 deletions
diff --git a/sh/parser.c b/sh/parser.c
index 47edef2..c5562d7 100644
--- a/sh/parser.c
+++ b/sh/parser.c
@@ -63,15 +63,16 @@ int parseCommand(int argc, char *argv[]) {
*/
status_code = execvp(argv[0], argv);
/* If the child process is still alive, we know execvp(3) failed. */
- exit(errno);
+ exit(-errno);
}
/* This code may be used to store the exit value in $?. */
//if (errno != EINTR && WEXITSTATUS(status_code) !=) return WEXITSTATUS(status_code);
//else return 0;
err = WEXITSTATUS(status_code);
- if (err == E2BIG || err == EACCES || err == EINVAL || err == ELOOP ||
- err == ENAMETOOLONG || err == ENOENT || err == ENOTDIR)
- printf("sh: %s: %s", argv[0], strerror(err));
+ if (err-256 == -E2BIG || err-256 == -EACCES || err-256 == -EINVAL ||
+ err-256 == -ELOOP ||
+ err-256 == -ENAMETOOLONG || err-256 == -ENOENT || err-256 == -ENOTDIR)
+ printf("sh: %s: %s\n", argv[0], strerror(-(err-256)));
return err;
}
diff --git a/sh/sh.c b/sh/sh.c
index 2bb095c..ab81649 100644
--- a/sh/sh.c
+++ b/sh/sh.c
@@ -134,8 +134,7 @@ void commandLoop(FILE *filstr) {
}
else {
command_argc = splitCommand(name, command); /* See parser.c */
- if ((errno = parseCommand(command_argc, command)) != 0 /* See parser.c */ )
- printf("sh: %s: %s\n", command[0], strerror(errno));
+ parseCommand(command_argc, command); /* See parser.c */
}
}
}