X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fhashtest.c;h=85248c81665aad92f70c71e61d7ad624c82a547c;hp=46a4f42331ff89f8cabc7b7be0f2f955c52613e3;hb=25358bc041a5566ce2de4c9c792837e552b35671;hpb=a8987e73ec254703634802b4f7ee30d3a485524d diff --git a/test/hashtest.c b/test/hashtest.c index 46a4f423..85248c81 100644 --- a/test/hashtest.c +++ b/test/hashtest.c @@ -1,9 +1,36 @@ +/**************************************************************************** + * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ /* * hashtest.c -- test hash mapping * * Generate timing statistics for vertical-motion optimization. * - * $Id: hashtest.c,v 1.23 2002/10/19 22:11:24 tom Exp $ + * $Id: hashtest.c,v 1.27 2007/07/21 17:45:09 tom Exp $ */ #ifdef TRACE @@ -63,11 +90,11 @@ genlines(int base) move(0, 0); for (i = 0; i < head_lines; i++) for (j = 0; j < COLS; j++) - addch((j % 8 == 0) ? ('A' + j / 8) : '-'); + addch(UChar((j % 8 == 0) ? ('A' + j / 8) : '-')); move(head_lines, 0); for (i = head_lines; i < LINES - foot_lines; i++) { - int c = (base - LO_CHAR + i) % (HI_CHAR - LO_CHAR + 1) + LO_CHAR; + chtype c = (base - LO_CHAR + i) % (HI_CHAR - LO_CHAR + 1) + LO_CHAR; int hi = (extend_corner || (i < LINES - 1)) ? COLS : COLS - 1; for (j = 0; j < hi; j++) addch(c); @@ -76,7 +103,7 @@ genlines(int base) for (i = LINES - foot_lines; i < LINES; i++) { move(i, 0); for (j = 0; j < (extend_corner ? COLS : COLS - 1); j++) - addch((j % 8 == 0) ? ('A' + j / 8) : '-'); + addch(UChar((j % 8 == 0) ? ('A' + j / 8) : '-')); } scrollok(stdscr, TRUE); @@ -163,7 +190,7 @@ main(int argc, char *argv[]) setlocale(LC_ALL, ""); - while ((c = getopt(argc, argv, "cf:h:l:norsx")) != EOF) { + while ((c = getopt(argc, argv, "cf:h:l:norsx")) != -1) { switch (c) { case 'c': continuous = TRUE; @@ -204,7 +231,7 @@ main(int argc, char *argv[]) trace(TRACE_TIMES); #endif - (void) signal(SIGINT, finish); /* arrange interrupts to terminate */ + CATCHALL(finish); /* arrange interrupts to terminate */ (void) initscr(); /* initialize the curses library */ keypad(stdscr, TRUE); /* enable keyboard mapping */