This commit is contained in:
2024-04-24 14:42:39 +02:00
parent 4a901bbdb2
commit 3a55a9f6ec
2 changed files with 7 additions and 8 deletions

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */ /* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/18 18:29:20 by marde-vr #+# #+# */ /* Created: 2024/02/18 18:29:20 by marde-vr #+# #+# */
/* Updated: 2024/04/24 13:45:58 by marde-vr ### ########.fr */ /* Updated: 2024/04/24 14:41:01 by tomoron ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -46,7 +46,7 @@ t_env *set_env(t_env *env, char *name, char *value, int append)
} }
tmp = tmp->next; tmp = tmp->next;
} }
return (env); return (env_add_back(env, name, value));
} }
t_env *export_set_env(t_env *env, char *name, char *value, int append) t_env *export_set_env(t_env *env, char *name, char *value, int append)
@ -58,8 +58,7 @@ t_env *export_set_env(t_env *env, char *name, char *value, int append)
ft_printf_fd(2, "minishell: malloc failed"); ft_printf_fd(2, "minishell: malloc failed");
return (env); return (env);
} }
set_env(env, name, value, append); return (set_env(env, name, value, append));
return (env_add_back(env, name, value));
} }
int ft_export(t_msh *msh, t_token *cmd, t_env *env) int ft_export(t_msh *msh, t_token *cmd, t_env *env)

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */ /* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/05 18:15:27 by marde-vr #+# #+# */ /* Created: 2024/03/05 18:15:27 by marde-vr #+# #+# */
/* Updated: 2024/04/24 14:04:30 by tomoron ### ########.fr */ /* Updated: 2024/04/24 14:41:40 by tomoron ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -75,8 +75,8 @@ int get_in_type(t_msh *msh, t_cmd *t_strt, t_cmd *tokens, int here_doc)
while (cur_token && (cur_token->cmd_type == CMD while (cur_token && (cur_token->cmd_type == CMD
|| cur_token->cmd_type == PAREN)) || cur_token->cmd_type == PAREN))
cur_token = cur_token->next; cur_token = cur_token->next;
if (cur_token && ((cur_token->cmd_type == HERE_DOC && here_doc) if (cur_token && ((cur_token->cmd_type == HERE_DOC && here_doc)
|| (cur_token->cmd_type == RED_I && !here_doc))) || (cur_token->cmd_type == RED_I && !here_doc)))
{ {
msh->in_type = cur_token->cmd_type; msh->in_type = cur_token->cmd_type;
if (open_input_file(msh, &cur_token)) if (open_input_file(msh, &cur_token))
@ -86,7 +86,7 @@ int get_in_type(t_msh *msh, t_cmd *t_strt, t_cmd *tokens, int here_doc)
&& cur_token->cmd_type != PIPE && cur_token->next->cmd_type != PIPE) && cur_token->cmd_type != PIPE && cur_token->next->cmd_type != PIPE)
return (get_in_type(msh, t_strt, cur_token->next, here_doc)); return (get_in_type(msh, t_strt, cur_token->next, here_doc));
if (here_doc) if (here_doc)
return(get_in_type(msh, t_strt, t_strt, 0)); return (get_in_type(msh, t_strt, t_strt, 0));
return (0); return (0);
} }