MCPcopy Index your code
hub / github.com/NetHack/NetHack / hangup

Function hangup

src/cmd.c:5158–5180  ·  view source on GitHub ↗

some very old systems, or descendents of such systems, expect signal handlers to have return type `int', but they don't actually inspect the return value so we should be safe using `void' unconditionally */ ARGUSED*/

Source from the content-addressed store, hash-verified

5156 the return value so we should be safe using `void' unconditionally */
5157/*ARGUSED*/
5158void
5159hangup(
5160 int sig_unused UNUSED) /* called as signal() handler, so sent
5161 * at least one arg */
5162{
5163 if (program_state.exiting)
5164 program_state.in_moveloop = 0;
5165 nhwindows_hangup();
5166#ifdef SAFERHANGUP
5167 /* When using SAFERHANGUP, the done_hup flag is tested in rhack
5168 and a couple of other places; actual hangup handling occurs then.
5169 This is 'safer' because it disallows certain cheats and also
5170 protects against losing objects in the process of being thrown,
5171 but also potentially riskier because the disconnected program
5172 must continue running longer before attempting a hangup save. */
5173 program_state.done_hup++;
5174 /* defer hangup iff game appears to be in progress */
5175 if (program_state.in_moveloop
5176 && program_state.something_worth_saving)
5177 return;
5178#endif /* SAFERHANGUP */
5179 end_of_input();
5180}
5181
5182void
5183end_of_input(void)

Callers 8

MainWndProcFunction · 0.85
X11_error_handlerFunction · 0.85
X11_io_error_handlerFunction · 0.85
X11_sigFunction · 0.85
X11_hangupFunction · 0.85
CtrlHandlerFunction · 0.85
readchar_coreFunction · 0.85
MainWndProcFunction · 0.85

Calls 2

nhwindows_hangupFunction · 0.85
end_of_inputFunction · 0.85

Tested by

no test coverage detected