ending a ncurses proggy is not simple

This commit is contained in:
phyto 2019-07-30 21:18:50 +02:00
parent ee5f22419a
commit 4a033432bf

View File

@ -126,7 +126,7 @@ fclose(fp);
return 0; return 0;
} }
/* --------------------------------------------------------------- */ /* --------------------------------------------------------------- */
static void finish(int signal) static void finish(void)
{ {
endwin(); endwin();
fprintf(stderr, "end of pid %d\n", getpid()); fprintf(stderr, "end of pid %d\n", getpid());
@ -180,16 +180,18 @@ sleep(1);
initscr(); initscr();
nonl(); cbreak(); noecho(); nonl(); cbreak(); noecho();
keypad(stdscr, TRUE); /* acces aux touches 'curseur' */ keypad(stdscr, TRUE); /* acces aux touches 'curseur' */
atexit(finish);
sprintf(ligne, " Demonstrator pid:%d %s ", getpid(), device); sprintf(ligne, " Demonstrator pid:%d %s ", getpid(), device);
fond_ecran(ligne); fond_ecran(ligne);
traite_les_messages(serial_in, nbreloops, K); traite_les_messages(serial_in, nbreloops, K);
/* /*
* plop, on a fini, il faut restaurer la console * plop, on a fini, il faut restaurer la console
*/ */
finish(0); finish();
return 0; return 0;
} }