-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuiltin_export.c
More file actions
executable file
·32 lines (29 loc) · 1.26 KB
/
builtin_export.c
File metadata and controls
executable file
·32 lines (29 loc) · 1.26 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* builtin_export.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hyeyeom <hyeyeom@42student.gyeongsan.kr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/24 01:49:16 by hyeyeom #+# #+# */
/* Updated: 2025/04/14 00:38:35 by hyeyeom ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
int f_export(t_minish *sh, t_ready *rdy)
{
int size;
char **cmds;
char *original_cmd;
original_cmd = rdy->subsrc;
cmds = rdy->cmd;
size = f_count_char(cmds);
*f_exitcode() = 0;
if (size == 1)
print_export(sh->n_export);
else if (size > 1)
export_update_or_add(cmds, original_cmd, sh);
if (*f_exitcode() > 0)
return (*f_exitcode());
return (*f_exitcode());
}