Mon, 17 Mar 2014 14:35:53 +0100
exit hook
src/main.c | file | annotate | diff | comparison | revisions |
1.1 --- a/src/main.c Thu Mar 06 15:03:06 2014 +0100 1.2 +++ b/src/main.c Mon Mar 17 14:35:53 2014 +0100 1.3 @@ -137,6 +137,14 @@ 1.4 return exitcode; 1.5 } 1.6 1.7 +static WINDOW* window; 1.8 + 1.9 +void leavescr() { 1.10 + mvprintw(getmaxy(window)-1, 0, "Leaving terminal-chess. Press any key..."); 1.11 + getch(); 1.12 + endwin(); 1.13 +} 1.14 + 1.15 int main(int argc, char **argv) { 1.16 srand(time(NULL)); 1.17 1.18 @@ -167,9 +175,9 @@ 1.19 return EXIT_SUCCESS; 1.20 } 1.21 1.22 - initscr(); 1.23 + window = initscr(); 1.24 cbreak(); 1.25 - atexit((void(*)(void)) endwin); 1.26 + atexit(leavescr); 1.27 1.28 Server server; 1.29 settings.server = &server; 1.30 @@ -253,7 +261,6 @@ 1.31 } 1.32 } 1.33 1.34 - getch(); /* TODO: remove */ 1.35 return cleanup(&settings, EXIT_SUCCESS); 1.36 } 1.37