From 8ec6d84e1b2746e56637350194083e5a9adc1254 Mon Sep 17 00:00:00 2001 From: Adam Joly Date: Sun, 7 Apr 2024 11:04:27 +0200 Subject: [PATCH] =?UTF-8?q?[=E2=9C=8F=EF=B8=8F]=20norm:=20normed=20project?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/exec.h | 4 ++-- test.c | 46 ---------------------------------------------- 2 files changed, 2 insertions(+), 48 deletions(-) delete mode 100644 test.c diff --git a/include/exec.h b/include/exec.h index 535f50c..43ed0c8 100644 --- a/include/exec.h +++ b/include/exec.h @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/04/06 14:15:47 by adjoly #+# #+# */ -/* Updated: 2024/04/06 14:18:27 by adjoly ### ########.fr */ +/* Updated: 2024/04/07 11:04:19 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,7 +15,7 @@ # include -#include "pipex.h" +# include "pipex.h" void exec_pipe(t_pipex *pipex); diff --git a/test.c b/test.c deleted file mode 100644 index 08863ee..0000000 --- a/test.c +++ /dev/null @@ -1,46 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* test.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: adjoly +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2024/04/03 15:36:42 by adjoly #+# #+# */ -/* Updated: 2024/04/04 15:20:24 by adjoly ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include -#include -#include - -int main() -{ - char *cmd[] = {"sleep", "5", 0}; - char *path = "/bin/sleep"; - char *cmd2[] = {"sleep", "5", 0}; - char *path2 = "/bin/sleep"; - int fd[2]; - if (pipe(fd) == -1) - return(1); - int pid; - pid = fork(); - if (!pid) - { - dup2(fd[1], STDOUT_FILENO); - close(fd[0]); - close(fd[1]); - execve(path, cmd, NULL); - } - close(fd[1]); - int pid2 = fork(); - if (!pid2) - { - dup2(fd[0], STDIN_FILENO); - close(fd[0]); - execve(path2, cmd2, NULL); - } - close(fd[1]); - waitpid(pid, NULL, 0); - waitpid(pid2, NULL, 0); -}