From 1ae0e258a7303f741d5f29fbb55c6e8387def977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sat, 25 Nov 2023 17:40:30 +0100 Subject: [PATCH] Correctly echo intr instead of hard ^C --- src/fd.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/fd.cpp b/src/fd.cpp index 6cd8118..e2b9be1 100644 --- a/src/fd.cpp +++ b/src/fd.cpp @@ -155,7 +155,10 @@ static int get_key_material_raw(const char * whom, bool again, bool newkey, uint caught_interrupt = 0; act.sa_handler = [](auto sig) { caught_interrupt = sig; - fputs("^C\n", stderr); + + struct termios cur; + tcgetattr(0, &cur); + fprintf(stderr, "%s^%c\n", (cur.c_cc[VINTR] & 0x80) ? "M-" : "", ((cur.c_cc[VINTR] & 0x7F) == 0x7F) ? '?' : ('@' + (cur.c_cc[VINTR] & 0x7F))); }; sigaction(SIGINT, &act, &osigint);