diff --git a/42sh/Makefile b/42sh/Makefile index 28a3a138..0614f46e 100644 --- a/42sh/Makefile +++ b/42sh/Makefile @@ -6,14 +6,14 @@ # By: wescande +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # 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) diff --git a/42sh/src/builtin/builtin_export.c b/42sh/src/builtin/builtin_export.c index 9c4ab1ca..0178c03e 100644 --- a/42sh/src/builtin/builtin_export.c +++ b/42sh/src/builtin/builtin_export.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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); diff --git a/42sh/src/builtin/builtin_unsetenv.c b/42sh/src/builtin/builtin_unsetenv.c index a336c836..02896fa6 100644 --- a/42sh/src/builtin/builtin_unsetenv.c +++ b/42sh/src/builtin/builtin_unsetenv.c @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* builtin_unsetenv.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: jhalford +#+ +:+ +#+ */ +/* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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); diff --git a/42sh/src/line-editing/get_key.c b/42sh/src/line-editing/get_key.c index fc9ffc77..5bfec31b 100644 --- a/42sh/src/line-editing/get_key.c +++ b/42sh/src/line-editing/get_key.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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) diff --git a/42sh/src/line-editing/readline.c b/42sh/src/line-editing/readline.c index 8a4460e9..a2b96cad 100644 --- a/42sh/src/line-editing/readline.c +++ b/42sh/src/line-editing/readline.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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)