diff --git a/.gitignore b/.gitignore index a4dd16f..5e21fc9 100755 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ # Prerequisites *.d +todo + minishell .minishellrc diff --git a/srcs/builtins.c b/srcs/builtins.c index 87c0b5b..f8a90c7 100644 --- a/srcs/builtins.c +++ b/srcs/builtins.c @@ -6,7 +6,7 @@ /* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/03/05 18:20:21 by marde-vr #+# #+# */ -/* Updated: 2024/03/21 11:03:47 by tomoron ### ########.fr */ +/* Updated: 2024/03/23 10:18:36 by marde-vr ### ########.fr */ /* */ /* ************************************************************************** */ @@ -47,7 +47,8 @@ int cmd_is_builtin(t_msh *msh, char *cmd_token) } else if(!ft_strcmp(cmd_token,"export")) { - ft_export(msh); + if (!(msh->in_type == PIPE || msh->out_type == PIPE)) + ft_export(msh); return(1); } else if(!ft_strcmp(cmd_token, "unset")) diff --git a/srcs/here_doc.c b/srcs/here_doc.c index 35869b9..7fe681f 100644 --- a/srcs/here_doc.c +++ b/srcs/here_doc.c @@ -6,7 +6,7 @@ /* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/26 20:20:31 by marde-vr #+# #+# */ -/* Updated: 2024/03/05 17:45:51 by marde-vr ### ########.fr */ +/* Updated: 2024/03/23 10:21:07 by marde-vr ### ########.fr */ /* */ /* ************************************************************************** */ @@ -98,6 +98,8 @@ void handle_here_doc(t_msh *msh, char *eof) eof = ft_strjoin_free(eof, "\n", 1); if (!eof) ft_exit(msh, 1); + + /* get_here_doc_input(msh, eof); close(msh->in_fd); msh->in_fd = open(here_doc_file, O_RDWR, 0644); @@ -106,4 +108,19 @@ void handle_here_doc(t_msh *msh, char *eof) perror("open"); ft_exit(msh, 1); } +}*/ + + int pid = fork(); + if (pid == 0) + get_here_doc_input(msh, eof); + else + { + close(msh->in_fd); + msh->in_fd = open(here_doc_file, O_RDWR, 0644); + if (msh->in_fd == -1) + { + perror("open"); + ft_exit(msh, 1); + } + } }