Mon, 17 Mar 2014 14:35:53 +0100
exit hook
src/main.c | file | annotate | diff | comparison | revisions |
--- a/src/main.c Thu Mar 06 15:03:06 2014 +0100 +++ b/src/main.c Mon Mar 17 14:35:53 2014 +0100 @@ -137,6 +137,14 @@ return exitcode; } +static WINDOW* window; + +void leavescr() { + mvprintw(getmaxy(window)-1, 0, "Leaving terminal-chess. Press any key..."); + getch(); + endwin(); +} + int main(int argc, char **argv) { srand(time(NULL)); @@ -167,9 +175,9 @@ return EXIT_SUCCESS; } - initscr(); + window = initscr(); cbreak(); - atexit((void(*)(void)) endwin); + atexit(leavescr); Server server; settings.server = &server; @@ -253,7 +261,6 @@ } } - getch(); /* TODO: remove */ return cleanup(&settings, EXIT_SUCCESS); }