diff --git a/42sh/Makefile b/42sh/Makefile index a3bd3bf5..00876ba3 100644 --- a/42sh/Makefile +++ b/42sh/Makefile @@ -6,7 +6,7 @@ # By: wescande +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2016/08/29 21:32:58 by wescande #+# #+# # -# Updated: 2017/03/20 19:08:06 by jhalford ### ########.fr # +# Updated: 2017/03/20 21:07:34 by jhalford ### ########.fr # # # # **************************************************************************** # diff --git a/42sh/libft/src/btree/btree_print.c b/42sh/libft/src/btree/btree_print.c index a23e21f3..bc1961dc 100644 --- a/42sh/libft/src/btree/btree_print.c +++ b/42sh/libft/src/btree/btree_print.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/14 18:06:24 by jhalford #+# #+# */ -/* Updated: 2017/03/18 17:33:49 by ariard ### ########.fr */ +/* Updated: 2017/03/20 21:06:28 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/libft/src/get_next_line/get_next_line.c b/42sh/libft/src/get_next_line/get_next_line.c index 4a65cb55..ba080bde 100644 --- a/42sh/libft/src/get_next_line/get_next_line.c +++ b/42sh/libft/src/get_next_line/get_next_line.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/15 13:12:06 by jhalford #+# #+# */ -/* Updated: 2017/03/14 17:47:51 by jhalford ### ########.fr */ +/* Updated: 2017/03/20 21:18:01 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -43,6 +43,7 @@ static int ft_loop_read(int fd, char **line, char *save) while ((ret = read(fd, buf, BUFF_SIZE)) > 0) { + DG("boucle"); buf[ret] = 0; tmp = *line; if ((pos = ft_strchr(buf, '\n'))) @@ -58,6 +59,7 @@ static int ft_loop_read(int fd, char **line, char *save) } if (ret < 0) return (-1); + DG("GNL ret %i, fd=%i", **line ? 1 : 0, fd); return (**line ? 1 : 0); } diff --git a/42sh/src/builtin/builtin_exit.c b/42sh/src/builtin/builtin_exit.c index 2e56a7d5..d9e01d6a 100644 --- a/42sh/src/builtin/builtin_exit.c +++ b/42sh/src/builtin/builtin_exit.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/28 14:28:41 by jhalford #+# #+# */ -/* Updated: 2017/03/20 14:17:40 by gwojda ### ########.fr */ +/* Updated: 2017/03/20 21:23:03 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/fd_is_valid.c b/42sh/src/exec/fd_is_valid.c index 41114621..ebf60e6d 100644 --- a/42sh/src/exec/fd_is_valid.c +++ b/42sh/src/exec/fd_is_valid.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/03 13:46:40 by jhalford #+# #+# */ -/* Updated: 2017/03/15 17:48:21 by jhalford ### ########.fr */ +/* Updated: 2017/03/20 21:13:57 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/history/list_toolz.c b/42sh/src/history/list_toolz.c index 1c2008fa..71b6e9be 100644 --- a/42sh/src/history/list_toolz.c +++ b/42sh/src/history/list_toolz.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/17 11:37:47 by gwojda #+# #+# */ -/* Updated: 2017/03/20 18:16:45 by gwojda ### ########.fr */ +/* Updated: 2017/03/20 21:25:22 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,9 +16,9 @@ void free_history_list(t_list_history *head) { t_list_history *prev; - if (!head) + if (!SH_IS_INTERACTIVE(data_singleton()->opts)) return ; - if (head->next) + if (head && head->next) free(head->next); while (head) { diff --git a/42sh/src/line_editing/readline.c b/42sh/src/line_editing/readline.c index cbbc9438..04cbdc62 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/20 14:49:03 by gwojda ### ########.fr */ +/* Updated: 2017/03/20 21:19:20 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -21,7 +21,10 @@ int readline(int has_prompt, char **input) if (!SH_IS_INTERACTIVE(data_singleton()->opts)) { if ((ret = get_next_line(data_singleton()->fd, input)) >= 0) + { + DG("returning %i", !ret); return (!ret); + } return (ret); } readline_init(has_prompt); diff --git a/42sh/src/main/data_exit.c b/42sh/src/main/data_exit.c index d62a3ddb..51f33403 100644 --- a/42sh/src/main/data_exit.c +++ b/42sh/src/main/data_exit.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/07 18:07:50 by jhalford #+# #+# */ -/* Updated: 2017/03/20 14:44:51 by gwojda ### ########.fr */ +/* Updated: 2017/03/20 21:25:25 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/main/main.c b/42sh/src/main/main.c index b9478e50..3900dae7 100644 --- a/42sh/src/main/main.c +++ b/42sh/src/main/main.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/20 14:45:40 by gwojda #+# #+# */ -/* Updated: 2017/03/20 18:12:18 by gwojda ### ########.fr */ +/* Updated: 2017/03/20 21:20:51 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -46,13 +46,13 @@ static int handle_instruction(t_list **token, t_btree **ast) if (do_parser_routine(token, ast) > 0) break ; } - btree_print(STDBUG, *ast, &ft_putast); if (data->parser.state == SUCCESS && ft_exec(ast) < 0) exit(1); else if (data->parser.state != SUCCESS) set_exitstatus(1, 1); if (SH_IS_INTERACTIVE(data->opts) && data->lexer.str) ft_add_str_in_history(data->lexer.str); + /* exit(0); */ return (0); } diff --git a/42sh/src/parser/do_parser_routine.c b/42sh/src/parser/do_parser_routine.c index cf0160d2..2f9671b9 100644 --- a/42sh/src/parser/do_parser_routine.c +++ b/42sh/src/parser/do_parser_routine.c @@ -6,7 +6,7 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/19 14:24:14 by wescande #+# #+# */ -/* Updated: 2017/03/20 15:47:03 by ariard ### ########.fr */ +/* Updated: 2017/03/20 21:11:21 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */