Browse Source

[doc] del_env: add comments.

Moul 3 years ago
parent
commit
e4762f6b7f
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/tabenv.c

+ 7 - 1
src/tabenv.c

@@ -15,6 +15,12 @@ void	add_env(t_e *e, char *nenv)
 	e->env = env;
 }
 
+/*
+** Copy every line till encounter the one which must be deleted
+** Free memory of deleted line
+** Continue copying ever line till the end
+*/
+
 void	del_env(t_e *e, char *old_env)
 {
 	int		i;
@@ -22,7 +28,7 @@ void	del_env(t_e *e, char *old_env)
 
 	env = (char **)malloc(sizeof(char *) * ft_tabsize(e->env));
 	i = -1;
-	while (e->env[++i] != NULL && ft_strcmp(e->env[i], old_env) != 61)
+	while (e->env[++i] != NULL && ft_strcmp(e->env[i], old_env) != '=')
 		env[i] = e->env[i];
 	while (e->env[i] != NULL)
 	{