From 65006d0c14d3efa647b3c866ab54bdb1749fa31d Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Sat, 12 Sep 2020 17:12:41 +0200 Subject: Added concurrent pipeline (not working with minishell_test for some obscure reason) --- src/builtin/export.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/builtin/export.c') diff --git a/src/builtin/export.c b/src/builtin/export.c index e19756d..d394af6 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/08/28 17:49:47 by charles ### ########.fr */ +/* Updated: 2020/09/12 11:06:47 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -21,16 +21,20 @@ static void st_put_declare_x(char *s) { char *equal_ptr; - // could use errorf on stdout if (s == NULL) return ; - ft_putstr("declare -x "); + ft_putstr("export "); if ((equal_ptr = ft_strchr(s, '=')) == NULL) equal_ptr = ft_strchr(s, '\0'); write(STDOUT_FILENO, s, equal_ptr - s); ft_putchar('='); ft_putchar('"'); - ft_putstr(equal_ptr + 1); + while (*++equal_ptr != '\0') + { + if (*equal_ptr == '"') + ft_putchar('\\'); + ft_putchar(*equal_ptr); + } ft_putchar('"'); ft_putchar('\n'); } @@ -38,7 +42,7 @@ static void st_put_declare_x(char *s) int builtin_export(char **argv, t_env env) { int status; - size_t i; + size_t i; char *equal_ptr; if (argv[1] == NULL) @@ -62,7 +66,7 @@ int builtin_export(char **argv, t_env env) continue; } if (env_export(env, argv[i], equal_ptr == NULL ? "" : equal_ptr + 1) == NULL) - return (127); // malloc error + return (EVAL_FATAL); } return (status); } -- cgit