-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenv.c
41 lines (37 loc) · 1.25 KB
/
env.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* env.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: brenaudo <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/05 10:48:10 by brenaudo #+# #+# */
/* Updated: 2023/01/05 14:12:59 by zhabri ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
static void env_no_arg(int fd_out)
{
int i;
char **envp;
envp = envp_list_to_tab();
i = 0;
while (envp[i])
{
if (ft_strchr(envp[i], '='))
{
ft_putstr_fd(envp[i], fd_out);
ft_putchar_fd('\n', fd_out);
}
i++;
}
free_tab(envp);
}
void env(char *cmd, int fd_out)
{
(void)cmd;
env_no_arg(fd_out);
close(fd_out);
clean_exit(NULL);
exit(0);
}