diff options
Diffstat (limited to 'src/s_com.c')
-rw-r--r-- | src/s_com.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/s_com.c b/src/s_com.c index 8c41040..45a6304 100644 --- a/src/s_com.c +++ b/src/s_com.c @@ -30,7 +30,6 @@ static int8_t uint64_t i; uint64_t j; - i = 0; if (words[0] != NULL) { if (((*com)->bin = (char*)malloc((ft_strlen(words[0]) + 1) * @@ -40,6 +39,9 @@ static int8_t } else return (0); + i = 0; + while (words[i] != NULL) + i++; if (((*com)->argv = (char**)malloc((i + 1) * sizeof(char*))) == NULL) return (-1); j = 0; @@ -106,11 +108,11 @@ t_com com->bin = NULL; com->rdr = NULL; nword[0] = C_NUL; - ft_printf("BEFORE: [%s]\n", nword); ft_strlcpy(nword, word, ARG_MAX); - ft_printf("AFTER: [%s]\n", nword); + ft_printf("BEFORE: [%s]\n", nword); if (p_redirs(nword, &com) != 0) return (NULL); + ft_printf("AFTER: [%s]\n", nword); if (msh->alias != NULL) { ret = p_subst_alias(nword, TRUE, msh); |