void parse_lvl(t_all *all, char *dir) { DIR *rp; struct dirent *fc; if ((rp = opendir(dir)) != NULL) { while ((fc = readdir(rp))) if (!ft_strequ(fc->d_name, ".") && !ft_strequ(fc->d_name, "..")) add_lvl(&all->lv, ft_strdup(fc->d_name)); if (closedir(rp) == -1) exit(-1); } }
int main(int ac, char **av, char **envp) { char *cmd; init_env(envp); add_lvl(); signal(SIGINT, sig_handler); while (g_running) { ft_putstr(hash_getset(&g_env, "MSP", "$> ", 4)->value); get_next_line(0, &cmd); exec_cmds(cmd); ft_memdel((void **)&cmd); } hash_del(&g_env, del_hash); (void)ac; (void)av; return (0); }