fix export

This commit is contained in:
gwojda 2017-03-18 11:48:17 +01:00
parent fb4a9e192c
commit 112e72d9ab
5 changed files with 11 additions and 11 deletions

View file

@ -6,14 +6,14 @@
# By: wescande <wescande@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2016/08/29 21:32:58 by wescande #+# #+# #
# Updated: 2017/03/17 15:13:37 by gwojda ### ########.fr #
# Updated: 2017/03/18 11:24:18 by gwojda ### ########.fr #
# #
# **************************************************************************** #
NAME = 42sh
CC = gcc
FLAGS = -Wall -Wextra -Werror -fvisibility=hidden
FLAGS = -Wall -Wextra -Werror -g
D_FLAGS = -g
DELTA = $$(echo "$$(tput cols)-47"|bc)

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/15 11:39:37 by gwojda #+# #+# */
/* Updated: 2017/03/14 21:39:12 by jhalford ### ########.fr */
/* Updated: 2017/03/18 11:46:32 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
@ -24,7 +24,7 @@ int bt_export_print(void)
char *equal;
env = data_singleton()->env;
while (*env)
while (*env)
{
if ((equal = ft_strchr(*env, '=')))
ft_printf("export %s\n", *env);
@ -63,7 +63,7 @@ int builtin_export(
equal = ft_getenv(data_singleton()->local_var, *av);
builtin_setenv("internal", (char*[]){"global", *av, equal}, NULL);
}
builtin_unsetenv("internal", (char*[]){"local", *av}, NULL);
builtin_unsetenv("internal", (char*[]){"local", *av, NULL}, NULL);
av++;
}
return (0);

View file

@ -3,10 +3,10 @@
/* ::: :::::::: */
/* builtin_unsetenv.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/28 14:29:17 by jhalford #+# #+# */
/* Updated: 2017/03/14 21:13:35 by jhalford ### ########.fr */
/* Updated: 2017/03/18 11:47:53 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
@ -26,7 +26,7 @@ int builtin_unsetenv(const char *path, char *const av[], char *const envp[])
while (av[i])
{
j = 0;
while ((*env)[j])
while (*env && (*env)[j])
{
if (ft_strcmp((*env)[j], av[i]) == '=')
ft_sstrdel(*env, j);

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/19 16:28:49 by gwojda #+# #+# */
/* Updated: 2017/03/17 23:21:04 by ariard ### ########.fr */
/* Updated: 2017/03/18 11:19:01 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
@ -81,7 +81,6 @@ int ft_read_stdin(char **input)
{
if (read_stdin(&ret, &j) < 0)
return (-1);
DG("key value hex = %x", ret);
if (ft_completion(ret, str, pos))
continue ;
while (g_key[j].value && g_key[j].value != ret)

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/15 14:19:48 by gwojda #+# #+# */
/* Updated: 2017/03/17 23:19:22 by ariard ### ########.fr */
/* Updated: 2017/03/18 10:57:19 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
@ -22,6 +22,7 @@ int readline(int has_prompt, char **input)
return ((ret = get_next_line(data_singleton()->fd, input)) >= 0 ? !ret : ret);
readline_init(has_prompt);
ret = ft_read_stdin(input);
DG("input = %s", *input);
if (ret < 0)
return (ret);
if (data_singleton()->line.input)