handle > 0 reads - sob - simple output bar
(HTM) git clone git://git.codemadness.org/sob
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 4509683dafe3ff6f26d5dd19e4a2ad892e63d5d0
(DIR) parent 82305fc9b1dac9d1bd37b294923a7a036e09ace4
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 10 Oct 2014 20:05:29 +0000
handle > 0 reads
Diffstat:
M sob.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
---
(DIR) diff --git a/sob.c b/sob.c
@@ -753,8 +753,6 @@ handleinput(const unsigned char *key, size_t len)
size_t i;
int ismatch = 0;
- if(key[0] == '\0')
- return;
for(i = 0; i < LEN(keybinds); i++) {
if(len == strlen((char*)keybinds[i].key) &&
memcmp(key, keybinds[i].key, len) == 0) {
@@ -804,7 +802,7 @@ run(void)
if((r = read(STDIN_FILENO, buf, sizeof(buf))) == -1) {
if(errno != EAGAIN && errno != EWOULDBLOCK)
goto fini;
- } else {
+ } else if(r > 0) {
buf[r] = '\0';
handleinput(buf, r);
}