leaks home and leaks export

This commit is contained in:
PrStein 2022-04-16 19:50:11 +02:00
parent 8c0116d52d
commit 4e4fd52670
2 changed files with 5 additions and 2 deletions

View File

@ -138,6 +138,7 @@ void check_home(t_s_cmd *cmd, char *p)
if (chdir(p) == 0)
if (find_it(cmd->big_cmd->env, "PWD") != -1)
{
if (find_it(cmd->big_cmd->env, "OLDPWD") != -1)
cmd->big_cmd->env[old_pwd] = ft_strjoin("OLD", cmd->big_cmd->env[pwd]);
cmd->big_cmd->env[pwd] = ft_strjoin("PWD=", p);
}

View File

@ -49,7 +49,9 @@ void print_export(char *tmp)
i = 0;
str1 = ft_substr(tmp, 0, find_len(tmp, i, '='));
i = find_len(tmp, 0, '=') + 1;
str2 = ft_substr(tmp, i, find_len(tmp, i, '\0'));
str2 = ft_substr(tmp, i, ft_strlen(tmp));
// str2 = ft_substr(tmp, i, find_len(tmp, i, '\0'));
printf("declare -x %s", str1);
if (next_space(str2, 0) != '\0')
printf("=\"%s\"", str2);