Correctly echo intr instead of hard ^C

This commit is contained in:
наб 2023-11-25 17:40:30 +01:00
parent 47cd20aa32
commit 1ae0e258a7
No known key found for this signature in database
GPG Key ID: BCFD0B018D2658F1

View File

@ -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);