From c1d2ebe8cac049808be400221c3ed4bda780cab7 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Fri, 25 Feb 2022 00:27:22 +0100 Subject: 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/* --- sfeed_curses.c | 6 ++++-- 1 file 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); -- cgit v1.2.3