summaryrefslogtreecommitdiffstats
path: root/src/s_lvars.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-08-04 14:44:55 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-08-04 14:44:55 +0200
commit647a984ac6b6e2629ad16d3892ad3c231e8e277a (patch)
treeea96eb4f73efa946f100f77538ad1149a8f2de05 /src/s_lvars.c
parentNew libft function strclen, bug fix (diff)
download42-minishell-647a984ac6b6e2629ad16d3892ad3c231e8e277a.tar.gz
42-minishell-647a984ac6b6e2629ad16d3892ad3c231e8e277a.tar.bz2
42-minishell-647a984ac6b6e2629ad16d3892ad3c231e8e277a.tar.xz
42-minishell-647a984ac6b6e2629ad16d3892ad3c231e8e277a.tar.zst
42-minishell-647a984ac6b6e2629ad16d3892ad3c231e8e277a.zip
Huge bug fix
Diffstat (limited to '')
-rw-r--r--src/s_lvars.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/s_lvars.c b/src/s_lvars.c
index f2a1151..d9b7159 100644
--- a/src/s_lvars.c
+++ b/src/s_lvars.c
@@ -26,7 +26,7 @@ void
t_lvars *tmp;
tmp = *lvars;
- while (tmp && ft_strncmp(tmp->name, name, ft_strlen(name)))
+ while (tmp && ft_strncmp(tmp->name, name, ft_strlen(name) + 1))
{
tmp = tmp->next;
}
@@ -40,6 +40,12 @@ void
ft_dprintf(STDERR_FILENO, "%s\n", strerror(errno));
exit(FT_RET_ALLOC);
}
+ /* TODO: delete this */
+ tmp = *lvars;
+ while (tmp) {
+ ft_printf("[%s]: [%s]\n", tmp->name, tmp->val);
+ tmp = tmp->next;
+ }
}
void
@@ -50,7 +56,7 @@ void
t_lvars *prev;
tmp = *lvars;
- if (tmp != NULL && !ft_strncmp(tmp->name, name, ft_strlen(name)))
+ if (tmp != NULL && !ft_strncmp(tmp->name, name, ft_strlen(name) + 1))
{
*lvars = tmp->next;
ft_memdel((void*)&tmp->name);
@@ -58,7 +64,7 @@ void
ft_memdel((void*)&tmp);
return ;
}
- while (tmp && ft_strncmp(tmp->name, name, ft_strlen(name)))
+ while (tmp && ft_strncmp(tmp->name, name, ft_strlen(name) + 1))
{
prev = tmp;
tmp = tmp->next;