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 | * @file my_params_to_list.c | ||
9 | * @brief The file containing the my_params_to_list function | ||
10 | * @author Nicolas TORO | ||
11 | */ | ||
12 | |||
13 | #include "mylist.h" | ||
14 | |||
15 | 2 | node_t *my_params_to_list(int ac, char *const *av) | |
16 | { | ||
17 | 2 | node_t *list = malloc(sizeof(node_t)); | |
18 | |||
19 | 2 | list->prev = NULL; | |
20 | 2 | list->data = my_strdup(av[0]); | |
21 | 2 | list->type = STRING; | |
22 | 2 | list->next = NULL; | |
23 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 2 times.
|
8 | for (int arg = 1; arg < ac; arg++) |
24 | 6 | my_push_front(&list, my_strdup(av[arg]), STRING); | |
25 | 2 | return list; | |
26 | } | ||
27 |