static int cd_arg(t_lex *lexer, t_env **env) { if (lexer->next != NULL) return (my_perror(CD_NB_ARG, EXIT_FAILURE)); if (my_strcmp(lexer->content, "-") == 0) { if (cd_dash(env) == QUIT_RET) return (QUIT_RET); } else return (move_to_arg(lexer->content, env)); return (EXIT_SUCCESS); }
void build_cd(t_data *d) { char **av; if (!build_cd_check_for_env(d)) return ; ft_replace('\t', ' ', d->toexec); av = ft_strsplit(d->toexec, ' '); if (av[1] != NULL && ft_strcmp(av[1], ".") != 0) { if (ft_strcmp(av[1], "-") == 0) cd_dash(d, av[1]); else build_cd2(d, av); } if (av[1] == NULL) cd_only(d, av[1]); free_tabtab(av); }