MCPcopy Create free account
hub / github.com/NetHack/NetHack / winch_handler

Function winch_handler

win/tty/wintty.c:360–387  ·  view source on GitHub ↗

signal handler is called with at least 1 arg */ ARGUSED*/

Source from the content-addressed store, hash-verified

358/* signal handler is called with at least 1 arg */
359/*ARGUSED*/
360static void
361winch_handler(int sig_unused UNUSED)
362{
363#ifdef WINCHAIN
364 {
365#define WINCH_MESSAGE "(SIGWINCH)"
366 if (wc_tracelogf)
367 (void) write(fileno(wc_tracelogf), WINCH_MESSAGE,
368 sizeof WINCH_MESSAGE - sizeof "");
369#undef WINCH_MESSAGE
370 }
371#endif
372
373 program_state.resize_pending++; /* resize_tty() will reset it */
374 /* if nethack is waiting for input, which is the most likely scenario,
375 we will go ahead and respond to the resize immediately; otherwise,
376 tty_nhgetch() will do so the next time it's called */
377 if (program_state.getting_char) {
378 resize_tty();
379#if 0 /* [this doesn't work as intended and seems to be unnecessary] */
380 if (resize_mesg) {
381 /* resize_tty() put "Press a key to continue: " on top line */
382 (void) tty_nhgetch(); /* recursion... */
383 }
384#endif
385 }
386 return;
387}
388
389/* query the system for tty size (vis getwindowsz()), and adapt the game's
390 windows to match */

Callers

nothing calls this directly

Calls 3

writeFunction · 0.85
resize_ttyFunction · 0.85
tty_nhgetchFunction · 0.85

Tested by

no test coverage detected