ft_printfd_fd -> fprintf

This commit is contained in:
2024-04-18 17:57:17 +02:00
parent be46825893
commit 9053276342
11 changed files with 49 additions and 49 deletions

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/05 19:10:52 by marde-vr #+# #+# */
/* Updated: 2024/04/18 17:23:18 by marde-vr ### ########.fr */
/* Updated: 2024/04/18 17:56:05 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -17,18 +17,18 @@ void redirect_output(t_msh *msh, int i)
{
if (msh->out_type != PIPE)
{
ft_printf_fd(2, "redirecting output\n");
fprintf(stderr, "redirecting output\n");
if (dup2(msh->out_fd, 1) < 0)
ft_exit(msh, 1);
}
else
{
ft_printf_fd(2, "redirecting pipe output\n");
fprintf(stderr, "redirecting pipe output\n");
//sleep(1);
if (dup2(msh->fds[i][1], 1) < 0)
{
perror("dup2");
ft_printf_fd(2, "exiting\n");
fprintf(stderr, "exiting\n");
//ft_exit(msh, 1);
}
}
@ -68,11 +68,11 @@ void get_out_type(t_msh *msh, t_cmd *cmds)
cur_cmd = cur_cmd->next;
while (cur_cmd && cur_cmd->next && !is_output_type(cur_cmd) && !is_operand_type(cur_cmd) && cur_cmd->cmd_type != PIPE)
{
ft_printf_fd(2, "%s: %d\n", cur_cmd->value, cur_cmd->cmd_type);
fprintf(stderr, "%s: %d\n", cur_cmd->value, cur_cmd->cmd_type);
cur_cmd = cur_cmd->next;
}
if (cur_cmd)
ft_printf_fd(2, "%s: %d\n", cur_cmd->value, cur_cmd->cmd_type);
fprintf(stderr, "%s: %d\n", cur_cmd->value, cur_cmd->cmd_type);
if (cur_cmd->cmd_type == CMD || cur_cmd->cmd_type == PAREN)
msh->out_type = 0;
else if(cur_cmd && is_output_type(cur_cmd) && !is_operand_type(cur_cmd) && cur_cmd->cmd_type != PIPE)