summaryrefslogtreecommitdiffstats
path: root/src/m_redirs.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-09-20 15:24:18 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-09-20 15:24:18 +0200
commit00f646697e6d30d047e0b1e09ae0e55d216ce730 (patch)
treeeb9a7a0734ba0caf46debb0fe7a30442f84af743 /src/m_redirs.c
parentRedirs rework in progress (diff)
download42-minishell-00f646697e6d30d047e0b1e09ae0e55d216ce730.tar.gz
42-minishell-00f646697e6d30d047e0b1e09ae0e55d216ce730.tar.bz2
42-minishell-00f646697e6d30d047e0b1e09ae0e55d216ce730.tar.xz
42-minishell-00f646697e6d30d047e0b1e09ae0e55d216ce730.tar.zst
42-minishell-00f646697e6d30d047e0b1e09ae0e55d216ce730.zip
In progress
Diffstat (limited to 'src/m_redirs.c')
-rw-r--r--src/m_redirs.c69
1 files changed, 35 insertions, 34 deletions
diff --git a/src/m_redirs.c b/src/m_redirs.c
index 50e416a..40a6646 100644
--- a/src/m_redirs.c
+++ b/src/m_redirs.c
@@ -22,39 +22,40 @@
void dup_redirs(const t_com *ptr, t_msh *msh)
{
- int32_t fd;
+ (void)ptr;
+ (void)msh;
+ /* int32_t fd; */
- if (ptr->redir == -1)
- {
- if ((fd = open(ptr->rdrpath, O_RDONLY)) == -1)
- {
- f_redir(ptr->rdrpath, msh);
- return ;
- }
- ft_printf("[%s]", ptr->rdrpath);
- dup2(fd, STDIN_FILENO);
- close(fd);
- }
- else if (ptr->redir == 1)
- {
- if ((fd = open(ptr->rdrpath,
- O_CREAT | O_TRUNC | O_WRONLY, 0644)) == -1)
- {
- f_redir(ptr->rdrpath, msh);
- return ;
- }
- dup2(fd, ptr->rdrfd);
- close(fd);
- }
- else if (ptr->redir == 2)
- {
- if ((fd = open(ptr->rdrpath,
- O_CREAT | O_APPEND | O_WRONLY, 0644)) == -1)
- {
- f_redir(ptr->rdrpath, msh);
- return ;
- }
- dup2(fd, ptr->rdrfd);
- close(fd);
- }
+ /* if (ptr->redir == -1) */
+ /* { */
+ /* if ((fd = open(ptr->rdrpath, O_RDONLY)) == -1) */
+ /* { */
+ /* f_redir(ptr->rdrpath, msh); */
+ /* return ; */
+ /* } */
+ /* dup2(fd, STDIN_FILENO); */
+ /* close(fd); */
+ /* } */
+ /* else if (ptr->redir == 1) */
+ /* { */
+ /* if ((fd = open(ptr->rdrpath, */
+ /* O_CREAT | O_TRUNC | O_WRONLY, 0644)) == -1) */
+ /* { */
+ /* f_redir(ptr->rdrpath, msh); */
+ /* return ; */
+ /* } */
+ /* dup2(fd, ptr->rdrfd); */
+ /* close(fd); */
+ /* } */
+ /* else if (ptr->redir == 2) */
+ /* { */
+ /* if ((fd = open(ptr->rdrpath, */
+ /* O_CREAT | O_APPEND | O_WRONLY, 0644)) == -1) */
+ /* { */
+ /* f_redir(ptr->rdrpath, msh); */
+ /* return ; */
+ /* } */
+ /* dup2(fd, ptr->rdrfd); */
+ /* close(fd); */
+ /* } */
}