diff options
Diffstat (limited to 'src/ft_s_lcom.c')
-rw-r--r-- | src/ft_s_lcom.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/ft_s_lcom.c b/src/ft_s_lcom.c index f469edb..b31f5e5 100644 --- a/src/ft_s_lcom.c +++ b/src/ft_s_lcom.c @@ -29,21 +29,22 @@ static int8_t return (-1); ft_strlcpy((*lcom)->com, words[0], ft_strlen(words[0]) + 1); while(words[i + 1]) + { + if (ft_ischarset("<>", words[i + 1][0])) + break ; i++; + } if (!((*lcom)->args = (char**)malloc((i + 1) * sizeof(char*)))) return (-1); j = 0; - if (i > 0) + while (i > 0 && j < i) { - while (j < i) - { - if (!((*lcom)->args[j] = - (char*)malloc((ft_strlen(words[j + 1]) + 1) * sizeof(char)))) - return (-1); - ft_strlcpy((*lcom)->args[j], words[j + 1], - ft_strlen(words[j + 1]) + 1); - j++; - } + if (!((*lcom)->args[j] = + (char*)malloc((ft_strlen(words[j + 1]) + 1) * sizeof(char)))) + return (-1); + ft_strlcpy((*lcom)->args[j], words[j + 1], + ft_strlen(words[j + 1]) + 1); + j++; } (*lcom)->args[j] = 0; return (0); @@ -107,7 +108,6 @@ t_lcom link->com = NULL; link->args = NULL; link->rdrpath = NULL; - /* TODO: redirections here */ if (ft_get_redir(word, &link) != 0) return (NULL); if (!(words = ft_split(word, ' '))) |