protection free_history_list
This commit is contained in:
parent
6460fa3f61
commit
aebb4f7613
10 changed files with 18 additions and 13 deletions
|
|
@ -6,7 +6,7 @@
|
|||
# By: wescande <wescande@student.42.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# 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 #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue