Example #1
0
BOOL WINAPI Handle_Break(DWORD dwCtrlType)
{
    // Handle the MS CMD console CTRL-C, BREAK, and other events:
    if (dwCtrlType >= CTRL_CLOSE_EVENT) OS_Exit(100); // close button, shutdown, etc.
    Reb_Escape(0);
    return TRUE;	// We handled it
}
Example #2
0
//
// This is the callback passed to `SetConsoleCtrlHandler()`.  The parallel
// implementation in the POSIX code is `Handle_Signal()`
//
BOOL WINAPI Handle_Break(DWORD dwCtrlType)
{
    switch(dwCtrlType) {
    case CTRL_C_EVENT:
    case CTRL_BREAK_EVENT:
        RL_Escape(0);
        return TRUE; // TRUE = "we handled it"

    case CTRL_CLOSE_EVENT:
        //
        // !!! Theoretically the close event could confirm that the user
        // wants to exit, if there is possible unsaved state.  As a UI
        // premise this is probably less good than persisting the state
        // and bringing it back.
        //
    case CTRL_LOGOFF_EVENT:
    case CTRL_SHUTDOWN_EVENT:
        //
        // They pushed the close button, did a shutdown, etc.  Exit.
        //
        // !!! Review arbitrary "100" exit code here.
        //
        OS_Exit(100);
        return TRUE; // TRUE = "we handled it"

    default:
        return FALSE; // FALSE = "we didn't handle it"
    }
}
Example #3
0
int main(void)
{
    OS_Write0("Hello, World!\n");
    OS_Exit();
}