diff options
author | Rodney W. Grimes <rgrimes@FreeBSD.org> | 1995-05-30 05:51:47 +0000 |
---|---|---|
committer | Rodney W. Grimes <rgrimes@FreeBSD.org> | 1995-05-30 05:51:47 +0000 |
commit | 6c06b4e2aa2a28d1f0bbd29ecdce35aaaf600ce8 (patch) | |
tree | e1331adb5d216f2b3fa6baa6491752348d2e5f10 /lib/libncurses/TESTS | |
parent | a2f0036ac41fe46dd47d6339982567f19437ade9 (diff) |
Notes
Diffstat (limited to 'lib/libncurses/TESTS')
-rw-r--r-- | lib/libncurses/TESTS/Makefile | 4 | ||||
-rw-r--r-- | lib/libncurses/TESTS/battle.c | 78 | ||||
-rw-r--r-- | lib/libncurses/TESTS/copy.c | 2 | ||||
-rw-r--r-- | lib/libncurses/TESTS/ensor.c | 2 | ||||
-rw-r--r-- | lib/libncurses/TESTS/hanoi.c | 4 | ||||
-rw-r--r-- | lib/libncurses/TESTS/knight.c | 14 | ||||
-rw-r--r-- | lib/libncurses/TESTS/ncurses.c | 20 | ||||
-rw-r--r-- | lib/libncurses/TESTS/newdemo.c | 4 | ||||
-rw-r--r-- | lib/libncurses/TESTS/over.c | 4 | ||||
-rw-r--r-- | lib/libncurses/TESTS/rain.c | 2 | ||||
-rw-r--r-- | lib/libncurses/TESTS/scroll2.c | 12 | ||||
-rw-r--r-- | lib/libncurses/TESTS/scroll3.c | 2 | ||||
-rw-r--r-- | lib/libncurses/TESTS/test.c | 6 |
13 files changed, 77 insertions, 77 deletions
diff --git a/lib/libncurses/TESTS/Makefile b/lib/libncurses/TESTS/Makefile index 4136d7437ef1e..d1209821b869b 100644 --- a/lib/libncurses/TESTS/Makefile +++ b/lib/libncurses/TESTS/Makefile @@ -6,9 +6,9 @@ CLEANFILES += $(TESTS) LIBS += -lncurses -lmytinfo -all: $(TESTS) +all: $(TESTS) -$(TESTS): +$(TESTS): $(CC) $(CFLAGS) $(LDFLAGS) ${.CURDIR}/$@.c -o $@ $(LIBS) test: test.c diff --git a/lib/libncurses/TESTS/battle.c b/lib/libncurses/TESTS/battle.c index e7785fccb0358..5b5a9610def55 100644 --- a/lib/libncurses/TESTS/battle.c +++ b/lib/libncurses/TESTS/battle.c @@ -1,4 +1,4 @@ -/* +/* * battle.c - original author: Bruce Holloway * mods by: Chuck A DeGaul */ @@ -91,21 +91,21 @@ main(int argc, char **argv) while(awinna() == -1) { if (!blitz) { if (!salvo) { - if (turn) - cputurn(); + if (turn) + cputurn(); else plyturn(); } else { register int i; i = scount(turn); while (i--) { - if (turn) - if (cputurn()) - if (awinna() != -1) + if (turn) + if (cputurn()) + if (awinna() != -1) i = 0; - else - if(plyturn()) - if (awinna() != -1) + else + if(plyturn()) + if (awinna() != -1) i = 0; } } @@ -141,8 +141,8 @@ char *tmpname; initscr(); savetty(); - nonl(); - cbreak(); + nonl(); + cbreak(); noecho(); clear(); mvaddstr(4,29,"Welcome to Battleship!"); @@ -187,9 +187,9 @@ int i; } for(turn=0; turn<2; ++turn){ for(i=0; i<5; ++i) - if (!turn) + if (!turn) plyplace(&plyship[i]); - else + else cpuplace(&cpuship[i]); } turn = rnd(2); @@ -220,11 +220,11 @@ int c, d; placeship(ss,c,d); } -int +int getdir() { - prompt(); + prompt(); addstr("What direction (0=right, 1=down) ? "); return(sgetc("01")-'0'); } @@ -296,7 +296,7 @@ void error(s) char *s; { - prompt(); + prompt(); beep(); printw("%s -- hit any key to continue --",s); refresh(); @@ -305,7 +305,7 @@ char *s; void prompt(){ - move(22,0); + move(22,0); clrtoeol(); } @@ -319,12 +319,12 @@ redo: do { ch = getch(); if (ch == 0x7F || ch == 8) { - addstr("\b \b"); + addstr("\b \b"); refresh(); goto redo; } } while(ch < '0' || ch > '9'); - addch(x = ch); + addch(x = ch); refresh(); return((y-'A')*10+x-'0'); } @@ -336,7 +336,7 @@ struct _ships *ss; int c, d; do{ - c = rnd(100); + c = rnd(100); d = rnd(2); } while(!checkplace(ss,c,d)); placeship(ss,c,d); @@ -383,8 +383,8 @@ char *m; m = "Have some mercy for my %s!"; break; } - move(23,0); - clrtoeol(); + move(23,0); + clrtoeol(); beep(); printw(m,cpuship[c-1].name); refresh(); return(awinna() == -1); @@ -407,16 +407,16 @@ int sym, i, j; if (!(sym = board[OTHER][c])) return(0); for (i = 0; i < 5; ++i, ++ss) if (ss->symbol == sym) { - j = ss->hits; - ++j; + j = ss->hits; + ++j; ss->hits = j; - if (j == ss->length) + if (j == ss->length) return(i+1); return(0); } } -int +int cputurn() { int c, res, x, y, i, d; @@ -479,8 +479,8 @@ fndir: for(i=0, d=rnd(4); i++ < 4; d = (d+1) % 4){ case 2: --x; break; case 3: --y; break; } - if(x<0 || x>9 || y<0 || y>9){ cstart = -1; - goto redo; + if(x<0 || x>9 || y<0 || y>9){ cstart = -1; + goto redo; } if(!hits[turn][y*10+x]) break; } @@ -517,7 +517,7 @@ fndir: for(i=0, d=rnd(4); i++ < 4; d = (d+1) % 4){ sleep(1); } } - else { + else { if (seemiss) { mvaddch(7+(c/10),3+3*(c%10),' '); } else { @@ -590,18 +590,18 @@ int ch; ch = toupper(getch()); for (s1 = s; *s1 && ch != *s1; ++s1); if (*s1) { - addch(ch); + addch(ch); refresh(); return(ch); } } } -/* +/* * I should use getopts() from libc.a, but I'm leary that other UNIX * systems might not have it, although I'd love to use it. */ - + int do_options(c,op) int c; @@ -654,23 +654,23 @@ register int i; } } fprintf(stdout, "Playing optional game ("); - if (salvo) + if (salvo) fprintf(stdout, "salvo, noblitz, "); else if (blitz) fprintf(stdout, "blitz, nosalvo, "); - else + else fprintf(stdout, "noblitz, nosalvo, "); - if (ask) + if (ask) fprintf(stdout, "ask, "); - else + else fprintf(stdout, "noask, "); - if (seemiss) + if (seemiss) fprintf(stdout, "seemiss)\n"); - else + else fprintf(stdout, "noseemiss)\n"); - } + } else fprintf(stdout, "Playing standard game (no blitz, no slavo, no ask, no seemiss)\n"); diff --git a/lib/libncurses/TESTS/copy.c b/lib/libncurses/TESTS/copy.c index 6ded258b90d27..013f9dbe42376 100644 --- a/lib/libncurses/TESTS/copy.c +++ b/lib/libncurses/TESTS/copy.c @@ -25,7 +25,7 @@ int h, i; getch(); /* now, remove window 2 and restore the contents of window 1 */ - i = copywin(win1, win2, 5, 10, 0, 0, 14, 39, 0); + i = copywin(win1, win2, 5, 10, 0, 0, 14, 39, 0); wnoutrefresh(win1); wnoutrefresh(win2); printw("copywin returns %d\n", i); diff --git a/lib/libncurses/TESTS/ensor.c b/lib/libncurses/TESTS/ensor.c index 7ace03899db98..4eca9cb463c4a 100644 --- a/lib/libncurses/TESTS/ensor.c +++ b/lib/libncurses/TESTS/ensor.c @@ -12,7 +12,7 @@ main() scrollok(stdscr, TRUE); - for (i=0; i<25; i++) + for (i=0; i<25; i++) printw("This is in the background, this should be left alone!\n"); refresh(); diff --git a/lib/libncurses/TESTS/hanoi.c b/lib/libncurses/TESTS/hanoi.c index e7da51d2fa6cc..bf44cc48cc61f 100644 --- a/lib/libncurses/TESTS/hanoi.c +++ b/lib/libncurses/TESTS/hanoi.c @@ -153,10 +153,10 @@ void InitTiles(int NTiles) { int Size, SlotNo; - + for(Size=NTiles*2+1, SlotNo=0; Size>=3; Size-=2) Pegs[0].Length[SlotNo++] = Size; - + Pegs[0].Count = NTiles; Pegs[1].Count = 0; Pegs[2].Count = 0; diff --git a/lib/libncurses/TESTS/knight.c b/lib/libncurses/TESTS/knight.c index cea9183e09470..73f7b42f9d933 100644 --- a/lib/libncurses/TESTS/knight.c +++ b/lib/libncurses/TESTS/knight.c @@ -28,7 +28,7 @@ int xpos[]={0,1,2,1,0,5,4,3,2,4,6,7,8,8,9,10,10,11,12,13,14,15,15,16, 13,23,25,27,27,2,3,4,5,6,7,4,3,2,1,0,1,2,5,4,5,6,6,7,8,9,8,9,10, 11,11,12,13,14,14,15}; -static char *instructions[] = +static char *instructions[] = { " Knight's Tour is a board game for one player. It is played on", "an eight by eight board and is based on the allowable moves that a knight", @@ -59,7 +59,7 @@ void init(void); int play(void); void drawboard(void); void dosquares(void); -void getfirst(void); +void getfirst(void); void getrc(void); void putstars(void); int evalmove(void); @@ -73,7 +73,7 @@ int main () { init (); - for (;;) + for (;;) if (!play ()) { endwin (); exit (0); @@ -91,12 +91,12 @@ init () title (1,23); mvaddstr (23, 25, "Would you like instructions? "); refresh(); - if ((toupper(getch())) == 'Y') + if ((toupper(getch())) == 'Y') instruct(); clear (); } -int +int play () { drawboard (); /* clear screen and drawboard */ @@ -106,7 +106,7 @@ play () getrc(); if (evalmove()) { putstars (); - if (!chkmoves()) + if (!chkmoves()) return (endgame ()); } else beep(); @@ -164,7 +164,7 @@ getfirst () /* get first square */ putstars (); move (23, 0); clrtobot(); -} +} void getrc () /* get row and column */ diff --git a/lib/libncurses/TESTS/ncurses.c b/lib/libncurses/TESTS/ncurses.c index 14630a8c5ffe8..91512360a9da8 100644 --- a/lib/libncurses/TESTS/ncurses.c +++ b/lib/libncurses/TESTS/ncurses.c @@ -42,20 +42,20 @@ char buf[BUFSIZ]; unsigned int c; int incount = 0, firsttime = 0; bool blocking = TRUE; - + refresh(); - + (void) printw("Delay in 10ths of a second (<CR> for blocking input)? "); echo(); getstr(buf); noecho(); - + if (isdigit(buf[0])) { timeout(atoi(buf) * 100); blocking = FALSE; } - + c = '?'; for (;;) { @@ -162,7 +162,7 @@ static void attr_test(void) static char *colors[] = { - "black", + "black", "red", "green", "yellow", @@ -238,7 +238,7 @@ static void color_edit(void) for (i = 0; i < COLORS; i++) { mvprintw(2 + i, 0, "%c %-8s:", - (i == current ? '>' : ' '), + (i == current ? '>' : ' '), (i < sizeof(colors)/sizeof(colors[0]) ? colors[i] : "")); attrset(COLOR_PAIR(i)); addstr(" "); @@ -321,7 +321,7 @@ static void color_edit(void) goto changeit; case '=': - usebase = 0; + usebase = 0; changeit: color_content(current, &red, &green, &blue); if (field == 0) @@ -339,7 +339,7 @@ static void color_edit(void) P(""); P("You are in the RGB value editor. Use the arrow keys to select one of"); P("the fields in one of the RGB triples of the current colors; the one"); - P("currently selected will be reverse-video highlighted."); + P("currently selected will be reverse-video highlighted."); P(""); P("To change a field, enter the digits of the new value; they won't be"); P("echoed. Finish by typing `='; the change will take effect instantly."); @@ -510,7 +510,7 @@ static void acs_display() mvaddstr(ACSY + 10,40, "ACS_LANTERN: "); addch(ACS_LANTERN); mvaddstr(ACSY + 11,40, "ACS_BLOCK: "); addch(ACS_BLOCK); -#define HYBASE (ACSY + 13) +#define HYBASE (ACSY + 13) mvprintw(HYBASE + 1, 0, "High-half characters via echochar:\n"); for (i = 0; i < 4; i++) { @@ -796,7 +796,7 @@ static void panner(WINDOW *pad, int iy, int ix, int (*pgetc)(void)) basey, basex, 0, 0, porty - (hscroll != (WINDOW *)NULL) - 1, - portx - (vscroll != (WINDOW *)NULL) - 1); + portx - (vscroll != (WINDOW *)NULL) - 1); if (vscroll) { int lowend, i, highend; diff --git a/lib/libncurses/TESTS/newdemo.c b/lib/libncurses/TESTS/newdemo.c index 97c368d1bd5d7..5573557b08ec7 100644 --- a/lib/libncurses/TESTS/newdemo.c +++ b/lib/libncurses/TESTS/newdemo.c @@ -1,4 +1,4 @@ -/* $Header: c:/curses/demos/RCS/newdemo.c%v 2.0 1992/11/15 03:32:03 MH Rel $ +/* $Header: /home/ncvs/src/lib/libncurses/TESTS/newdemo.c,v 1.1.1.1 1994/10/07 08:58:56 ache Exp $ * * newdemo.c - A demo program using PDCurses. The program illustrate * the use of colours for text output. @@ -9,7 +9,7 @@ #include <time.h> #include <ncurses.h> -#define delay_output(x) +#define delay_output(x) /* * The Australian map diff --git a/lib/libncurses/TESTS/over.c b/lib/libncurses/TESTS/over.c index 530e48d355748..1f336d4321c7f 100644 --- a/lib/libncurses/TESTS/over.c +++ b/lib/libncurses/TESTS/over.c @@ -13,7 +13,7 @@ * keypress, then removes the top window. With ncurses, * * nothing changes on the display. * *********************************************************************/ - + # include <ncurses.h> /* ncurses include lives here */ main() @@ -54,7 +54,7 @@ main() wnoutrefresh(win1); wnoutrefresh(win2); doupdate(); - + /**************************************************************** * Await a keypress to show what we've done so far. * ****************************************************************/ diff --git a/lib/libncurses/TESTS/rain.c b/lib/libncurses/TESTS/rain.c index 83951ae12746f..9779d0219998e 100644 --- a/lib/libncurses/TESTS/rain.c +++ b/lib/libncurses/TESTS/rain.c @@ -58,7 +58,7 @@ float c; addstr("\\ /"); cursor(xpos[j],ypos[j]+2); addch('-'); - + if (j==0) j=4; else --j; cursor(xpos[j],ypos[j]-2); addch(' '); diff --git a/lib/libncurses/TESTS/scroll2.c b/lib/libncurses/TESTS/scroll2.c index 53abaa3c3801d..e7b2e30939931 100644 --- a/lib/libncurses/TESTS/scroll2.c +++ b/lib/libncurses/TESTS/scroll2.c @@ -6,7 +6,7 @@ main() { int i; WINDOW * w; - + initscr(); cbreak(); @@ -21,7 +21,7 @@ main() mvaddstr (0, 0, "With the original wscrl"); #endif refresh(); - + for (i=0; i<ROWS-1; i++) { @@ -41,7 +41,7 @@ main() } getch(); wclear (w); - + for (i=0; i<ROWS-1; i++) { @@ -49,10 +49,10 @@ main() } mvwaddstr (w, ROWS-1, 0, "Moving two line at a time"); #ifndef LELE - mvaddstr (0, 30, "** THIS FAILS ON MY MACHINE WITH A BUS ERROR + mvaddstr (0, 30, "** THIS FAILS ON MY MACHINE WITH A BUS ERROR **"); #endif - + wrefresh(w); for (i = 0; i < 4; i++) { @@ -84,7 +84,7 @@ main() wrefresh(w); } getch(); - + endwin(); } diff --git a/lib/libncurses/TESTS/scroll3.c b/lib/libncurses/TESTS/scroll3.c index 1d63c464f0285..b2a10c3e213ad 100644 --- a/lib/libncurses/TESTS/scroll3.c +++ b/lib/libncurses/TESTS/scroll3.c @@ -3,7 +3,7 @@ main(int argc, char **argv) { WINDOW *w, *x; - + initscr(); w = newwin(0, 0, 0, 0); if (argc > 2) diff --git a/lib/libncurses/TESTS/test.c b/lib/libncurses/TESTS/test.c index 1fc3e6e9a037b..f77f3a1e751e2 100644 --- a/lib/libncurses/TESTS/test.c +++ b/lib/libncurses/TESTS/test.c @@ -1,14 +1,14 @@ #include <ncurses.h> - + main() { int x, y; initscr(); cbreak(); - nodelay(stdscr, TRUE); - + nodelay(stdscr, TRUE); + for (y = 0; y < 43; y++) for (x =0; x < 132; x++) { move(y,x); |