From 647a984ac6b6e2629ad16d3892ad3c231e8e277a Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Tue, 4 Aug 2020 14:44:55 +0200 Subject: Huge bug fix --- src/s_lvars.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/s_lvars.c') 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; -- cgit v1.2.3