conio: kbt, a 15-line check that the CSI > u handler is reached Builds with "gmake kbt" in src/conio. Writes CSI > 3 u into a fresh cterm and prints whether key_event_flags took the value, which is the cheapest way to tell "the sequence never reached the handler" from "the handler ran and the backend did nothing". REQUIRES R0003; without it the struct fields do not exist. --- a/src/conio/GNUmakefile +++ b/src/conio/GNUmakefile @@ -91,6 +91,9 @@ quittest: quittest.c $(CIOLIB-MT_BUILD) ${QUIET}$(CC) $(CFLAGS) $(MT_CFLAGS) $(LDFLAGS) $(MT_LDFLAGS) $(XPDEV-MT_LDFLAGS) quittest.c -o $@ $(CIOLIB-MT_LIBS) $(XPDEV-MT_LIBS) +kbt: kbt.c $(CIOLIB-MT_BUILD) + ${QUIET}$(CC) $(CFLAGS) $(MT_CFLAGS) $(LDFLAGS) $(MT_LDFLAGS) $(XPDEV-MT_LDFLAGS) $(ENCODE_LDFLAGS) $(HASH_LDFLAGS) kbt.c -o $@ $(CIOLIB-MT_LIBS) $(ENCODE_LIBS) $(HASH_LIBS) $(XPDEV-MT_LIBS) + cterm_test: cterm_test.c $(CIOLIB-MT_BUILD) @echo Building $@ ... ${QUIET}$(CC) $(CFLAGS) $(MT_CFLAGS) $(LDFLAGS) $(MT_LDFLAGS) $(XPDEV-MT_LDFLAGS) $(ENCODE_LDFLAGS) $(HASH_LDFLAGS) cterm_test.c -o $@ $(CIOLIB-MT_LIBS) $(ENCODE_LIBS) $(HASH_LIBS) $(XPDEV-MT_LIBS) --- /dev/null +++ b/src/conio/kbt.c @@ -0,0 +1,15 @@ +#include +#include +#include "ciolib.h" +#include "cterm.h" +int main(void){ + struct cterminal *ct; int speed=0; + static struct vmem_cell sb[80*100]; + ct = cterm_init(25,80,1,1,100,80,sb,CTERM_EMULATION_ANSI_BBS); + if(!ct){printf("init failed\n");return 1;} + printf("before: flags=%d depth=%d\n", ct->key_event_flags, ct->key_event_depth); + cterm_write(ct, "\x1b[>3u", 5, &speed); + printf("after CSI>3u: flags=%d depth=%d %s\n", ct->key_event_flags, ct->key_event_depth, + ct->key_event_flags==3 ? "HANDLER REACHED" : "** NOT REACHED **"); + return 0; +}