int builtin_unalias(t_info *info, t_tree *cmd) { char **tmp; if (!(tmp = cmd->cmd + 1)) { ft_fdprint(2, "unalias: not enough arguments"); exit(1); } while (tmp && *tmp) { remove_alias(info, *tmp); tmp++; } return (0); }
int builtin_setenv(t_info *info, t_tree *cmd) { int len; int stat; t_env *tmp; stat = 1; tmp = info->env; len = ft_tablen(cmd->cmd); if (len == 1) while (len == 1 && tmp) { ft_print("%s=%s\n", tmp->var, tmp->content); tmp = tmp->next; } else if (len <= 3) env_update_var(info, cmd->cmd[1], cmd->cmd[2]); else { ft_fdprint(2, "setenv: Too many arguments.\n"); stat = 0; } return (stat); }
int ft_print_err(int n, char *cmd) { if (n <= 0) ft_fdprint(2, "script: %s: No such file or directory\n", cmd); return (n >= 0 ? 1 : 0); }