fixed double here_doc
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/03/24 17:44:32 by marde-vr #+# #+# */
|
/* Created: 2024/03/24 17:44:32 by marde-vr #+# #+# */
|
||||||
/* Updated: 2024/04/23 17:07:00 by tomoron ### ########.fr */
|
/* Updated: 2024/04/24 09:57:20 by marde-vr ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -68,6 +68,12 @@ void handle_here_doc(t_msh *msh, char *eof)
|
|||||||
int pid;
|
int pid;
|
||||||
|
|
||||||
here_doc_file = get_tmp_file_name(msh);
|
here_doc_file = get_tmp_file_name(msh);
|
||||||
|
if (msh->here_doc_filename)
|
||||||
|
{
|
||||||
|
close(msh->in_fd);
|
||||||
|
unlink(msh->here_doc_filename);
|
||||||
|
free(msh->here_doc_filename);
|
||||||
|
}
|
||||||
msh->here_doc_filename = here_doc_file;
|
msh->here_doc_filename = here_doc_file;
|
||||||
msh->in_fd = open(here_doc_file, O_CREAT | O_RDWR, 0644);
|
msh->in_fd = open(here_doc_file, O_CREAT | O_RDWR, 0644);
|
||||||
if (msh->in_fd == -1)
|
if (msh->in_fd == -1)
|
||||||
|
28
todo_list
28
todo_list
@ -1,6 +1,28 @@
|
|||||||
unset HOME
|
unset HOME
|
||||||
cd | lolcat
|
cd | lolcat
|
||||||
double here_doc and manual here_doc tests
|
$SHLVL
|
||||||
$OLDPWD and $PWD (manual tests)
|
|
||||||
|
|
||||||
|
cat <minishell.h <<HERE <missing <<DOC | echo oi
|
||||||
|
|
||||||
|
#invalid command, followed by empty variable, should clear the exit code
|
||||||
|
doesntexist
|
||||||
|
$EMPTY
|
||||||
|
echo $?
|
||||||
|
|
||||||
|
# Should skip the empty argument, and print hello after spaces
|
||||||
|
echo - "" " " hello
|
||||||
|
|
||||||
|
|
||||||
|
Not mandatory ig? # Empty export isn't set on `env` but is set on `export`
|
||||||
|
export hello
|
||||||
|
env | grep hello
|
||||||
|
export | grep hello
|
||||||
|
|
||||||
|
test signals
|
||||||
|
|
||||||
|
test and verify all malocs
|
||||||
|
|
||||||
|
|
||||||
|
parse eof sans parse les variables
|
||||||
potential ft_exit that doesnt unlink tmp here_doc files
|
potential ft_exit that doesnt unlink tmp here_doc files
|
||||||
$EMPTY (manual tests)
|
|
||||||
|
Reference in New Issue
Block a user