From 3f270563e918e2712efca754383d2ff4fbc2b94b Mon Sep 17 00:00:00 2001 From: Etienne Rey-bethbeder Date: Sun, 12 Mar 2023 18:03:13 +0100 Subject: [PATCH] Correction --- Makefile | 4 +--- bonus/pipex.h | 2 -- bonus/pipex_heredoc.c | 2 ++ bonus/pipex_parsing.c | 7 ++++--- mandatory/pipex.h | 4 +--- mandatory/pipex_parsing.c | 4 +--- 6 files changed, 9 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 4927c99..2b815d6 100644 --- a/Makefile +++ b/Makefile @@ -139,8 +139,6 @@ coffee: bozo : @wget -q -O bozo.gif https://i.kym-cdn.com/photos/images/newsfeed/002/322/200/e51.gif @xdg-open bozo.gif - @sleep 0.15 - @xdotool key F11 - @sleep 4.1 + @sleep 4.26 @pkill eog @rm bozo.gif diff --git a/bonus/pipex.h b/bonus/pipex.h index c8571ff..e08fd6b 100644 --- a/bonus/pipex.h +++ b/bonus/pipex.h @@ -24,8 +24,6 @@ typedef struct s_data { char **cmds; char ***flgs; - char *fl1; - char *fl2; int fd1; int fd2; int fd[2][2]; diff --git a/bonus/pipex_heredoc.c b/bonus/pipex_heredoc.c index ec3b611..32decd6 100644 --- a/bonus/pipex_heredoc.c +++ b/bonus/pipex_heredoc.c @@ -57,6 +57,8 @@ int here_doc(int argc, char *argv[], char **env, t_data *data) while (1) { cur = get_next_line(0); + if (!cur) + break; cur[ft_strlen(cur) - 1] = '\0'; if (ft_strcmp(cur, argv[2]) == 0) break ; diff --git a/bonus/pipex_parsing.c b/bonus/pipex_parsing.c index c98d020..8553d91 100644 --- a/bonus/pipex_parsing.c +++ b/bonus/pipex_parsing.c @@ -6,7 +6,7 @@ /* By: erey-bet +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/01/19 17:03:01 by erey-bet #+# #+# */ -/* Updated: 2023/03/07 19:26:23 by erey-bet ### ########.fr */ +/* Updated: 2023/03/12 17:56:18 by erey-bet ### ########.fr */ /* */ /* ************************************************************************** */ @@ -84,11 +84,12 @@ char *find_command(char **env, char *cmd) while (*env != NULL) { - if (ft_strnstr(*env, "PATH=/", ft_strlen(*env)) - && ft_strchr(*env, ':') > 0) + if (ft_strnstr(*env, "PATH=", 6)) break ; env++; } + if (ft_strlen(*env) == 0) + env--; y = 0; s = ft_calloc(ft_strlen(*env) + 1, 1); if (s == NULL) diff --git a/mandatory/pipex.h b/mandatory/pipex.h index c63e480..441b047 100644 --- a/mandatory/pipex.h +++ b/mandatory/pipex.h @@ -22,13 +22,11 @@ typedef struct s_data { - char *fl1; char *cmd1; char **flg1; - char *fl2; + int fd1; char *cmd2; char **flg2; - int fd1; int fd2; char **env; } t_data; diff --git a/mandatory/pipex_parsing.c b/mandatory/pipex_parsing.c index 3f54ae3..4c67c6d 100644 --- a/mandatory/pipex_parsing.c +++ b/mandatory/pipex_parsing.c @@ -6,7 +6,7 @@ /* By: erey-bet +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/01/19 17:03:01 by erey-bet #+# #+# */ -/* Updated: 2023/03/08 11:29:33 by erey-bet ### ########.fr */ +/* Updated: 2023/03/12 17:39:22 by erey-bet ### ########.fr */ /* */ /* ************************************************************************** */ @@ -31,8 +31,6 @@ int parsing(char *argv[], t_data *data) } data->flg1 = ft_split(argv[2], ' '); data->flg2 = ft_split(argv[3], ' '); - data->fl1 = argv[1]; - data->fl2 = argv[4]; return (0); }