merge
This commit is contained in:
commit
66ec5363ca
2 changed files with 9 additions and 9 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/15 11:39:37 by gwojda #+# #+# */
|
/* Created: 2017/02/15 11:39:37 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/24 15:11:48 by jhalford ### ########.fr */
|
/* Updated: 2017/03/24 19:33:00 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -41,25 +41,25 @@ int builtin_export(
|
||||||
char *equal;
|
char *equal;
|
||||||
t_btexport data;
|
t_btexport data;
|
||||||
|
|
||||||
(void)envp;
|
|
||||||
(void)path;
|
(void)path;
|
||||||
data.flag = 0;
|
data.flag = 0;
|
||||||
if (cliopts_get((char**)av, g_export_opts, &data))
|
if (cliopts_get((char**)av, g_export_opts, &data))
|
||||||
ft_perror("export");
|
return (ft_perror("export") ? 1 : 1);
|
||||||
if (data.flag & BT_EXPORT_LP)
|
if (data.flag & BT_EXPORT_LP)
|
||||||
return (bt_export_print());
|
return (bt_export_print());
|
||||||
av = data.av_data;
|
av = data.av_data;
|
||||||
|
if (!(data.flag = 0) && !*av)
|
||||||
|
bt_export_print();
|
||||||
while (*av)
|
while (*av)
|
||||||
{
|
{
|
||||||
equal = ft_strchr(*av, '=');
|
equal = ft_strchr(*av, '=');
|
||||||
if (equal)
|
if (equal)
|
||||||
*equal = 0;
|
*(equal++) = 0;
|
||||||
else
|
else
|
||||||
equal = ft_getenv(data_singleton()->local_var, *av);
|
equal = ft_getenv(data_singleton()->local_var, *av);
|
||||||
equal ? equal++ : equal;
|
data.flag += builtin_setenv("internal", (char*[]){"export", *av, equal}, envp);
|
||||||
builtin_setenv("internal", (char*[]){"export", *av, equal}, NULL);
|
|
||||||
builtin_unsetenv("internal", (char*[]){"local", *av, NULL}, NULL);
|
builtin_unsetenv("internal", (char*[]){"local", *av, NULL}, NULL);
|
||||||
av++;
|
av++;
|
||||||
}
|
}
|
||||||
return (0);
|
return (data.flag ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,13 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/28 14:25:17 by jhalford #+# #+# */
|
/* Created: 2016/11/28 14:25:17 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/24 23:10:27 by jhalford ### ########.fr */
|
/* Updated: 2017/03/24 23:12:59 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "minishell.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
#define SETERR_0 "%s: %s: invalid variable name"
|
#define SETERR_0 "%s: not an identifier: %s"
|
||||||
|
|
||||||
static int assign_var(char *const av[], char ***env)
|
static int assign_var(char *const av[], char ***env)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue