summaryrefslogtreecommitdiffstats
path: root/src/ft_s_lcom.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ft_s_lcom.c')
-rw-r--r--src/ft_s_lcom.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/ft_s_lcom.c b/src/ft_s_lcom.c
index 0f6f750..de09e5c 100644
--- a/src/ft_s_lcom.c
+++ b/src/ft_s_lcom.c
@@ -20,6 +20,7 @@ static int8_t
ft_fill_lcom(char *words[],
t_lcom **lcom)
{
+ /* TODO: norme */
uint64_t i;
uint64_t j;
@@ -28,10 +29,10 @@ static int8_t
sizeof(char))))
return (-1);
ft_strlcpy((*lcom)->com, words[0], ft_strlen(words[0]) + 1);
- while(words[i + 1])
+ while(words[i])
{
/* TODO: better <> cut ex: "msh ~> echo qwe>qwe" | gl hf */
- if (ft_ischarset("<>", words[i + 1][0]))
+ if (ft_ischarset("<>", words[i][0]))
break ;
i++;
}
@@ -41,10 +42,10 @@ static int8_t
while (i > 0 && j < i)
{
if (!((*lcom)->argv[j] =
- (char*)malloc((ft_strlen(words[j + 1]) + 1) * sizeof(char))))
+ (char*)malloc((ft_strlen(words[j]) + 1) * sizeof(char))))
return (-1);
- ft_strlcpy((*lcom)->argv[j], words[j + 1],
- ft_strlen(words[j + 1]) + 1);
+ ft_strlcpy((*lcom)->argv[j], words[j],
+ ft_strlen(words[j]) + 1);
j++;
}
(*lcom)->argv[j] = 0;