-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbulitin_env.c
More file actions
executable file
·44 lines (40 loc) · 1.41 KB
/
bulitin_env.c
File metadata and controls
executable file
·44 lines (40 loc) · 1.41 KB
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
42
43
44
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* bulitin_env.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hyeyeom <hyeyeom@42student.gyeongsan.kr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/23 20:27:35 by hyeyeom #+# #+# */
/* Updated: 2025/04/14 00:38:35 by hyeyeom ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
void print_env(t_envp *list)
{
while (list)
{
if (list->value)
{
if (ft_strlen(list->value) > 0)
{
write(STDOUT_FILENO, list->key, ft_strlen(list->key));
write(STDOUT_FILENO, "=", 1);
write(STDOUT_FILENO, list->value, ft_strlen(list->value));
write(STDOUT_FILENO, "\n", 1);
}
}
list = list->next;
}
}
int f_env(t_minish *sh, t_ready *rdy)
{
int size;
char **cmds;
cmds = rdy->cmd;
size = f_count_char(cmds);
if (size == 1)
print_env(sh->n_envs);
*f_exitcode() = 0;
return (0);
}