int ft_vertex(char ** argv) { int **matrix; matrix = NULL; if (!(matrix = ft_read_file(argv[1], matrix))) { perror("Error: "); return (-1); } return (0); }
void ft_read_argv(char *argv, char **temp, int *n) { int fd; int ret; char *buf; buf = ft_memalloc(BUF_SIZE); *temp = ft_memalloc(BUF_SIZE); fd = open(argv, O_RDONLY); ret = read(fd, buf, BUF_SIZE); buf[ret] = '\0'; *temp = ft_strcpy(*temp, buf); *n = ft_read_file(ret, buf); }
int main(int argc, char **argv, char **env) { t_list *lenv; signal(SIGINT, SIG_IGN); lenv = ft_tab_to_list(env); if (argc > 1) { ft_read_file(&lenv, argv[1]); } else ft_shell(&lenv); return (0); }
static void ft_init_scene(char **cf, t_scene **scene) { int n; n = 0; *scene = (t_scene *)malloc(sizeof(t_scene)); if (ft_strcmp(cf[n], "alias on") == 0) { n++; (*scene)->nb_alias = ft_atoi(cf[n]); } else (*scene)->nb_alias = 0; ft_read_file(cf, *scene, &n); ft_read_file_spot(cf, *scene, &n); ft_read_cam(cf, *scene, &n); }
int main(int ac, char **av) { char **tab; t_copy tab2; if (ac == 1 && av[0]) { tab = ft_read_file(); if (tab[0][0]) { tab2 = ft_count(tab); ft_test(tab, tab2); } } else ft_error("No arguments needed"); write(1, "\n", 1); return (0); }
int main(int argc, char **argv) { t_mlx mx; if (argc == 2) { mx.map = ft_read_file(argv[1]); if (mx.map) { ft_init_mlx(&mx); lx_hook(mx.win, 3, 3, key_hook, &mx); mlx_expose_hook(mx.win, expose_hook, &mx); mlx_loop(mx.mlx); } else ft_error("Map Error.\n"); } else ft_error("Necessite un argument !\n"); return (0); }
int ft_select_env(char **argv, t_obj *obj) { int fd; obj->pos = -1; if (!argv[1]) { ft_putstr_fd("usage : ./rt file\n", 2); return (0); } if (argv[2]) { ft_putstr("only : "); ft_putstr(argv[1]); ft_putstr(" will be open\n"); } if ((fd = open(argv[1], O_RDONLY)) == -1) { ft_putstr("can't open file"); return (0); } ft_read_file(fd, obj); return (1); }