-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuiltin_env.c
32 lines (30 loc) · 1.26 KB
/
builtin_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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* builtin_env.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: marlean <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/04 10:53:59 by hcolumbu #+# #+# */
/* Updated: 2022/06/17 13:51:23 by marlean ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
int builtin_env(t_envp *envp_list)
{
if (!envp_list)
return (1);
if (var_position_in_envp(envp_list, "PATH") == -1)
{
ft_putendl_fd("Myshell 🐚: env: No such file or directory", 2);
return (127);
}
while (envp_list)
{
ft_putstr_fd(envp_list->key, 1);
ft_putchar_fd('=', 1);
ft_putendl_fd(envp_list->value, 1);
envp_list = envp_list->next;
}
return (0);
}