static void ft_ctrl_d(t_stream *stream) { ft_gohome(stream); ft_freegiveone((void**)&(stream->command)); stream->command = ft_strdup("exit"); ft_winsize(); }
int ft_cd(char **path) { char tmp[500]; if (path[0] && !path[1]) ft_gohome(); else if (ft_strcmp(path[1], "-L") == 0 || ft_strcmp(path[1], "-P") == 0) return (ft_cd_option(path)); else if (path[0] && path[1] && !path[2]) { if (ft_cd_lien(path[1], path) == 1) return (1); else if (chdir(path[1]) == -1) check_existe(path[1], 0); else { if (getcwd(tmp, 500) == NULL) ft_erreur("Récuperation de PWD", 0); ft_stockage_env("OLDPWD", ft_cherche_env("$PWD")->valeur); ft_stockage_env("PWD", tmp); } } else check_existe(path[1], 1); free_tabtab(path); return (1); }