From f66cb8f28a2779159baeef6ea91a7684d59cc295 Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 1 Apr 2020 23:16:47 +0200 Subject: Changed representation of environment to vector --- src/builtin/export.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/builtin/export.c') diff --git a/src/builtin/export.c b/src/builtin/export.c index 8a62412..650a421 100644 --- a/src/builtin/export.c +++ b/src/builtin/export.c @@ -6,7 +6,7 @@ /* By: charles +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/01 17:11:34 by charles #+# #+# */ -/* Updated: 2020/04/01 17:11:38 by charles ### ########.fr */ +/* Updated: 2020/04/01 22:37:47 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,7 +19,13 @@ int builtin_export(char **argv, t_env env) { - (void)argv; - (void)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); } -- cgit