norme + #114
This commit is contained in:
parent
0249416b1d
commit
622d967ab8
4 changed files with 12 additions and 12 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/02 15:22:19 by gwojda #+# #+# */
|
/* 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;
|
head = head->next;
|
||||||
if (!head->str)
|
if (!head->str)
|
||||||
*str = NULL;
|
*str = NULL;
|
||||||
else
|
else if (!(*str = ft_strdup(head->str)))
|
||||||
if (!(*str = ft_strdup(head->str)))
|
return (-1);
|
||||||
return (-1);
|
|
||||||
if (*str)
|
if (*str)
|
||||||
ft_current_str(*str, *pos);
|
ft_current_str(*str, *pos);
|
||||||
if (*str)
|
if (*str)
|
||||||
|
|
@ -64,9 +63,8 @@ int ft_history_up(char **str, size_t *pos)
|
||||||
head = head->prev;
|
head = head->prev;
|
||||||
if (!head->str)
|
if (!head->str)
|
||||||
*str = NULL;
|
*str = NULL;
|
||||||
else
|
else if (!(*str = ft_strdup(head->str)))
|
||||||
if (!(*str = ft_strdup(head->str)))
|
return (-1);
|
||||||
return (-1);
|
|
||||||
if (*str)
|
if (*str)
|
||||||
ft_current_str(*str, *pos);
|
ft_current_str(*str, *pos);
|
||||||
if (*str)
|
if (*str)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/26 10:43:16 by gwojda #+# #+# */
|
/* 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,
|
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);
|
ft_clear_prompt(pos, srch_pos);
|
||||||
data_singleton()->line.is_prompt ? ft_prompt() : ft_putstr("> ");
|
data_singleton()->line.is_prompt ? ft_prompt() : ft_putstr("> ");
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/19 16:28:49 by gwojda #+# #+# */
|
/* 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)
|
if (read_stdin(&ret, &j) < 0)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
DG("key value hex = %x", ret);
|
||||||
if (ft_completion(ret, str, pos))
|
if (ft_completion(ret, str, pos))
|
||||||
continue ;
|
continue ;
|
||||||
while (g_key[j].value && g_key[j].value != ret)
|
while (g_key[j].value && g_key[j].value != ret)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/15 14:19:48 by gwojda #+# #+# */
|
/* 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;
|
int ret;
|
||||||
|
|
||||||
|
if (!has_prompt)
|
||||||
|
data_singleton()->line.prompt_size = 1;
|
||||||
if (!SH_IS_INTERACTIVE(data_singleton()->opts))
|
if (!SH_IS_INTERACTIVE(data_singleton()->opts))
|
||||||
return ((ret = get_next_line(STDIN, input)) >= 0 ? !ret : ret);
|
return ((ret = get_next_line(STDIN, input)) >= 0 ? !ret : ret);
|
||||||
readline_init(has_prompt);
|
readline_init(has_prompt);
|
||||||
ret = ft_read_stdin(input);
|
ret = ft_read_stdin(input);
|
||||||
DG("ret = %s", input);
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return (ret);
|
return (ret);
|
||||||
if (data_singleton()->line.input)
|
if (data_singleton()->line.input)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue