X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fgdc.c;h=c466f2fde2674d95849d355f4bd980da2913f581;hp=ea88d6c54754e200ff92aaa8df12bcae025a3060;hb=46722468f47c2b77b3987729b4bcf2321cccfd01;hpb=b1f61d9f3aa244512045a6b02e759825d7049d34 diff --git a/test/gdc.c b/test/gdc.c index ea88d6c5..c466f2fd 100644 --- a/test/gdc.c +++ b/test/gdc.c @@ -6,14 +6,12 @@ * modified 10-18-89 for curses (jrl) * 10-18-89 added signal handling * - * $Id: gdc.c,v 1.14 2000/04/23 00:03:11 tom Exp $ + * $Id: gdc.c,v 1.23 2002/08/10 19:20:14 tom Exp $ */ -#include - #include -#include -#include + +#include #define YBASE 10 #define XBASE 10 @@ -38,7 +36,7 @@ sighndl(int signo) sigtermed = signo; if (redirected) { endwin(); - exit(EXIT_FAILURE); + ExitProgram(EXIT_FAILURE); } } @@ -97,7 +95,7 @@ set(int t, int n) 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) @@ -120,7 +118,7 @@ usage(void) unsigned j; for (j = 0; j < SIZEOF(msg); j++) fprintf(stderr, "%s\n", msg[j]); - exit(EXIT_FAILURE); + ExitProgram(EXIT_FAILURE); } int @@ -135,9 +133,10 @@ main(int argc, char *argv[]) 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) { @@ -163,7 +162,7 @@ main(int argc, char *argv[]) if (name == 0 || newterm(name, ofp, ifp) == 0) { fprintf(stderr, "cannot open terminal\n"); - exit(EXIT_FAILURE); + ExitProgram(EXIT_FAILURE); } } else { @@ -179,7 +178,7 @@ main(int argc, char *argv[]) if (hascolor) { int bg = COLOR_BLACK; start_color(); -#ifdef HAVE_USE_DEFAULT_COLORS +#if HAVE_USE_DEFAULT_COLORS if (use_default_colors() == OK) bg = -1; #endif @@ -304,13 +303,14 @@ main(int argc, char *argv[]) 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); }