summaryrefslogtreecommitdiffstats
path: root/src/s_lvars.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/s_lvars.c (renamed from src/ft_s_lvars.c)26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/ft_s_lvars.c b/src/s_lvars.c
index fb3a0f4..d9b7159 100644
--- a/src/ft_s_lvars.c
+++ b/src/s_lvars.c
@@ -1,7 +1,7 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
-/* ft_s_lvars.c :+: :+: :+: */
+/* s_lvars.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
@@ -16,17 +16,17 @@
#include <errno.h>
#include <unistd.h>
-#include "ft_s_struct.h"
+#include "s_struct.h"
void
- ft_lvars_rebind(t_lvars **lvars,
+ lvars_rebind(t_lvars **lvars,
const char name[],
const char newval[])
{
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,17 +40,23 @@ 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
- ft_lvars_delone(t_lvars **lvars,
+ lvars_delone(t_lvars **lvars,
const char name[])
{
t_lvars *tmp;
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;
@@ -72,7 +78,7 @@ void
}
void
- ft_lvars_add_front(t_lvars **alvars,
+ lvars_add_front(t_lvars **alvars,
t_lvars *new)
{
if (!alvars || !new)
@@ -84,7 +90,7 @@ void
}
void
- ft_lvars_clear(t_lvars **lvars)
+ lvars_clear(t_lvars **lvars)
{
t_lvars *tmp;
t_lvars *renext;
@@ -104,7 +110,7 @@ void
}
t_lvars
- *ft_lvars_new(const char name[],
+ *lvars_new(const char name[],
const char val[])
{
t_lvars *link;