From 3fac53244fc602b5f9b9053650a80d48fc89d237 Mon Sep 17 00:00:00 2001 From: mdev9 Date: Tue, 23 Apr 2024 11:16:39 +0200 Subject: [PATCH] preped export redirections --- srcs/builtins.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/srcs/builtins.c b/srcs/builtins.c index 0d54776..ecdd52e 100755 --- 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/04/22 19:39:03 by marde-vr ### ########.fr */ +/* Updated: 2024/04/23 10:56:19 by marde-vr ### ########.fr */ /* */ /* ************************************************************************** */ @@ -27,12 +27,15 @@ int cmd_is_builtin(t_msh *msh, char *cmd_token) if (!cmd_token) return (0); else if ((msh->in_type == PIPE || msh->out_type == PIPE) - && cmd_is_forkable_builtin(cmd_token)) + && cmd_is_forkable_builtin(cmd_token) && ft_strcmp(cmd_token, "export")) return (1); else if (!ft_strcmp(cmd_token, "cd")) 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, "unset")) @@ -58,7 +61,11 @@ 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")) + //g_return_code = ft_export(msh->tokens, msh->env); return (1); else if (!ft_strcmp(msh->tokens->value, "unset")) return (1);