Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | ** EPITECH PROJECT, 2024 | ||
3 | ** 42sh | ||
4 | ** File description: | ||
5 | ** The file containing the env builtin | ||
6 | */ | ||
7 | /** | ||
8 | * @file env.c | ||
9 | * @brief The file containing the env builtin | ||
10 | */ | ||
11 | |||
12 | #include "../../include/myshell.h" | ||
13 | |||
14 | /** | ||
15 | * @brief The env builtin | ||
16 | * @note If there is no argument, it will display the environment, | ||
17 | * else it will execute the command with the environment | ||
18 | * @param mysh The shell structure | ||
19 | * @return <b>int</b> <u>0</u> if the command succeed, return the exit value | ||
20 | * of the env command if the command failed | ||
21 | */ | ||
22 | 16 | int exec_env(mysh_t *mysh) | |
23 | { | ||
24 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if (mysh->args[1] != NULL) { |
25 | ✗ | return exec_command(mysh); | |
26 | } | ||
27 | 16 | my_show_word_array(mysh->env); | |
28 | 16 | return 0; | |
29 | } | ||
30 |