blob: 650a4214a8e49b7d48b3d37727341423a0031870 (
plain)
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
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* export.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/04/01 17:11:34 by charles #+# #+# */
/* Updated: 2020/04/01 22:37:47 by charles ### ########.fr */
/* */
/* ************************************************************************** */
/*
** \file export.c
** \brief `export` builtin
*/
#include "minishell.h"
int builtin_export(char **argv, t_env env)
{
char *tmp;
if (ft_strchr(argv[1], '=') == NULL)
return (1);
if ((tmp = ft_strdup(argv[1])) == NULL)
return (2);
if (ft_vecpush(env, tmp) == NULL)
return (2); // internal error code
return (0);
}
|