This commit is contained in:
mdev9
2024-03-23 10:35:39 +01:00
parent 7b6c75b5c3
commit 568df14b4a
3 changed files with 23 additions and 3 deletions

2
.gitignore vendored
View File

@ -1,5 +1,7 @@
# Prerequisites
*.d
todo
minishell
.minishellrc

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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"))

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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);
}
}
}