aboutsummaryrefslogtreecommitdiff
path: root/cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmd.c')
-rw-r--r--cmd.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/cmd.c b/cmd.c
index b428d58..7e73a05 100644
--- a/cmd.c
+++ b/cmd.c
@@ -30,23 +30,13 @@ void cmd(char *line) {
return;
}
- /* If the command looks to be executable ... */
- if (access(cmd, X_OK) != -1) {
-
- /* ... fork and try to execute it; wait until the fork is done. */
- pid = fork();
- if (pid == 0) {
- cmd_argv[0] = cmd;
- execve(cmd, cmd_argv, environ);
- }
- waitpid(pid, &status, 0);
- }
-
- /* Otherwise, print an error, because we couldn't find the command */
- else {
- fprintf(stderr, "Command ā€œ%sā€ not found\n", cmd);
- return;
+ /* Fork and try to execute it; wait until the fork is done. */
+ pid = fork();
+ if (pid == 0) {
+ cmd_argv[0] = cmd;
+ execvp(cmd, cmd_argv);
}
+ waitpid(pid, &status, 0);
return;
}