signaux fonctionnent sur test

This commit is contained in:
hugogogo
2021-11-15 16:09:19 +01:00
parent 47ae67ed14
commit 57c271b9e2
4 changed files with 65 additions and 9 deletions

View File

@@ -22,10 +22,14 @@ int builtin_export(int argc, char *argv[], t_all *c)
var = ft_split(argv[1], '=');
position = getenv_position(c->envp, var[0]);
if (position == -1 || !ft_strchr(argv[1], '='))
{
ft_free_2d_arr(var);
return (0);
}
c->envp[position] = ft_strjoin(var[0], "=");
if (var[1]) // parce que ft_strjoin return NULL si var[1] est null, pourquoi ?
c->envp[position] = ft_strjoin(c->envp[position], var[1]);
c->envp[position] = ft_strjoinfree_s1(c->envp[position], var[1]);
ft_free_2d_arr(var);
return (0);
}
@@ -41,7 +45,6 @@ int builtin_export(int argc, char *argv[], t_all *c)
** > 'export VARIABLE' n'exporte rien
** > 'export VARIABLE=' exporte une variable vide
** 4. ordre d'insertion d'une nouvelle variable :
**
**
** > aucune idee
*/