remise a la norme avant de merge

This commit is contained in:
Jack Halford 2017-01-28 14:44:00 +01:00
parent f236e8e734
commit 076d3c3d5b
3 changed files with 4 additions and 9 deletions

@ -1 +1 @@
Subproject commit 4c4977452745481166749b813e8db51dcf0caf44 Subproject commit ab92f0e5d817c9d726a8ccf2f11c084ba446bbdf

View file

@ -40,7 +40,6 @@ int bt_read_terminit(t_read *data)
} }
if (tcsetattr(0, TCSANOW, &term) < 0) if (tcsetattr(0, TCSANOW, &term) < 0)
return (-1); return (-1);
/* DG("c_cc[VTIME]=%i", term.c_cc[VTIME]); */
return (0); return (0);
} }

View file

@ -32,7 +32,6 @@ int bt_read_loop(t_read *data)
{ {
int i; int i;
int esc; int esc;
int ret;
char buf[2]; char buf[2];
i = 0; i = 0;
@ -41,24 +40,21 @@ int bt_read_loop(t_read *data)
ft_printf(data->prompt); ft_printf(data->prompt);
while (42) while (42)
{ {
if ((ret = read(data->fd, buf, 1)) <= 0) if (read(data->fd, buf, 1) <= 0)
return (1); return (1);
/* DG("got *buf=%c, ret=%i", *buf, ret); */ buf[1] = 0;
buf[ret] = 0;
if (!esc && *buf == data->delim) if (!esc && *buf == data->delim)
break ; break ;
esc = esc ? 0 : !(data->opts & READ_OPT_LR) && (*buf == '\\'); esc = esc ? 0 : !(data->opts & READ_OPT_LR) && (*buf == '\\');
ft_strappend(&data->input, buf); ft_strappend(&data->input, buf);
if (!(data->opts & READ_OPT_LS)) if (!(data->opts & READ_OPT_LS))
ft_putchar(*buf); ft_putchar(*buf);
i++;
if (*buf == '\n' && !(data->opts & READ_OPT_LR)) if (*buf == '\n' && !(data->opts & READ_OPT_LR))
ft_putstr("> "); ft_putstr("> ");
if ((data->opts & READ_OPT_LN) && i >= data->nchars) if ((data->opts & READ_OPT_LN) && ++i >= data->nchars)
break ; break ;
} }
ft_putchar('\n'); ft_putchar('\n');
DG("input=%s", data->input);
return (0); return (0);
} }