Package: purity Version: 1-18 Tags: patch When exiting from 'purity', the terminal is left in a bad state. Ctrl+C does no longer work to cancel the command line and the prompt in 'rm -i' does not echo characters, and needs me to press Ctrl+J instead of Enter to confirm.
The reason is that 'purity' uses a signed short instead of the adequate type, tcflag_t, for saving the tcsetattr flags that it restores later. Since bit 15 is set in my case, when expanded to unsigned, the high bits are all set, setting all kinds of unwanted flags that cause the above behaviour. The attached patch solves it.
diff -u purity-1/pt.c purity-1-fix/pt.c --- purity-1-orig/pt.c 2015-02-27 16:18:17.000000000 +0100 +++ purity-1/pt.c 2015-02-27 16:12:50.000000000 +0100 @@ -80,9 +80,11 @@ static struct quest *theq, *nextq, *the_s, *next_s; static int num_ch, num_ln, kill_sub, no_ans, zoom, obfus, fast, derange, rot13; -static short tty_flags; #ifdef SYSV +static tcflag_t tty_flags; static unsigned char baz; +#else +static short tty_flags; #endif static unsigned short rows, cols;