-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.c
43 lines (40 loc) · 1.28 KB
/
list.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* list.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mfebvay <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/02/03 05:04:10 by mfebvay #+# #+# */
/* Updated: 2015/02/03 22:09:43 by mfebvay ### ########.fr */
/* */
/* ************************************************************************** */
#include <libft.h>
int make_list(t_list **list, int ac, char **av)
{
t_list *current;
t_list *new;
int i;
int val;
i = 0;
*list = NULL;
while(++i < ac)
{
if (strisint(av[i]))
val = ft_atoi(av[i]);
else
return (0);
new = ft_lstnew(&val, sizeof(int));
if (!(*list))
{
*list = new;
current = new;
}
else
{
current->next = new;
current = current->next;
}
}
return (1);
}