summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2022-02-25 00:27:22 +0100
committerHiltjo Posthuma <hiltjo@codemadness.org>2022-02-25 00:38:15 +0100
commitc1d2ebe8cac049808be400221c3ed4bda780cab7 (patch)
tree9c2701de49aaa8b6e3ab74c7d8f5aeaa481e2e48
parent4a9456848a45edbc097770df20dec216f44ca0f5 (diff)
sfeed_curses: cast character for SFEED_AUTOCMD to unsigned char
Otherwise a character like \xa0 (160) would be negative and goto the event, since a negative return value in readch() is used for errors or reserved for signal handling. Noticed while testing mouse X10 encoding with extended buttons, like button 7: SFEED_AUTOCMD="l$(printf '\x1b[M\xa0!!')j" ./sfeed_curses ~/.sfeed/feeds/*
-rw-r--r--sfeed_curses.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sfeed_curses.c b/sfeed_curses.c
index da0b0a9..4d77504 100644
--- a/sfeed_curses.c
+++ b/sfeed_curses.c
@@ -951,8 +951,10 @@ readch(void)
fd_set readfds;
struct timeval tv;
- if (cmdenv && *cmdenv)
- return *(cmdenv++); /* $SFEED_AUTOCMD */
+ if (cmdenv && *cmdenv) {
+ b = *(cmdenv++); /* $SFEED_AUTOCMD */
+ return (int)b;
+ }
for (;;) {
FD_ZERO(&readfds);