registration of signal handlers on all ports
see https://invisible-island.net/ncurses/man/curs_initscr.3x.html#h3-Signal-Handlers and https://stackoverflow.com/a/44085449/5027456
According to the search function this is only done on few ports (wincon possibly uses a different approach), and it seems that it may not be only done if the signal is currently SIG_DFL (@Bill-Gray this also applies to PDCursesMod).
Could the behavior be adjusted to be identical (or at least similar) in all ports? Can you please update the docs to let the users know what to expect?
Just did a trawl through the code to see how signal handling is currently done. In both PDCurses and PDCursesMod :
-
ozdemosets up a handler to callendwin()andexit()onSIGINT. - In DOS, with DJGPP,
raw()causesSIGINTto be ignored;noraw()causes the default action to be taken. With other compilers, the DOS port doesn't do anything about signals. - Same for certain configurations on OS/2.
- X11, as best I can tell, just leaves signal handling at defaults.
- WinCon uses
SetConsoleMode()to "enable processed input" : "Ctrl-C is processed by the system". It doesn't say how (may not involve a signal handler).
In PDCursesMod, DOSVGA copied the DOS approach. The VT and framebuffer ports install a signal handler for SIGINT; in noraw() mode, it attempts to reset the screen... doing some signal-unsafe things in the process, I see (some of which may be unavoidable). Otherwise, a count of the number of Ctrl-Cs hit is incremented.
Still in PDCursesMod, the VT port also handles SIGWINCH (window resized), which every other port can safely ignore.