int ft_createlst(int argc, char **argv) { t_1list *l_a; t_1list *tmp; t_1list *tmp2; int i; i = 1; l_a = (t_1list*)malloc(sizeof(t_1list) * ft_strlen(argv[i])); tmp = (t_1list*)malloc(sizeof(t_1list) * ft_strlen(argv[i])); tmp = l_a; tmp->data = atoi(argv[i]); tmp->next = NULL; i++; while (i < argc) { tmp2 = (t_1list*)malloc(sizeof(t_1list) * ft_strlen(argv[i])); tmp2->data = atoi(argv[i]); tmp2->next = NULL; tmp->next = tmp2; tmp = tmp->next; i++; } ft_pushswap(l_a); return (0); }
int main(int ac, char **av) { if (ac > 2) { if (check_arg(ac, av) == 0) return (0); ft_pushswap(ac, av); } return (0); }
int main(int ac, char **av) { int i; int v; t_list *la; t_list *lb; la = NULL; lb = NULL; i = 1; v = 0; if (ac == 1) return (ft_error(0)); if (ft_strcmp(av[1], "-v") == 0) v = 1; while (i < ac) { if (ft_check_num(av[i]) == 1) ft_fill(&la, ft_atoi(av[i])); i++; } ft_pushswap(la, lb, v); write (1, "\n", 1); }