I have a function that quits a program when <ctrl>c is entered as per following code;
void quitter (void)
{
clear ();
mvprintw (QUITTER_ROW, QUITTER_COL, "Quitting...");
refresh ();
sleep (15);
endwin ();
exit (1);
}
This function is called thus;
signal (SIGINT, quitter);
It works, sort of. The "Quitting..." message is displayed, but only for about half a second. I can change the argument in the sleep() function all I like. It makes no difference to the amount of time "Quitting..." is displayed for. I thought my code would cause the "Quitting..." message to be displayed for 15 seconds before the execution ends. Why does it not work as intended? I tried it on another machine with the same result.