int check_builtins(t_cmd *cmds, char **env) { int cur_case; char **builtins; int found; int (*fptr[6])(t_cmd *, char ***); found = -1; cur_case = -1; if ((builtins = my_split(get_builtins(), ';')) == NULL) return (-1); fill_func_ptr(fptr); if (cmds->name != NULL) { while (builtins[++cur_case]) if (my_strncmp(builtins[cur_case], cmds->name, get_longest_string(builtins[cur_case], cmds->name)) == 0) { fptr[cur_case](cmds, &env); found = 1; } free_tab(builtins); } return (found); }
void free_builtins(void) { t_builtins *builtins; builtins = get_builtins(); ft_map_delete(*builtins, free_builtin_entry); free(builtins); }
t_builtin get_builtin(const char *command_name) { t_builtin builtin; builtin = (t_builtin)ft_map_get(*get_builtins(), (char *)command_name, (t_simple_hash_func)ft_djb2); return (builtin); }