summaryrefslogtreecommitdiffstats
path: root/linenoise
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-09-06 21:23:44 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-09-06 21:23:44 -0700
commit2b77a3696e74eb9e0414bd3895fa6352f4572f25 (patch)
treee55ea5a0529dddbd9de6884c365b089737b7e714 /linenoise
parent1b5801edf62f8bfed9a2f88e88a0195518ba4976 (diff)
downloadtxr-2b77a3696e74eb9e0414bd3895fa6352f4572f25.tar.gz
txr-2b77a3696e74eb9e0414bd3895fa6352f4572f25.tar.bz2
txr-2b77a3696e74eb9e0414bd3895fa6352f4572f25.zip
linenoise: STDIN_FILENO used as pointer.
* linenoise/linenoise.c (lino_print_codes): Pass l into enable_raw_mode rather than STDIN_FILENO. Read from l->ifd rather than STDIN_FILENO. since this is a debugging function, I'm leaving the printfs to stdio alone.
Diffstat (limited to 'linenoise')
-rw-r--r--linenoise/linenoise.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/linenoise/linenoise.c b/linenoise/linenoise.c
index c28e7dd2..5ebd2b62 100644
--- a/linenoise/linenoise.c
+++ b/linenoise/linenoise.c
@@ -971,13 +971,13 @@ void lino_print_keycodes(lino_t *l) {
printf("Linenoise key codes debugging mode.\n"
"Press keys to see scan codes. Type 'quit' at any time to exit.\n");
- if (enable_raw_mode(STDIN_FILENO) == -1) return;
+ if (enable_raw_mode(l) == -1) return;
memset(quit,' ',4);
while(1) {
char c;
int nread;
- nread = read(STDIN_FILENO,&c,1);
+ nread = read(l->ifd,&c,1);
if (nread <= 0) continue;
memmove(quit,quit+1,sizeof(quit)-1); /* shift string to left. */
quit[sizeof(quit)-1] = c; /* Insert current char on the right. */