bug fix env -i && cd error message
This commit is contained in:
@@ -25,8 +25,8 @@ int cmd_cd_update_env(char *path, t_env **env, char opt)
|
||||
if (getcwd(p_path, 4096) == NULL || (oldpwd = ft_strdup(pwd->val)) == NULL
|
||||
|| ft_realpath(path, &c_path) == NULL)
|
||||
return (put_error_cd2(path, "error"));
|
||||
if (ft_envupdate("PWD", *env, ((opt == 'P') ? p_path : c_path)) == NULL
|
||||
|| ft_envupdate("OLDPWD", *env, oldpwd) == NULL)
|
||||
if (cd_updateenv("PWD", ((opt == 'P') ? p_path : c_path), env) == NULL
|
||||
|| cd_updateenv("OLDPWD", oldpwd, env) == NULL)
|
||||
{
|
||||
ft_strdel(&oldpwd);
|
||||
ft_strdel(&c_path);
|
||||
|
@@ -78,14 +78,15 @@ int cleanup(char **argv, t_env *env)
|
||||
return (0);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int ac , char **av, char **envp)
|
||||
{
|
||||
extern char **environ;
|
||||
char **argv;
|
||||
t_env *env;
|
||||
char *cmd;
|
||||
|
||||
if ((env = env2lst(environ)) == NULL)
|
||||
(void)ac;
|
||||
(void)av;
|
||||
if ((env = env2lst(envp)) == NULL)
|
||||
return (2);
|
||||
while (1)
|
||||
{
|
||||
|
Reference in New Issue
Block a user