void ft_parse_room(t_lem *lem, char *line, int i) { char **room_data; room_data = ft_strsplit(line, ' '); if (!room_data[0] || !room_data[1] || !room_data[2]) { ft_free2d(room_data); free(line); ft_exit_lem(lem); } ft_parse_room_name(lem, room_data, i); ft_free2d(room_data); }
void ft_parse_room_name(t_lem *lem, char **tab, int i) { long long x; long long y; int fail; fail = 0; if (!ft_seek_name(lem, tab[0]) || ft_nbrchr(tab[0], '-') != 0) { ft_litle_check_xy(lem, tab); if (ft_int(x = ft_latoi(tab[1]))) { if (ft_int(y = ft_latoi(tab[2])) && ft_check_xy(lem->anthill, x, y)) ft_pushback_room(lem, tab, i); else fail = 1; } else fail = 1; } else fail = 1; if (fail) { ft_free2d(tab); ft_exit_lem(lem); } }
int ft_builtin2(t_env *env, char *line) { char **line2; int i; i = 0; line2 = NULL; line2 = ft_strsplit(line, ' '); line2[0] = ft_strtrim(line2[0]); if (ft_strncmp(line, "env", 2) == 0 && (i = 1)) print_env(env); else if (ft_strncmp(line, "setenv", 5) == 0 && (i = 1)) { line = ft_strtrim(line); line2 = ft_strsplit(line, ' '); env = set_env(line2, env); } else if (ft_isdigit(line[0]) == 1 && line[1] == '>' && line[2] == '&' && (i = 1)) ft_fdfuncs(line); ft_free2d(line2); return (i); }
int execute_pipe(char *str) { char **put_in_sst; char ***temp; if (str) { put_in_sst = put_in_ss(str); if (put_in_sst) { temp = put_in_sss(put_in_sst); if (temp) { loop_pipe(temp); freed(temp); } ft_free2d(put_in_sst); } return (1); } else put_str(ANSI_COLOR_RED"str passed to pipe is 'NULL'"ANSI_COLOR_RESET); return (0); }