From 4a033432bfbf2c1b0fc5040ef53e2c16d7131424 Mon Sep 17 00:00:00 2001 From: phyto Date: Tue, 30 Jul 2019 21:18:50 +0200 Subject: [PATCH] ending a ncurses proggy is not simple --- essai.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/essai.c b/essai.c index 08c2b6e..0875e22 100644 --- a/essai.c +++ b/essai.c @@ -126,7 +126,7 @@ fclose(fp); return 0; } /* --------------------------------------------------------------- */ -static void finish(int signal) +static void finish(void) { endwin(); fprintf(stderr, "end of pid %d\n", getpid()); @@ -180,16 +180,18 @@ sleep(1); initscr(); nonl(); cbreak(); noecho(); keypad(stdscr, TRUE); /* acces aux touches 'curseur' */ +atexit(finish); + sprintf(ligne, " Demonstrator pid:%d %s ", getpid(), device); fond_ecran(ligne); + traite_les_messages(serial_in, nbreloops, K); /* * plop, on a fini, il faut restaurer la console */ -finish(0); - +finish(); return 0; }