diff --git a/src/exec.c b/src/exec.c index 4d273ec..edfa8bd 100644 --- a/src/exec.c +++ b/src/exec.c @@ -16,7 +16,7 @@ int execute_cmd(char **args) { if (pid == 0) { // Ce que va exécuter l'enfant int status_code = execvp(args[0], args); - perror("seyshell"); + perror(args[0]); return status_code; } else { // Ce que va exécuter le parent diff --git a/src/parsing.c b/src/parsing.c index 4841ddf..8e94d60 100644 --- a/src/parsing.c +++ b/src/parsing.c @@ -50,12 +50,20 @@ char **split_line(char *line) { } void shell_loop(void) { + char *user = getenv("USER"); + char *hostname = malloc(BUFSIZE * sizeof(char)); + if (hostname == NULL) { + dprintf(STDERR_FILENO, "Allocation error"); + } + gethostname(hostname, sizeof(hostname)); + char *line; char **args; int status = 1; do { - dprintf(STDOUT_FILENO, "> "); + + dprintf(STDOUT_FILENO, "%s@%s %s> ", user, hostname, getenv("PWD")); line = read_line(); args = split_line(line); status = execute_cmd(args); diff --git a/src/parsing.h b/src/parsing.h index 85eb311..3136c9b 100644 --- a/src/parsing.h +++ b/src/parsing.h @@ -1,5 +1,6 @@ #pragma once #include +#include #include void shell_loop(void); \ No newline at end of file