diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/p_redirs.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/p_redirs.c b/src/p_redirs.c index 091293c..a47812c 100644 --- a/src/p_redirs.c +++ b/src/p_redirs.c @@ -121,10 +121,8 @@ static void p_get_redir(char word[], char *ptr, t_com *com, t_msh *msh) fd_rdr[RDR] = (fd_rdr[RDR] == 1 && *(ptr + 1) == '>') ? (2) : (fd_rdr[1]); fd_rdr[RDR] = (fd_rdr[RDR] == -1 && *(ptr + 1) == '<') ? (-2) : (fd_rdr[1]); fd_rdr[RDR] = (fd_rdr[RDR] == -2 && *(ptr + 2) == '-') ? (-3) : (fd_rdr[1]); - if (fd_rdr[FD] == STDOUT_FILENO) - pos[0] = (ptr - word); - else - pos[0] = (ptr - word) - ft_intlen(fd_rdr[FD]); + pos[0] = (fd_rdr[FD] == STDOUT_FILENO) ? + (ptr - word) : ((ptr - word) - ft_intlen(fd_rdr[FD])); tmp.word = word; tmp.ptr = ptr; tmp.redir = fd_rdr[RDR]; |