diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-09-20 18:33:13 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-09-20 18:33:13 +0200 |
commit | 6bbea3605494b5093e07423ebc4a52f1aecfb0e0 (patch) | |
tree | 69448c8f982398cac0ee225a13b0ca0ae4c48eb1 /src/s_com.c | |
parent | Better format (diff) | |
download | 42-minishell-6bbea3605494b5093e07423ebc4a52f1aecfb0e0.tar.gz 42-minishell-6bbea3605494b5093e07423ebc4a52f1aecfb0e0.tar.bz2 42-minishell-6bbea3605494b5093e07423ebc4a52f1aecfb0e0.tar.xz 42-minishell-6bbea3605494b5093e07423ebc4a52f1aecfb0e0.tar.zst 42-minishell-6bbea3605494b5093e07423ebc4a52f1aecfb0e0.zip |
Its going well
Diffstat (limited to '')
-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); |