Line |
Branch |
Exec |
Source |
1 |
|
|
/* |
2 |
|
|
** EPITECH PROJECT, 2023 |
3 |
|
|
** my_params_to_list |
4 |
|
|
** File description: |
5 |
|
|
** Creates a linked list from the arguments (argc and argv) |
6 |
|
|
*/ |
7 |
|
|
|
8 |
|
|
#include "mylist.h" |
9 |
|
|
|
10 |
|
✗ |
linked_list_t *my_params_to_list(int ac, char *const *av) |
11 |
|
|
{ |
12 |
|
✗ |
linked_list_t *list = malloc(sizeof(linked_list_t)); |
13 |
|
|
|
14 |
|
✗ |
list->prev = NULL; |
15 |
|
✗ |
list->data = my_strdup(av[0]); |
16 |
|
✗ |
list->type = STRING; |
17 |
|
✗ |
list->next = NULL; |
18 |
|
✗ |
for (int arg = 1; arg < ac; arg++) |
19 |
|
✗ |
my_push_front(&list, my_strdup(av[arg]), STRING); |
20 |
|
✗ |
return list; |
21 |
|
|
} |
22 |
|
|
|