builtin export redirection

This commit is contained in:
2024-04-23 13:22:03 +02:00
parent 3fac53244f
commit 3cf92d0495
5 changed files with 23 additions and 21 deletions

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/04/23 10:56:19 by marde-vr ### ########.fr */
/* Updated: 2024/04/23 12:50:19 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -33,11 +33,8 @@ int cmd_is_builtin(t_msh *msh, char *cmd_token)
g_return_code = cd(msh->tokens);
else if (!ft_strcmp(cmd_token, "exit"))
g_return_code = exit_bt(msh);
else if (!ft_strcmp(cmd_token, "export") && (msh->out_type == PIPE
|| msh->out_type == RED_O || msh->out_type == RED_O_APP))
ft_printf_fd(2, "print the thing into the pipe\n");
else if (!ft_strcmp(cmd_token, "export"))
g_return_code = ft_export(msh->tokens, msh->env);
else if (!ft_strcmp(cmd_token, "export") && msh->out_type != PIPE)
g_return_code = ft_export(msh, msh->tokens, msh->env);
else if (!ft_strcmp(cmd_token, "unset"))
g_return_code = ft_unset(msh);
else
@ -61,11 +58,9 @@ int exec_builtin(t_msh *msh)
g_return_code = pwd();
else if (!ft_strcmp(msh->tokens->value, "cd"))
return (1);
else if (!ft_strcmp(msh->tokens->value, "export") && (msh->out_type == PIPE
|| msh->out_type == RED_O || msh->out_type == RED_O_APP))
ft_printf_fd(2, "catch the printed stuff and put it write it into file\n");
else if (!ft_strcmp(msh->tokens->value, "export") && msh->out_type == PIPE)
g_return_code = ft_export(msh, msh->tokens, msh->env);
else if (!ft_strcmp(msh->tokens->value, "export"))
//g_return_code = ft_export(msh->tokens, msh->env);
return (1);
else if (!ft_strcmp(msh->tokens->value, "unset"))
return (1);