int main(int argc, char **argv, char **env) { t_struc s; ft_poubelle(argc, argv); gestion_signaux(); if (env[0]) s.env = copy_env(env); else s.env = creat_minimalist_env(); increment_shlvl(&s); s.line = ft_strnew(0); while (42) { ft_putstr("[\033[32mMinishell\033[33;0m] > "); run_minishell(&s); } free(s.line); return (0); }
t_ftsh *intialize_sh(int argc, char **argv, char **envp) { t_ftsh *sh; sh = NULL; sh = ft_memalloc(sizeof(t_ftsh)); if (sh) { sh->prompt = ft_strdup(PROMPT); if (!(sh->prompt)) return (NULL); sh->env_dup = ft_tabdup(envp); increment_shlvl(&(sh->env_dup)); sh->line = NULL; change_env_pwd(&(sh->env_dup)); if (sh->env_dup) sh->path_dir = extract_path_directories(sh->env_dup); sh->argc = argc; sh->argv = argv; } else return (NULL); return (sh); }