This commit is contained in:
gwojda 2017-03-17 16:11:25 +01:00
parent 0249416b1d
commit 622d967ab8
4 changed files with 12 additions and 12 deletions

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/02 15:22:19 by gwojda #+# #+# */
/* Updated: 2017/03/17 12:09:42 by gwojda ### ########.fr */
/* Updated: 2017/03/17 16:05:47 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
@ -39,9 +39,8 @@ int ft_history_down(char **str, size_t *pos)
head = head->next;
if (!head->str)
*str = NULL;
else
if (!(*str = ft_strdup(head->str)))
return (-1);
else if (!(*str = ft_strdup(head->str)))
return (-1);
if (*str)
ft_current_str(*str, *pos);
if (*str)
@ -64,9 +63,8 @@ int ft_history_up(char **str, size_t *pos)
head = head->prev;
if (!head->str)
*str = NULL;
else
if (!(*str = ft_strdup(head->str)))
return (-1);
else if (!(*str = ft_strdup(head->str)))
return (-1);
if (*str)
ft_current_str(*str, *pos);
if (*str)

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/26 10:43:16 by gwojda #+# #+# */
/* Updated: 2017/03/17 12:12:19 by gwojda ### ########.fr */
/* Updated: 2017/03/17 16:06:09 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
@ -52,7 +52,7 @@ static void ft_give_new_prompt(char *str_srch, size_t srch_pos)
}
static void ft_modify_str(char *str_srch, size_t srch_pos, char **str,
size_t *pos)
size_t *pos)
{
ft_clear_prompt(pos, srch_pos);
data_singleton()->line.is_prompt ? ft_prompt() : ft_putstr("> ");

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 15:11:10 by gwojda ### ########.fr */
/* Updated: 2017/03/17 15:54:45 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
@ -81,6 +81,7 @@ 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 14:56:35 by gwojda ### ########.fr */
/* Updated: 2017/03/17 16:10:40 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
@ -16,11 +16,12 @@ int readline(int has_prompt, char **input)
{
int ret;
if (!has_prompt)
data_singleton()->line.prompt_size = 1;
if (!SH_IS_INTERACTIVE(data_singleton()->opts))
return ((ret = get_next_line(STDIN, input)) >= 0 ? !ret : ret);
readline_init(has_prompt);
ret = ft_read_stdin(input);
DG("ret = %s", input);
if (ret < 0)
return (ret);
if (data_singleton()->line.input)