diff --git a/src/client/play.c b/src/client/play.c index 47e028a8..697fed65 100644 --- a/src/client/play.c +++ b/src/client/play.c @@ -404,21 +404,13 @@ recv_output(int sock) static int recv_input(int fd, struct ring *inbuf) { - static struct lbuf cmdbuf; int n, i, ch; - char *line; int res = 1; n = ring_from_file(inbuf, fd); if (n < 0) return -1; if (n == 0) { - /* EOF on input */ - if (lbuf_len(&cmdbuf)) { - /* incomplete line */ - ring_putc(inbuf, '\n'); - n++; - } /* * Can't put EOF cookie into INBUF here, it may not fit. * Leave it to caller. @@ -430,11 +422,8 @@ recv_input(int fd, struct ring *inbuf) for (i = -n; i < 0; i++) { ch = ring_peek(inbuf, i); assert(ch != EOF); - if (ch != '\r' && lbuf_putc(&cmdbuf, ch) > 0) { - line = lbuf_line(&cmdbuf); - save_input(line); - lbuf_init(&cmdbuf); - } + if (ch != '\r') + save_input(ch); if (auxfp) putc(ch, auxfp); } diff --git a/src/client/secure.c b/src/client/secure.c index 330260f7..c2e3cd24 100644 --- a/src/client/secure.c +++ b/src/client/secure.c @@ -27,7 +27,7 @@ * secure.c: Check redir etc. to protect against tampering deity * * Known contributors to this file: - * Markus Armbruster, 2007-2015 + * Markus Armbruster, 2007-2017 */ #include @@ -42,18 +42,14 @@ static struct ring recent_input; /* - * Remember line of input @inp for a while. - * It must end with a newline. + * Remember input @inp for a while. */ void -save_input(char *inp) +save_input(char inp) { - size_t len = strlen(inp); int eol; - assert(len && inp[len - 1] == '\n'); - - while (ring_putm(&recent_input, inp, len) < 0) { + while (ring_putc(&recent_input, inp) < 0) { eol = ring_search(&recent_input, "\n", 0); assert(eol >= 0); ring_discard(&recent_input, eol + 1); diff --git a/src/client/secure.h b/src/client/secure.h index 8e4454f9..c5462f68 100644 --- a/src/client/secure.h +++ b/src/client/secure.h @@ -27,7 +27,7 @@ * secure.h: Check redir etc. to protect against tampering deity * * Known contributors to this file: - * Markus Armbruster, 2007-2009 + * Markus Armbruster, 2007-2017 */ #ifndef SECURE_H @@ -35,7 +35,7 @@ #include -extern void save_input(char *); +extern void save_input(char); extern int seen_input(char *); extern int seen_exec_input(char *);