-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_ft_lstadd_back.c
50 lines (46 loc) · 1.62 KB
/
test_ft_lstadd_back.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
44
45
46
47
48
49
50
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* test_ft_lstadd_back.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jliew <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/06 19:46:33 by jliew #+# #+# */
/* Updated: 2020/07/09 23:19:41 by jliew ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <string.h>
#include "libft.h"
void print_list(t_list *list)
{
while (list)
{
printf("[%s]", list->content);
printf("%s", ((list->next) ? " -> " : "\n"));
list = list->next;
}
}
int main(int argc, char **argv)
{
int i;
t_list *list;
if (argc == 1)
{
printf("-------------------------------------------------\n");
printf(" void ft_lstadd_back(t_list **lst, t_list *new)\n");
printf("-------------------------------------------------\n");
printf("usage [manual]:\n");
printf("1. a --list <. . .>\n");
return (42);
}
else if (!strcmp(argv[1], "--list"))
{
list = NULL;
i = 2;
while (i < argc)
ft_lstadd_back(&list, ft_lstnew(strdup(argv[i++])));
print_list(list);
ft_lstclear(&list, free);
}
}