summaryrefslogtreecommitdiffstats
path: root/src/p_lblock.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-09-20 14:51:11 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-09-20 14:51:11 +0200
commit613541b99bb02a4dd03d8bd9391eeab5a4c5e986 (patch)
tree83c129b139e7865cbc81d6237ace8e9e1fdb78a2 /src/p_lblock.c
parentGood luck have fuck (diff)
download42-minishell-613541b99bb02a4dd03d8bd9391eeab5a4c5e986.tar.gz
42-minishell-613541b99bb02a4dd03d8bd9391eeab5a4c5e986.tar.bz2
42-minishell-613541b99bb02a4dd03d8bd9391eeab5a4c5e986.tar.xz
42-minishell-613541b99bb02a4dd03d8bd9391eeab5a4c5e986.tar.zst
42-minishell-613541b99bb02a4dd03d8bd9391eeab5a4c5e986.zip
Redirs rework in progress
Diffstat (limited to 'src/p_lblock.c')
-rw-r--r--src/p_lblock.c26
1 files changed, 2 insertions, 24 deletions
diff --git a/src/p_lblock.c b/src/p_lblock.c
index 3acae1a..ba47028 100644
--- a/src/p_lblock.c
+++ b/src/p_lblock.c
@@ -83,36 +83,14 @@ static void
}
}
-int8_t
- p_get_redir(const char word[], t_com **com)
+int8_t p_get_redirs(const char word[], t_com **com)
{
char *ptr;
ptr = (char *)word;
- while (*ptr)
+ while (*ptr != C_NUL)
{
- if (*ptr == '<')
- {
- (*com)->redir = -1;
- break ;
- }
- if (*ptr == '>')
- {
- (*com)->redir = (*(ptr + 1) == '>') ? (2) : (1);
- break ;
- }
ptr++;
- /* gl hf */
- }
- if ((*com)->redir > 0)
- {
- if (ft_isdigit(*(ptr - 1)) == TRUE)
- get_rdrfd(ptr - 1, com);
- else
- (*com)->rdrfd = STDOUT_FILENO;
- rdr_err_check(ptr, com);
- if (get_rdrpath(ptr, com) != 0)
- return (-1);
}
return (0);
}