」 feat: Parsing working but not handling error

This commit is contained in:
2024-05-31 19:26:09 +02:00
parent 6bbdef9d7c
commit 5a71c50897
7 changed files with 57 additions and 32 deletions

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/30 10:48:41 by adjoly #+# #+# */
/* Updated: 2024/05/30 17:47:43 by adjoly ### ########.fr */
/* Updated: 2024/05/31 19:16:41 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -46,11 +46,10 @@ t_cmd *get_redir_fd(void *content)
in.sign = INFILE;
in.file_name = tmp_redir->file_name;
}
else
{
out.sign = tmp_redir->sign;
out.file_name = tmp_redir->file_name;
}
else if (tmp_redir->sign == OUTFILE)
cmd->outfile = open(tmp_redir->file_name, O_CREAT | O_TRUNC | O_WRONLY, 0644);
else if (tmp_redir->sign == OUT_APPEND)
cmd->outfile = open(tmp_redir->file_name, O_CREAT | O_APPEND | O_WRONLY, 0644);
tmp = tmp->next;
}
if (in.sign == OUTFILE)
@ -62,9 +61,6 @@ t_cmd *get_redir_fd(void *content)
}
if (out.sign == INFILE)
cmd->outfile = STDOUT_FILENO;
else if (out.sign == OUTFILE)
cmd->outfile = open(out.file_name, O_CREAT | O_TRUNC | O_WRONLY);
else if (out.sign == OUT_APPEND)
cmd->outfile = open(out.file_name, O_CREAT | O_APPEND | O_WRONLY);
cmd = split_cmd(token->argv, cmd);
return (cmd);
}