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> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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;
|
||||
t_btexport data;
|
||||
|
||||
(void)envp;
|
||||
(void)path;
|
||||
data.flag = 0;
|
||||
if (cliopts_get((char**)av, g_export_opts, &data))
|
||||
ft_perror("export");
|
||||
return (ft_perror("export") ? 1 : 1);
|
||||
if (data.flag & BT_EXPORT_LP)
|
||||
return (bt_export_print());
|
||||
av = data.av_data;
|
||||
if (!(data.flag = 0) && !*av)
|
||||
bt_export_print();
|
||||
while (*av)
|
||||
{
|
||||
equal = ft_strchr(*av, '=');
|
||||
if (equal)
|
||||
*equal = 0;
|
||||
*(equal++) = 0;
|
||||
else
|
||||
equal = ft_getenv(data_singleton()->local_var, *av);
|
||||
equal ? equal++ : equal;
|
||||
builtin_setenv("internal", (char*[]){"export", *av, equal}, NULL);
|
||||
data.flag += builtin_setenv("internal", (char*[]){"export", *av, equal}, envp);
|
||||
builtin_unsetenv("internal", (char*[]){"local", *av, NULL}, NULL);
|
||||
av++;
|
||||
}
|
||||
return (0);
|
||||
return (data.flag ? 1 : 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@
|
|||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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"
|
||||
|
||||
#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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue