leaks home and leaks export
This commit is contained in:
parent
8c0116d52d
commit
4e4fd52670
@ -138,7 +138,8 @@ void check_home(t_s_cmd *cmd, char *p)
|
|||||||
if (chdir(p) == 0)
|
if (chdir(p) == 0)
|
||||||
if (find_it(cmd->big_cmd->env, "PWD") != -1)
|
if (find_it(cmd->big_cmd->env, "PWD") != -1)
|
||||||
{
|
{
|
||||||
cmd->big_cmd->env[old_pwd] = ft_strjoin("OLD", cmd->big_cmd->env[pwd]);
|
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);
|
cmd->big_cmd->env[pwd] = ft_strjoin("PWD=", p);
|
||||||
}
|
}
|
||||||
free(p);
|
free(p);
|
||||||
|
|||||||
@ -49,7 +49,9 @@ void print_export(char *tmp)
|
|||||||
i = 0;
|
i = 0;
|
||||||
str1 = ft_substr(tmp, 0, find_len(tmp, i, '='));
|
str1 = ft_substr(tmp, 0, find_len(tmp, i, '='));
|
||||||
i = find_len(tmp, 0, '=') + 1;
|
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);
|
printf("declare -x %s", str1);
|
||||||
if (next_space(str2, 0) != '\0')
|
if (next_space(str2, 0) != '\0')
|
||||||
printf("=\"%s\"", str2);
|
printf("=\"%s\"", str2);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user