From 6f30c8aa000b0f3759cb7f9658e725e3ed08f30b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laure=CE=B7t?= Date: Sun, 23 May 2021 16:23:44 +0200 Subject: [PATCH] perfect mmmmm --- minishell.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/minishell.c b/minishell.c index 082c63b..1b2457c 100644 --- a/minishell.c +++ b/minishell.c @@ -89,7 +89,7 @@ int main(int argc, char *argv[]) } if ((pid_fils = fork()) == -1) - { // fork fail ? + { // fork failed ? fprintf(stderr, "ERROR: forking failed, (%d) %s\n", errno, strerror(errno)); exit(errno); } @@ -133,7 +133,7 @@ int main(int argc, char *argv[]) close(pipes[0][0]); } else if (dup2(pipes[i - 1][0], STDIN_FILENO) == -1) - { // dup2 fail + { // dup2 failed ? fprintf(stderr, "ERROR: dup2 error, (%d) %s\n", errno, strerror(errno)); exit(errno); } @@ -143,7 +143,7 @@ int main(int argc, char *argv[]) close(pipes[i][1]); } else if (dup2(pipes[i][1], STDOUT_FILENO) == -1) - { // dup2 fail + { // dup2 failed ? fprintf(stderr, "ERROR: dup2 error, (%d) %s\n", errno, strerror(errno)); exit(errno); } @@ -178,12 +178,12 @@ int main(int argc, char *argv[]) for (int i = 0; i <= nb_pipe; i++) { // on attend chaque sous-fils if (waitpid(sous_fils[i], &wait_code, 0) == -1) - { // wait fail ? + { // wait failed ? fprintf(stderr, "ERROR: waiting for %d failed, (%d) %s\n", wait_code, errno, strerror(errno)); exit(errno); } // TODO: factoriser dans une fonction, cf dessous ? if (wait_code) - { // execvp fail ? + { // execvp failed ? fprintf(stderr, "ERROR: child failed, (%d) %s\n", wait_code, strerror(wait_code)); } } @@ -206,12 +206,12 @@ int main(int argc, char *argv[]) else { // foreground if (waitpid(pid_fils, &wait_code, 0) == -1) - { // wait fail ? + { // wait failed ? fprintf(stderr, "ERROR: waiting for %d failed, (%d) %s\n", wait_code, errno, strerror(errno)); exit(errno); } if (wait_code) - { // execvp fail ? + { // execvp failed ? fprintf(stderr, "ERROR: child failed, (%d) %s\n", wait_code, strerror(wait_code)); } }