示例#1
0
文件: main.c 项目: floklein/42
char	*ft_get_first_line(int fd, t_map *map_info)
{
	t_list	*root;
	t_list	*node;
	int		deep;

	root = NULL;
	deep = 0;
	ft_list_push_back(&root);
	node = root;
	while (read(fd, &(node->c), 1) > 0)
	{
		deep++;
		if (node->c == '\n')
			return ((deep == 1) ? NULL : ft_list_to_tab(root, deep));
		if (map_info)
			if (ft_strf(node->c, map_info->charset))
			{
				ft_destroy(root);
				return (NULL);
			}
		ft_list_push_back(&node);
		node = node->next;
	}
	return (NULL);
}
int		main(int argc, char **argv)
{
	int j;
	int i;
	int fd;
	int ret;
	t_list *list;
	char buf;
	//ssize_t read (int fd, void *buf, size_t count);
	i = 1;
	while(i < argc)
	{
		fd = open(argv[i], O_RDONLY);
		if (fd == -1)
		{
			ft_putstr("open (): failed, try again!");
		}
		while (read(fd, &buf, BUF_SIZE))
		{
			ft_list_push_back(&list, buf);
		}
		ft_print_list(list);
		if (close(fd) == -1)
		{
			ft_putstr("close (): failed, try again!");
			return (1);
		}
		i++;
	}
	return (0);
}
示例#3
0
void				ft_check_camera(t_scene *s, char *line, t_data *d)
{
	int				i;
	t_object		*cam;

	if (!ft_strncmp(line, "CAMERA", 6))
	{
		i = 6;
		if (!(cam = (t_object *)malloc(sizeof(t_object))))
			exit(ft_error("Could not allocate camera !\n"));
		if (ft_strc(line, 'p'))
		{
			cam->p = ft_get_next_point(line, &i);
			ft_ajust_camera_position(cam);
		}
		if (ft_strc(line, 'n'))
			cam->n = ft_get_next_point(line, &i);
		if (ft_strc(line, 'u'))
			cam->up = ft_get_next_point(line, &i);
		ft_get_n_vector(cam->n, &cam->n, 0);
		cam->p.z = cam->p.z == 0.0 ? 0.1 : cam->p.z;
		ft_get_cam_viewplane(cam, s, d->wx, d->wy);
		ft_list_push_back(s->cams, cam);
	}
}
示例#4
0
文件: input.c 项目: marcobooth/fdf
static int	set_next_line(t_list **list, int fd, int *width)
{
	int		checker;
	char	**split;
	int		*inter;
	int		counter;
	char	*line;

	if (((checker = get_next_line(fd, &line)) >= 0))
	{
		split = ft_strsplit(line, ' ');
		if ((!find_split_length(split)) && checker == 1)
			fdf_error("File Contains Empty Line");
		if (!find_split_length(split))
		{
			dbl_free(split, line);
			return (checker);
		}
		*width = find_split_length(split);
		inter = (int*)malloc(sizeof(int) * *(width));
		counter = *(width);
		while (counter-- > 0)
			inter[counter] = ft_atoi(split[counter]);
		ft_list_push_back(&*(list), inter);
		dbl_free(split, line);
	}
	return (checker);
}
示例#5
0
static void	ft_read_file(char **cf, t_scene *scene, int *n)
{
	t_read	tab_read[4];
	t_obj	*obj;
	t_list	*object;

	object = NULL;
	scene->intersection = NULL;
	scene->object = NULL;
	ft_init_tab_read(tab_read);
	while (cf[*n] != NULL)
	{
		if (*n != 0)
			*n = *n + 1;
		if (scene->nb_alias == 1 && *n == 1)
			*n = *n + 1;
		if (ft_strcmp(cf[*n], "#endobj") == 0)
		{
			ft_end_obj(object, &scene->object, tab_read);
			return ;
		}
		ft_s_inter(&scene->intersection, &object, cf[*n], n);
		ft_ch_in_tab(tab_read, &obj, cf, n);
		ft_list_push_back(&object, obj);
	}
	ft_end_obj(object, &scene->object, tab_read);
}
示例#6
0
void		ft_list_push_back(t_list **begin_list, void *data)
{
	if (!*begin_list)
		*begin_list = ft_create_elem(data);
	else if (!((*begin_list)->next))
		(*begin_list)->next = ft_create_elem(data);
	else
		ft_list_push_back(&((*begin_list)->next), data);
}
t_list	*ft_list_push_params(int ac, char **av)
{
	t_list *list;

	list = ft_create_elem(av[--ac]);
	while (ac)
		ft_list_push_back(&list, av[--ac]);
	return (list);
}
示例#8
0
int		main(void)
{
		t_list	*list;
		int		a;
		int		b;
		int		c;

		a = 10;
		b = 20;
		c = 30;
		ft_list_push_back(&list, &a);
		ft_list_push_back(&list, &b);
		ft_list_push_back(&list, &c);
		ft_putnbr(*((int*)list->data));
		ft_putchar('\n');
		ft_putnbr(*((int*)ft_list_last(list)->data));
		ft_putchar('\n');
		return (0);
}
void	ft_s_inter(t_list **inter, t_list **object, char *str, int *n)
{
	if (ft_strcmp(str, "!obj inter") == 0)
	{
		ft_fill_sphere_glob(object);
		ft_list_push_back(inter, *object);
		*object = NULL;
		*n = *n + 1;
	}
}
示例#10
0
文件: first_line.c 项目: nipal/bsq
void	get_first_line(t_list **line, int fd)
{
	int		oct_lu;
	char	*c;

	*line = 0;
	c = (char*)malloc(sizeof(char) * 2);
	c[1] = 0;
	oct_lu = read(fd, c, 1);
	if (oct_lu)
		ft_list_push_back(line, c);
	while (oct_lu == 1 && *c != '\n')
	{
		c = (char*)malloc(sizeof(char));
		oct_lu = read(fd, c, 1);
		if (oct_lu && *c != '\n')
			ft_list_push_back(line, c);
		param(SIZE_X, oct_lu);
	}
}
示例#11
0
void		ft_list_push_back_once(t_list **begin_list, void *data)
{
	if (!*begin_list)
		*begin_list = ft_create_elem(data);
	else if (local_strcmp((*begin_list)->data, data))
		return ;
	else if (!((*begin_list)->next))
		(*begin_list)->next = ft_create_elem(data);
	else
		ft_list_push_back(&((*begin_list)->next), data);
}
示例#12
0
void	ft_list_push_back(t_list **begin_list, void *data)
{
	if ((*begin_list) == NULL)
		(*begin_list) = ft_create_elem(data);
	else if ((*begin_list)->next == NULL)
		(*begin_list)->next = ft_create_elem(data);
	else
	{
		ft_list_push_back(&((*begin_list)->next), data);
	}
}
示例#13
0
t_list		*ft_list_push_params(int ac, char **av)
{
	t_list *l;

	l = 0;
	while (ac > 1)
	{
		ft_list_push_back(&l, av[ac - 1]);
		ac--;
	}
	return (l);
}
示例#14
0
int		main(void)
{
		t_list	*list1;
		t_list	*list2;
		char	*s1 = "unu";
		char	*s2 = "doi";
		char	*s3 = "trei";
		char	*s4 = "patru";
		char	*s5 = "cinci";
		char	*s6 = "sase";

		list1 = NULL;
		list2 = NULL;
		ft_list_push_back(&list1, s1);
		ft_list_push_back(&list1, s2);
		ft_list_push_back(&list1, s3);
		ft_list_push_back(&list2, s4);
		ft_list_push_back(&list2, s5);
		ft_list_push_back(&list2, s6);
		ft_putstr("List 1:\n");
		ft_print_list(list1);
		ft_putstr("List 2:\n");
		ft_print_list(list2);
		ft_list_merge(&list1, &list2);
		ft_putstr("List 1 + 2:\n");
		ft_print_list(list1);
		ft_putstr("Dim 1:\n");
		ft_putnbr(ft_list_size(list1));
		ft_putchar('\n');
		ft_putstr("Dim 2:\n");
		ft_putnbr(ft_list_size(list2));
		ft_putchar('\n');
		return (0);
}
示例#15
0
void				read_through_directory(char *folder_name
											, t_list **directory_list
											, t_list **screw_ups)
{
	DIR				*opened;

	opened = opendir(folder_name);
	ft_list_push_back(directory_list, read_directory(opened));
	if (opened)
		closedir(opened);
	else
		directory_open_failed(folder_name, screw_ups);
}
示例#16
0
文件: ft_lstmap.c 项目: TPelago/42
t_list			*ft_lstmap(t_list *lst, t_list *(*f)(t_list *elem))
{
	t_list		*new_list;
	t_list		*elem;

	new_list = NULL;
	while (lst)
	{
		elem = f(lst);
		ft_list_push_back(&new_list, elem);
		lst = lst->next;
	}
	return (new_list);
}
示例#17
0
t_list				*ft_lstmap(t_list *lst, t_list *(*f)(t_list *elem))
{
	t_list			*list;

	list = NULL;
	if (lst == NULL || f == NULL)
		return (NULL);
	while (lst != NULL)
	{
		ft_list_push_back(&list, f(lst));
		lst = lst->next;
	}
	return (list);
}
示例#18
0
文件: cd.c 项目: 42rdavid/42sh
static int				ft_end_pwd(t_list *envi, char *tmp4, char *tmp3)
{
	t_elem				*elem;

	if (ft_replace_line(envi, "PWD", tmp4) == 0)
	{
		if (!(elem = ft_list_create_elem(TYPE_DATA)))
			return (0);
		free(elem->data);
		elem->data = tmp4;
		if (!ft_list_push_back(envi, elem))
			return (0);
	}
	if (ft_replace_line(envi, "OLDPWD", tmp3) == 0)
	{
		if (!(elem = ft_list_create_elem(TYPE_DATA)))
			return (0);
		free(elem->data);
		elem->data = tmp3;
		if (!ft_list_push_back(envi, elem))
			return (0);
	}
	return (1);
}
示例#19
0
文件: test.c 项目: jpirsch/piscines
t_list	*ft_list_push_params(int ac, char **av)
{
	t_list *list;
	int i;

	list = ft_create_elem(&av);
	i = 1;
	while (i < ac);
	{
		list = ft_list_push_back(&list, av++);
		ft_putstr((char *)list->data);
		list = list->next;
		i++;
	}

	return (list);
}
示例#20
0
char	*ft_read_standard(void)
{
	t_list	*list;
	int		pos;
	int		len;
	char	buff[129];

	len = 0;
	while ((pos = read(0, buff, 128)))
	{
		buff[pos] = '\0';
		len += pos + 1;
		if (list == NULL)
			list = ft_create_elem(buff);
		else
			ft_list_push_back(&list, buff);
	}
	return (ft_ltos(len, list));
}
示例#21
0
文件: test.c 项目: jpirsch/piscines
int		main(void)
{
	t_list *list;
	char a;
	char *b;
	char c;
	char *d;

	a = 'Z';
	c = 'y';
	list = ft_create_elem(&a);
	b = (char *)list->data;
	ft_putchar(*b);
	ft_list_push_back(&list, &c);
	while (list->next)
		list = list->next;
	d = (char *)list->data;
	ft_putchar(*d);
	return (0);
}
示例#22
0
int		main(void)
{
	t_list	*list;
	char	c;
	int		width;
	int		height;
	int		*solution;

	list = 0;
	solution = (int*)(malloc(sizeof(int) * (5)));
	while (read(0, &c, 1))
		ft_list_push_back(&list, c);
	if ((dimensions(list, &height, &width)) == 0 || width == 0)
		ft_putstr("Error 404 ./rush-0X not found... idiot!\n");
	else
	{
		solution = rush_loop(solution, list, height, width);
		print_results(solution, width, height);
	}
	ft_list_clear(&list);
	free(solution);
	return (0);
}
示例#23
0
void	ft_printf_hexa(const char *format, t_env1 *env1, t_env2 *env2)
{
	unsigned long	res_arg;
	char			*c;
	t_lst			*free_lst;

	c = ft_strdup("0x");
	if (format[env1->taille_f] == 'X')
		c[1] = 'X';
	res_arg = env2->argument1;
	ft_calc_hexa(format, env1, env2);
	env2->str = ft_strdup("\0");
	free_lst = env2->tmp1;
	while (env2->tmp1)
	{
		env2->str = ft_strjoin_free(env2->str, env2->str, env2->tmp1->str);
		env2->tmp1 = env2->tmp1->next;
	}
	ft_free_list(free_lst);
	foret_if_hexa(env2, res_arg, c);
	ft_list_push_back(&env1->list, env2->str);
	ft_memdel((void **)&env2->str);
	ft_memdel((void **)&c);
}
示例#24
0
char	*ft_openfile(char *filename)
{
	t_list	*list;
	int		fh;
	char	buff[4097];
	int		pos;
	int		len;

	len = 0;
	if ((fh = open(filename, O_RDONLY)) < 0)
		return (NULL);
	while ((pos = read(fh, &buff, 4096)))
	{
		buff[pos] = '\0';
		ft_putstr(buff);
		len += pos + 1;
		if (list == NULL)
			list = ft_create_elem(buff);
		else
			ft_list_push_back(&list, buff);
	}
	close(fh);
	return (ft_ltos(len, list));
}
示例#25
0
int		main(void)
{
	char	*exname;
	int		exnb = 0;
	t_list	*link;
	t_list	*base;

	(void)link;
	base = ft_create_elem("ABC");
	base->next = ft_create_elem("012");
	base->next->next = ft_create_elem("xyz");
	start_day(11);
#ifdef ex00
	exname = "ft_create_elem";
	start_exo(exnb);

	link = ft_create_elem("A");
	link->next = ft_create_elem("B");
	ft_print_list(link);
	printf("expected:\n");
	printf("[ A ] -> [ B ] -> NULL\n");
#endif

	exnb++;
#ifdef ex01
	exname = "ft_list_push_back";
	start_exo(exnb);
	ft_warning1();
	link = NULL;
	ft_list_push_back(&link, "A");
	ft_list_push_back(&link, "B");
	ft_list_push_back(&link, "C");
	ft_print_list(link);
	printf("expected:\n");
	printf("[ A ] -> [ B ] -> [ C ] -> NULL\n");
#endif

	exnb++;
#ifdef ex02
	exname = "ft_list_push_front";
	start_exo(exnb);
	ft_warning1();
	link = NULL;
	ft_list_push_front(&link, "C");
	ft_list_push_front(&link, "B");
	ft_list_push_front(&link, "A");
	ft_print_list(link);
	printf("expected:\n");
	printf("[ A ] -> [ B ] -> [ C ] -> NULL\n");
#endif

	exnb++;
#ifdef ex03
	start_exo(exnb);
	exname = "ft_list_size";
	ft_warning1();
	printf("list : ");
	ft_print_list(base);
	printf("%s = %i\n", exname, ft_list_size(base));
	printf("\nlist : ");
	ft_print_list(NULL);
	printf("%s = %i\n", exname, ft_list_size(NULL));
#endif

	exnb++;
#ifdef ex04
	start_exo(exnb);
	exname = "ft_list_last";
	ft_warning1();

	printf("list : ");
	ft_print_list(base);
	printf("%s = ", exname);
	ft_print_list(ft_list_last(base));

	printf("\nlist : ");
	ft_print_list(NULL);
	printf("%s = ", exname);
	ft_print_list(ft_list_last(NULL));
#endif

	exnb++;
#ifdef ex05
	start_exo(exnb);
	exname = "ft_list_push_params";
	printf("pas encore de suite de tests pour cet exercice :(\n");
#endif

	exnb++;
#ifdef ex06
	start_exo(exnb);
	exname = "ft_list_clear";

	printf("%s\n", exname);
	printf("avant : ");
	ft_print_list(base);
	ft_list_clear(&base);
	printf("apres : ");
	ft_print_list(base);
	base = ft_create_elem("ABC");
	base->next = ft_create_elem("012");
	base->next->next = ft_create_elem("xyz");
#endif

	exnb++;
#ifdef ex07
	start_exo(exnb);
	exname = "ft_list_at";
	ft_warning1();

	printf("list : ");
	ft_print_list(base);
	printf("%s(list, 0) = ", exname);
	ft_print_list(ft_list_at(base, 0));

	printf("\nlist : ");
	ft_print_list(base);
	printf("%s(list, 1) = ", exname);
	ft_print_list(ft_list_at(base, 1));

	printf("\n%s(NULL, 0) = ", exname);
	ft_print_list(ft_list_at(NULL, 0));

	printf("\n%s(NULL, 1) = ", exname);
	ft_print_list(ft_list_at(NULL, 1));
#endif

	exnb++;
#ifdef ex08
	start_exo(exnb);
	exname = "ft_list_reverse";

	printf("%s\n", exname);
	printf("avant : ");
	ft_print_list(base);
	ft_list_reverse(&base);
	printf("apres : ");
	ft_print_list(base);
#endif


	exnb++;
#ifdef ex09
	start_exo(exnb);
	exname = "ft_list_foreach";
	base = ft_create_elem("012");
	base->next = ft_create_elem("ABC");
	base->next->next = ft_create_elem("xyz");

	printf("%s, avec la fonction ft_putstr()\n", exname);
	printf("list : ");
	ft_print_list(base);
	printf("%s : ", exname);
	fflush(stdout);
	ft_list_foreach(base, &corr_ft_putstr);
#endif

	exnb++;
#ifdef ex10
	start_exo(exnb);
	exname = "ft_list_foreach_if";

	printf("list : ");
	ft_print_list(base);
	printf("%s(list, &ft_putstr, '012', &strcmp) = ", exname);
	fflush(stdout);
	ft_list_foreach_if(base, &corr_ft_putstr, "012", &strcmp);
	printf(" (012 attendu)");
#endif

	exnb++;
#ifdef ex11
	start_exo(exnb);
	exname = "ft_list_find";
	base = ft_create_elem("012");
	base->next = ft_create_elem("ABC");
	base->next->next = ft_create_elem("xyz");

	printf("list : ");
	ft_print_list(base);
	printf("%s(list, 'ABC', &strcmp) = ", exname);
	fflush(stdout);
	ft_print_list(ft_list_find(base, "ABC", &strcmp));
#endif

	exnb++;
#ifdef ex12
	start_exo(exnb);
	exname = "ft_list_remove_if";
	base = ft_create_elem("012");
	base->next = ft_create_elem("ABC");
	base->next->next = ft_create_elem("xyz");

	printf("list : ");
	ft_print_list(base);
	printf("%s(list, 'ABC', &strcmp) = ", exname);
	fflush(stdout);
	ft_list_remove_if(&base, "ABC", &strcmp);
	ft_print_list(base);
#endif

t_list	*list1;
t_list	*list2;
	
	(void)list1;
	(void)list2;
	exnb++;
#ifdef ex13
	start_exo(exnb);
	exname = "ft_list_merge";
	ft_warning1();

	list1 = NULL;
	list2 = NULL;
	printf("list1 : ");
	fflush(stdout);
	ft_print_list(list1);
	printf("list2 : ");
	fflush(stdout);
	ft_print_list(list2);
	ft_list_merge(&list1, list2);
	printf("merge : ");
	fflush(stdout);
	ft_print_list(list1);
	printf("\n");

	list1 = NULL;
	list2 = ft_create_elem("012");
	printf("list1 : ");
	fflush(stdout);
	ft_print_list(list1);
	printf("list2 : ");
	fflush(stdout);
	ft_print_list(list2);
	ft_list_merge(&list1, list2);
	printf("merge : ");
	fflush(stdout);
	ft_print_list(list1);
	printf("\n");

	list1 = ft_create_elem("012");
	list2 = NULL;
	printf("list1 : ");
	fflush(stdout);
	ft_print_list(list1);
	printf("list2 : ");
	fflush(stdout);
	ft_print_list(list2);
	ft_list_merge(&list1, list2);
	printf("merge : ");
	fflush(stdout);
	ft_print_list(list1);
	printf("\n");

	list1 = ft_create_elem("012");
	list1->next = ft_create_elem("345");
	list2 = ft_create_elem("abc");
	list2->next = ft_create_elem("def");
	printf("list1 : ");
	fflush(stdout);
	ft_print_list(list1);
	printf("list2 : ");
	fflush(stdout);
	ft_print_list(list2);
	ft_list_merge(&list1, list2);
	printf("merge : ");
	fflush(stdout);
	ft_print_list(list1);
#endif

	exnb++;
#ifdef ex14
	start_exo(exnb);
	exname = "ft_list_sort";
	printf("%s\n", exname);
	ft_warning1();

	base = NULL;
	printf("avant : ");
	fflush(stdout);
	ft_print_list(base);
	ft_list_sort(&base, &strcmp);
	printf("apres : ");
	fflush(stdout);
	ft_print_list(base);
	printf("\n");

	base = ft_create_elem("3");
	base->next = ft_create_elem("1");
	base->next->next = ft_create_elem("2");
	printf("avant : ");
	fflush(stdout);
	ft_print_list(base);
	ft_list_sort(&base, &strcmp);
	printf("apres : ");
	fflush(stdout);
	ft_print_list(base);
#endif

	exnb++;
#ifdef ex15
	start_exo(exnb);
	exname = "ft_list_reverse_fun";

	base = NULL;
	printf("%s\n", exname);
	printf("avant : ");
	ft_print_list(base);
	ft_list_reverse_fun(base);
	printf("apres : ");
	ft_print_list(base);
	printf("\n");

	base = ft_create_elem("1");
	base->next = ft_create_elem("2");
	base->next->next = ft_create_elem("3");
	printf("avant : ");
	ft_print_list(base);
	ft_list_reverse_fun(base);
	printf("apres : ");
	ft_print_list(base);
	printf("\n");

	base = ft_create_elem("1");
	base->next = ft_create_elem("2");
	base->next->next = ft_create_elem("3");
	base->next->next->next = ft_create_elem("4");
	printf("avant : ");
	ft_print_list(base);
	ft_list_reverse_fun(base);
	printf("apres : ");
	ft_print_list(base);
#endif

	exnb++;
#ifdef ex16
	start_exo(exnb);
	exname = "ft_sorted_list_insert";
	printf("%s\n", exname);
	ft_warning1();

	base = ft_create_elem("2");
	base->next = ft_create_elem("3");
	base->next->next = ft_create_elem("5");
	printf("avant : ");
	fflush(stdout);
	ft_print_list(base);
	ft_sorted_list_insert(&base, "7", &strcmp);
	printf("apres : ");
	fflush(stdout);
	ft_print_list(base);

	base = NULL;
	printf("\navant : ");
	fflush(stdout);
	ft_print_list(base);
	ft_sorted_list_insert(&base, "0", &strcmp);
	printf("apres : ");
	fflush(stdout);
	ft_print_list(base);

#endif

	exnb++;
#ifdef ex17
	start_exo(exnb);
	exname = "ft_sorted_list_merge";
	printf("%s\n", exname);
	ft_warning1();

	list1 = NULL;
	list2 = NULL;
	printf("list1 : ");
	fflush(stdout);
	ft_print_list(list1);
	printf("list2 : ");
	fflush(stdout);
	ft_print_list(list2);
	ft_sorted_list_merge(&list1, list2, &strcmp);
	printf("merge : ");
	fflush(stdout);
	ft_print_list(list1);
	printf("\n");

	list1 = NULL;
	list2 = ft_create_elem("0");
	printf("list1 : ");
	fflush(stdout);
	ft_print_list(list1);
	printf("list2 : ");
	fflush(stdout);
	ft_print_list(list2);
	ft_sorted_list_merge(&list1, list2, &strcmp);
	printf("merge : ");
	fflush(stdout);
	ft_print_list(list1);
	printf("\n");

	list1 = ft_create_elem("0");
	list2 = NULL;
	printf("list1 : ");
	fflush(stdout);
	ft_print_list(list1);
	printf("list2 : ");
	fflush(stdout);
	ft_print_list(list2);
	ft_sorted_list_merge(&list1, list2, &strcmp);
	printf("merge : ");
	fflush(stdout);
	ft_print_list(list1);
	printf("\n");

	list1 = ft_create_elem("0");
	list1->next = ft_create_elem("2");
	list2 = ft_create_elem("1");
	list2->next = ft_create_elem("3");
	printf("list1 : ");
	fflush(stdout);
	ft_print_list(list1);
	printf("list2 : ");
	fflush(stdout);
	ft_print_list(list2);
	ft_sorted_list_merge(&list1, list2, &strcmp);
	printf("merge : ");
	fflush(stdout);
	ft_print_list(list1);
#endif
}
int		main(int ac, char **av)
{
    t_str	str1, str2;
    int		k, i, j;
    t_list	*tmp;

    k = 0;
    while (k < (ac == 1 ? K_MAX : ac - 1))
        switch (ac == 1 ? k++ : atoi(av[++k]))
        {
        case 0 :
            if (k + 1 < ac)
                str1 = av[++k];
            else
                str1 = strdup("Foo Bar Baz");
            printf("Ex 00 : expected [| %s |] :\t%s", str1, GREEN);
            ft_print_list_str(ft_create_elem(str1));
            printf("%s\n", END);
            break ;
        case 1 :
            if (k + 1 < ac)
                str1 = av[++k];
            else
                str1 = strdup("Hello");
            if (k + 1 < ac)
                str2 = av[++k];
            else
                str2 = strdup("World");
            tmp = ft_create_elem(str1);
            printf("Ex 01 :\n\t- expected [| %s ; %s ; %s |] (normal push back)\n\t\t%s", str1, str2, str2, GREEN);
            ft_list_push_back(&tmp, str2);
            ft_list_push_back(&tmp, str2);
            ft_print_list_str(tmp);
            printf("%s\t- expected [| %s ; %s |] (push back on an empty list)\n\t\t%s", END, str1, str2, GREEN);
            tmp = NULL;
            ft_list_push_back(&tmp, str1);
            ft_list_push_back(&tmp, str2);
            ft_print_list_str(tmp);
            printf("%s\n", END);
            break ;
        case 2 :
            if (k + 1 < ac)
                str1 = av[++k];
            else
                str1 = strdup("Caesar");
            if (k + 1 < ac)
                str2 = av[++k];
            else
                str2 = strdup("Ave");
            tmp = ft_create_elem(str1);
            printf("Ex 02 :\n\t- expected [| %s ; %s ; %s |] (normal front back)\n\t\t%s", str1, str2, str2, GREEN);
            ft_list_push_front(&tmp, str2);
            ft_list_push_front(&tmp, str2);
            ft_print_list_str(tmp);
            printf("%s\t- expected [| %s ; %s |] (push front on an empty list)\n\t\t%s", END, str1, str2, GREEN);
            tmp = NULL;
            ft_list_push_front(&tmp, str1);
            ft_list_push_front(&tmp, str2);
            ft_print_list_str(tmp);
            printf("%s\n", END);
            break ;
        case 3 :
            if (k + 1 < ac)
            {
                i = atoi(av[++k]);
                i *= (i < 0 ? -1 : 1);
            }
            else
                i = 13;
            j = -1;
            tmp = NULL;
            str1 = strdup("Tralala");
            while (++j < i)
                ft_list_push_front(&tmp, str1);
            j = ft_list_size(tmp);
            if (j == i)
                printf("%s[Ex03 OK]%s\t(tested on a list of %i elements)\n", GREEN, END, i);
            else
                printf("%s>>>[Ex03 FAIL]<<<%s\t(a list of %i elements is not %i element long)\n", RED, END, i, j);
            break ;
        case 4 :
            str1 = strdup("\e[1;31m>>>[Ex04 FAIL]<<<\e[0;0m");
            str2 = strdup("\e[1;32m[Ex04 OK]\e[0;0m");
            tmp = NULL;
            i = -1;
            ft_list_push_front(&tmp, str2);
            while (++i < 50)
                ft_list_push_front(&tmp, str1);
            printf("%s\t(tested on a list of 50 elements)\n", (char*)ft_list_last(tmp)->data);
            break ;
        case 5 :
            printf("Ex05 : You should the the arguments you passed ina reversed order :\n\t%s", GREEN);
            ft_print_list_str(ft_list_push_params(ac, av));
            printf("%s\n", END);
            break ;
        }
}