* modified 10-18-89 for curses (jrl)
* 10-18-89 added signal handling
*
- * $Id: gdc.c,v 1.15 2000/09/02 18:40:39 tom Exp $
+ * $Id: gdc.c,v 1.23 2002/08/10 19:20:14 tom Exp $
*/
-#include <test.priv.h>
-
#include <time.h>
-#include <signal.h>
-#include <string.h>
+
+#include <test.priv.h>
#define YBASE 10
#define XBASE 10
sigtermed = signo;
if (redirected) {
endwin();
- exit(EXIT_FAILURE);
+ ExitProgram(EXIT_FAILURE);
}
}
m = 7 << n;
for (i = 0; i < 5; i++) {
- next[i] |= ((disp[t] >> (4 - i) * 3) & 07) << n;
+ next[i] |= ((disp[t] >> ((4 - i) * 3)) & 07) << n;
mask |= (next[i] ^ older[i]) & m;
}
if (mask & m)
unsigned j;
for (j = 0; j < SIZEOF(msg); j++)
fprintf(stderr, "%s\n", msg[j]);
- exit(EXIT_FAILURE);
+ ExitProgram(EXIT_FAILURE);
}
int
FILE *ifp = stdin;
bool scrol = FALSE;
+ setlocale(LC_ALL, "");
+
signal(SIGINT, sighndl);
signal(SIGTERM, sighndl);
- signal(SIGKILL, sighndl);
while ((k = getopt(argc, argv, "sn")) != EOF) {
switch (k) {
if (name == 0
|| newterm(name, ofp, ifp) == 0) {
fprintf(stderr, "cannot open terminal\n");
- exit(EXIT_FAILURE);
+ ExitProgram(EXIT_FAILURE);
}
} else {
standend();
endwin();
fprintf(stderr, "gdc terminated by signal %d\n", sigtermed);
- return EXIT_FAILURE;
+ ExitProgram(EXIT_FAILURE);
}
+ /* FALLTHRU */
default:
continue;
}
} while (--count);
standend();
endwin();
- return EXIT_SUCCESS;
+ ExitProgram(EXIT_SUCCESS);
}