-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_ft_lstnew.c
41 lines (38 loc) · 1.51 KB
/
test_ft_lstnew.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* test_ft_lstnew.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jliew <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/07/06 19:46:33 by jliew #+# #+# */
/* Updated: 2020/07/10 19:05:35 by jliew ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include <string.h>
#include "libft.h"
int main(int argc, char **argv)
{
t_list *list;
if (argc == 1)
{
printf("-------------------------------\n");
printf(" void ft_lstnew(void *content)\n");
printf("-------------------------------\n");
printf("usage [manual]:\n");
printf("1. a <string>/--null\n");
return (42);
}
if (!strcmp(argv[1], "--null"))
list = ft_lstnew(NULL);
else if (!(list = ft_lstnew(strdup(argv[1]))))
{
printf("Malloc failed.\n");
return (0);
}
printf("list->content: %s\n", list->content);
printf("list->next: %s\n", (char *)list->next);
ft_lstdelone(list, free);
printf("freed\n");
}