int ft_read_second(int fd) { int y; char *tmp; char buf; y = 0; tmp = "\0"; while ((read(fd, &buf, 1)) && buf != '\n') { if ((buf != g_carac[0]) && (buf != g_carac[1])) return (0); tmp = ft_strcat(tmp, buf); g_x++; } tmp = ft_strcat(tmp, buf); if (!(ft_create_map())) return (0); g_map[y++] = tmp; while ((read(fd, g_map[y], g_x + 1)) && g_map[y]) y++; if (y != g_y) return (0); return (ft_check_map(y)); }
int main(int argc, char **argv) { char *line; if (argc != 3) { ft_badarg(); return (0); } else { ft_create_map(argv[1], argv[2]); ft_print_map(); while (42) { ft_putstr("Column number: "); if (get_next_line(0, &line) == 0) return (0); if (ft_putoken(argv[1], argv[2], line) == 1) return (0); ft_putendl("IA play"); if (get_next_line(0, &line) == 0) return (0); if (ft_putoken2(argv[1], argv[2], line) == 1) return (0); } } return (0); }