From owner-freebsd-bugs Tue Jul 20 19:10:30 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 1920A1541B for ; Tue, 20 Jul 1999 19:10:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id TAA00875; Tue, 20 Jul 1999 19:10:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from cc158233-a.catv1.md.home.com (cc158233-a.catv1.md.home.com [24.3.25.17]) by hub.freebsd.org (Postfix) with ESMTP id 06E8C14F3B for ; Tue, 20 Jul 1999 19:01:15 -0700 (PDT) (envelope-from sjr@home.net) Received: (from sjr@localhost) by cc158233-a.catv1.md.home.com (8.9.3/8.9.3) id WAA06235; Tue, 20 Jul 1999 22:00:09 -0400 (EDT) (envelope-from sjr) Message-Id: <199907210200.WAA06235@cc158233-a.catv1.md.home.com> Date: Tue, 20 Jul 1999 22:00:09 -0400 (EDT) From: sjr@home.com Reply-To: sjr@home.com To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/12727: Game patches from NetBSD Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 12727 >Category: bin >Synopsis: Game patches from NetBSD >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Jul 20 19:10:01 PDT 1999 >Closed-Date: >Last-Modified: >Originator: Stephen J. Roznowski >Release: FreeBSD 4.0-CURRENT i386 >Organization: >Environment: >Description: Joseph Myers (jsm28@cam.ac.uk) has submitted a series of patches for games to NetBSD. This patch incorporates the following NetBSD patches: bin/7985 - games/adventure/setup.c bug fix bin/7987 - More battlestar(6) spelling fixes bin/7986 - Fish pager handling bin/7992 - Backgammon scoring fix bin/7994 - Wump const fix bin/7993 - dm: patch to use const bin/8005 - Adventure `saved' cleanup bin/8016 - Adventure saved file handling bin/8038 - Atc bug fix bin/8039 - Trek const patch Additionally, for the files that were patched, I deleted all of the "register" declarations. >How-To-Repeat: >Fix: diff -ur games-990720/adventure/hdr.h games-990720+patches/adventure/hdr.h --- games-990720/adventure/hdr.h Sun Apr 18 23:58:42 1999 +++ games-990720+patches/adventure/hdr.h Tue Jul 20 20:54:53 1999 @@ -49,6 +49,9 @@ * * The data file distributed with the fortran source is assumed to be called * "glorkz" in the directory where the program is first run. + * + * The original FORTRAN version can be found at + * . */ /* hdr.h: included by c advent files */ @@ -69,7 +72,7 @@ char *wd1,*wd2; /* the complete words */ int verb,obj,spk; extern int blklin; -int saved,savet,mxscor,latncy; +int saveday,savet,mxscor,latncy; #define SHORT 50 /* How short is a demo game? */ diff -ur games-990720/adventure/main.c games-990720+patches/adventure/main.c --- games-990720/adventure/main.c Sun Apr 18 23:58:42 1999 +++ games-990720+patches/adventure/main.c Tue Jul 20 20:56:36 1999 @@ -60,7 +60,7 @@ char **argv; { extern int errno; - register int i; + int i; int rval,ll; struct text *kk; extern trapdel(); @@ -363,7 +363,7 @@ printf("you will have to wait at least"); printf(" %d minutes before continuing.",latncy); if (!yes(200,54,54)) goto l2012; - datime(&saved,&savet); + datime(&saveday,&savet); ciao(); /* Do we quit? */ continue; /* Maybe not */ case 31: /* hours=8310 */ diff -ur games-990720/adventure/save.c games-990720+patches/adventure/save.c --- games-990720/adventure/save.c Sun Apr 18 23:58:42 1999 +++ games-990720+patches/adventure/save.c Tue Jul 20 20:57:44 1999 @@ -40,6 +40,7 @@ static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93"; #endif /* not lint */ +#include #include #include #include @@ -89,7 +90,7 @@ &oldlc2, sizeof(oldlc2), &oldloc, sizeof(oldloc), &panic, sizeof(panic), - &saved, sizeof(saved), + &saveday, sizeof(saveday), &savet, sizeof(savet), &scorng, sizeof(scorng), &spk, sizeof(spk), @@ -146,7 +147,10 @@ *s = (*s ^ random()) & 0xFF; /* Lightly encrypt */ fwrite(p->address, p->width, 1, out); } - fclose(out); + if (fclose(out) != 0) { + warn("writing %s", outfile); + return 1; + } return 0; } diff -ur games-990720/adventure/setup.c games-990720+patches/adventure/setup.c --- games-990720/adventure/setup.c Sun Apr 18 23:58:42 1999 +++ games-990720+patches/adventure/setup.c Tue Jul 20 20:30:31 1999 @@ -115,5 +115,8 @@ } puts("\n\t0\n};"); fclose(infile); + fflush(stdout); + if (ferror(stdout)) + err(1, "writing standard output"); exit(0); } diff -ur games-990720/adventure/wizard.c games-990720+patches/adventure/wizard.c --- games-990720/adventure/wizard.c Sun Apr 18 23:58:42 1999 +++ games-990720+patches/adventure/wizard.c Tue Jul 20 20:56:20 1999 @@ -79,7 +79,7 @@ { int d,t,delay; datime(&d,&t); - delay=(d-saved)*1440+(t-savet); /* good for about a month */ + delay=(d-saveday)*1440+(t-savet); /* good for about a month */ if (delay >= latncy) { saved = -1; @@ -101,7 +101,7 @@ } wizard() /* not as complex as advent/10 (for now) */ -{ register int wiz; +{ int wiz; char *word,*x; if (!yesm(16,0,7)) return(FALSE); mspeak(17); @@ -115,8 +115,8 @@ } ciao() -{ register char *c; - register int outfd, size; +{ char *c; + int outfd, size; char fname[80], buf[512]; extern unsigned filesize; diff -ur games-990720/atc/grammar.y games-990720+patches/atc/grammar.y --- games-990720/atc/grammar.y Tue Jun 30 14:31:17 1998 +++ games-990720+patches/atc/grammar.y Tue Jul 20 21:09:03 1999 @@ -130,7 +130,7 @@ wdef: WidthOp '=' ConstOp ';' { - if (sp->height != 0) + if (sp->width != 0) return (yyerror("Redefinition of 'width'.")); else if ($3 < 3) return (yyerror("'width' is too small.")); diff -ur games-990720/backgammon/backgammon/main.c games-990720+patches/backgammon/backgammon/main.c --- games-990720/backgammon/backgammon/main.c Sun Apr 18 23:58:51 1999 +++ games-990720+patches/backgammon/backgammon/main.c Tue Jul 20 20:50:01 1999 @@ -94,9 +94,9 @@ char **argv; { - register int i; /* non-descript index */ - register int l; /* non-descript index */ - register char c; /* non-descript character storage */ + int i; /* non-descript index */ + int l; /* non-descript index */ + char c; /* non-descript character storage */ /* revoke privs */ setgid(getgid()); @@ -505,12 +505,12 @@ /* compute game value */ if (tflag) curmove (20,0); - if (*offopp == 15) { + if (*offopp == 15 && *offptr <= 0) { if (mflag) { writel (bgammon); gvalue *= 3; } - else if (*offptr <= 0) { + else { writel (gammon); gvalue *= 2; } diff -ur games-990720/battlestar/com1.c games-990720+patches/battlestar/com1.c --- games-990720/battlestar/com1.c Sun Apr 18 23:58:53 1999 +++ games-990720+patches/battlestar/com1.c Tue Jul 20 20:31:16 1999 @@ -228,7 +228,7 @@ else{ puts("You're out of fuel. We'll have to crash land!"); if (!location[position].down){ - puts("Your viper strikes the ground and explodes into firey fragments."); + puts("Your viper strikes the ground and explodes into fiery fragments."); puts("Thick black smoke billows up from the wreckage."); die(); } diff -ur games-990720/battlestar/com2.c games-990720+patches/battlestar/com2.c --- games-990720/battlestar/com2.c Sun Apr 18 23:58:53 1999 +++ games-990720+patches/battlestar/com2.c Tue Jul 20 20:31:54 1999 @@ -274,7 +274,7 @@ follow() { if (followfight == gtime){ - puts("The Dark Lord leaps away and runs down secret tunnels and corridoors."); + puts("The Dark Lord leaps away and runs down secret tunnels and corridors."); puts("You chase him through the darkness and splash in pools of water."); puts("You have cornered him. His laser sword extends as he steps forward."); position = FINAL; diff -ur games-990720/battlestar/com5.c games-990720+patches/battlestar/com5.c --- games-990720/battlestar/com5.c Sun Apr 18 23:58:53 1999 +++ games-990720+patches/battlestar/com5.c Tue Jul 20 20:34:54 1999 @@ -84,7 +84,7 @@ if (wordtype[wordnumber] == NOUNS && testbit(location[position].objects,wordvalue[wordnumber])){ if (wordvalue[wordnumber] == NORMGOD && !loved) if (godready >= 2){ - puts("She cuddles up to you, and her mouth starts to work:\n'That was my sister's amulet. The lovely goddess, Purl, was she. The Empire\ncaptured her just after the Darkness came. My other sister, Vert, was killed\nby the Dark Lord himself. He took her amulet and warped its power.\nYour quest was foretold by my father before he died, but to get the Dark Lord's\namulet you must use cunning and skill. I will leave you my amulet."); + puts("She cuddles up to you, and her mouth starts to work:\n'That was my sister's amulet. The lovely goddess, Purl, was she. The Empire\ncaptured her just after the Darkness came. My other sister, Vert, was killed\nby the Dark Lord himself. He took her amulet and warped its power.\nYour quest was foretold by my father before he died, but to get the Dark Lord's\namulet you must use cunning and skill. I will leave you my amulet,"); puts("which you may use as you wish. As for me, I am the last goddess of the\nwaters. My father was the Island King, and the rule is rightfully mine.'\n\nShe pulls the throne out into a large bed."); power++; pleasure += 15; @@ -108,7 +108,7 @@ return; } if (wordvalue[wordnumber] == NATIVE){ - puts("The girl is easy prey. She peals off her sarong and indulges you."); + puts("The girl is easy prey. She peels off her sarong and indulges you."); power++; pleasure += 5; printf("Girl:\n"); @@ -293,13 +293,13 @@ power -= 5; if (win >= 3){ puts("The powers of the earth are now legitimate. You have destroyed the Darkness"); - puts("and restored the goddess to her thrown. The entire island celebrates with"); + puts("and restored the goddess to her throne. The entire island celebrates with"); puts("dancing and spring feasts. As a measure of her gratitude, the goddess weds you"); puts("in the late summer and crowns you Prince Liverwort, Lord of Fungus."); puts("\nBut, as the year wears on and autumn comes along, you become restless and"); puts("yearn for adventure. The goddess, too, realizes that the marriage can't last."); puts("She becomes bored and takes several more natives as husbands. One evening,"); - puts("after having been out drinking with the girls, she kicks the throne particulary"); + puts("after having been out drinking with the girls, she kicks the throne particularly"); puts("hard and wakes you up. (If you want to win this game, you're going to have to\nshoot her!)"); clearbit(location[position].objects,MEDALION); wintime = gtime; diff -ur games-990720/battlestar/dayfile.c games-990720+patches/battlestar/dayfile.c --- games-990720/battlestar/dayfile.c Sun Apr 18 23:58:53 1999 +++ games-990720+patches/battlestar/dayfile.c Tue Jul 20 20:35:35 1999 @@ -555,7 +555,7 @@ { "You are on a dirt road.", 173, 93, 174, 175, 82, 0, 0, 0, "The light tan soil of the road contrasts artistically with the lush green\n\ -vegetation and seering blue sky.* There is a clearing and many people +.\n\ +vegetation and searing blue sky.* There is a clearing and many people +.\n\ The road continues - and -.\n" }, { "You are at the seaplane dock.", 93, 0, 176, 177, 82, 0, 0, 0, @@ -751,7 +751,7 @@ off -*, -, and -.\n" }, { "You are at the lagoon.", 118, 0, 170, 166, 81, 0, 0, 0, -"This is a grassy little spot near the water. A sightly native girl is frolicing\n\ +"This is a grassy little spot near the water. A sightly native girl is frolicking\n\ in the water close to shore here.** The path continues - and -. \n" }, { "You are at the lagoon.", 118, 0, 166, 172, 81, 0, 0, 0, diff -ur games-990720/battlestar/globals.c games-990720+patches/battlestar/globals.c --- games-990720/battlestar/globals.c Sun Apr 18 23:58:53 1999 +++ games-990720+patches/battlestar/globals.c Tue Jul 20 20:37:16 1999 @@ -45,7 +45,7 @@ "There is an exquisitely crafted sword and scabbard here.", 0, /* can land from here */ "There is a fierce woodsman here brandishing a heavy mallet.", - "There is an unweildly two-handed sword here.", + "There is an unwieldy two-handed sword here.", "There is a bloody meat cleaver here.", "A rusty broadsword is lying here.", "There is an ancient coat of finely woven mail here.", @@ -89,7 +89,7 @@ "There is a colorful pink potion in a small crystal vial here.", "A gold bracelet is on the ground here.", "A swarthy woman with stern features pulls you aside from the crowd,\n'I must talk to you -- but not here. Meet me at midnight in the gardens.'", - "The swarthy woman has been awaiting you anxiousy. 'I must warn you that the\nIsland has anticipated your Quest. You will not be welcomed. The Darkness is\nstrong where you must search. Seek not the shadows save only at night, for\nthen are they the weakest. In the mountains far from here a canyon winds\nwith ferns and streams and forgotten vines. There you must go. Take this\nrope.'", + "The swarthy woman has been awaiting you anxiously. 'I must warn you that the\nIsland has anticipated your Quest. You will not be welcomed. The Darkness is\nstrong where you must search. Seek not the shadows save only at night, for\nthen are they the weakest. In the mountains far from here a canyon winds\nwith ferns and streams and forgotten vines. There you must go. Take this\nrope.'", "Out from the shadows a figure leaps! His black cape swirls around, and he\nholds a laser sword at your chest. 'So, you have come to fulfill the Quest.\nHa! Your weapons are no match for me!'", "An old timer with one eye missing and no money for a drink sits at the bar.", "You are flying through an asteroid field!", diff -ur games-990720/battlestar/nightfile.c games-990720+patches/battlestar/nightfile.c --- games-990720/battlestar/nightfile.c Sun Apr 18 23:58:53 1999 +++ games-990720+patches/battlestar/nightfile.c Tue Jul 20 20:38:16 1999 @@ -626,7 +626,7 @@ { "You are on the coast road.", 198, 106, 163, 199, 73, 0, 0, 0, "The forest is dense on either side. The trees seem to be actually squeezing\n\ -together to keep us from passing. A feeling of emnity is in the air.**\n\ +together to keep us from passing. A feeling of enmity is in the air.**\n\ The road continues - and -.\n" }, { "You are in the forest.", 116, 107, 91, 106, 73, 0, 0, 0, @@ -758,7 +758,7 @@ **+ and +.\n" }, { "You are in a coconut palm grove.", 223, 121, 224, 225, 82, 0, 0, 0, -"The tall palms are planted about 30 feet apart and the stary sky is clearly\n\ +"The tall palms are planted about 30 feet apart and the starry sky is clearly\n\ visible above. A low growing grass carpets the ground all around. The grove\n\ continues +.***\n" }, { "You are walking along a dirt road.", @@ -870,7 +870,7 @@ runs - and -.\n" }, { "You are on a dirt path around the lagoon.", 170, 147, 146, 0, 74, 0, 0, 0, -"The still waters reflect bending palms and a stary sky. It looks like\n\ +"The still waters reflect bending palms and a starry sky. It looks like\n\ the path runs into a clearing +. The path continues -.**\n" }, { "You are drowning in the lagoon.", 201, 201, 147, 201, 74, 0, 0, 0, @@ -1038,7 +1038,7 @@ "The road goes -* and *-.\n" }, { "You are in a low passage.", 247, 160, 0, 0, 0, 0, 0, 0, -"The ceiling here sparkles with iridiscent gems and minerals. Colorful starfish\n\ +"The ceiling here sparkles with iridescent gems and minerals. Colorful starfish\n\ and sea anemones cling to the slippery walls and floor. The passage continues\n\ +.***\n" }, { "The walls are very close together here.", diff -ur games-990720/dm/dm.c games-990720+patches/dm/dm.c --- games-990720/dm/dm.c Sun Apr 18 23:58:56 1999 +++ games-990720+patches/dm/dm.c Tue Jul 20 20:53:18 1999 @@ -150,9 +150,9 @@ * if day is today, see if okay to play */ c_day(s_day, s_start, s_stop) - char *s_day, *s_start, *s_stop; + const char *s_day, *s_start, *s_stop; { - static char *days[] = { + static const char *days[] = { "sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", }; @@ -182,7 +182,7 @@ * decide if this tty can be used for games. */ c_tty(tty) - char *tty; + const char *tty; { static int first = 1; static char *p_tty; @@ -203,7 +203,7 @@ * see if game can be played now. */ c_game(s_game, s_load, s_users, s_priority) - char *s_game, *s_load, *s_users, *s_priority; + const char *s_game, *s_load, *s_users, *s_priority; { static int found; double load(); @@ -250,7 +250,7 @@ users() { - register int nusers, utmp; + int nusers, utmp; struct utmp buf; if ((utmp = open(_PATH_UTMP, O_RDONLY, 0)) < 0) { @@ -266,7 +266,7 @@ nogamefile() { - register int fd, n; + int fd, n; char buf[BUFSIZ]; if ((fd = open(_PATH_NOGAMES, O_RDONLY, 0)) >= 0) { diff -ur games-990720/fish/fish.c games-990720+patches/fish/fish.c --- games-990720/fish/fish.c Thu Jul 9 02:09:56 1998 +++ games-990720+patches/fish/fish.c Tue Jul 20 20:46:39 1999 @@ -76,6 +76,9 @@ { int ch, move; + /* Revoke setgid privileges */ + setgid(getgid()); + while ((ch = getopt(argc, argv, "p")) != -1) switch(ch) { case 'p': @@ -123,8 +126,8 @@ usermove() { - register int n; - register char **p; + int n; + char **p; char buf[256]; (void)printf("\nYour hand is:"); @@ -194,7 +197,7 @@ promove() { - register int i, max; + int i, max; for (i = 0; i < RANKS; ++i) if (userasked[i] && @@ -293,9 +296,9 @@ chkwinner(player, hand) int player; - register int *hand; + int *hand; { - register int cb, i, ub; + int cb, i, ub; for (i = 0; i < RANKS; ++i) if (hand[i] > 0 && hand[i] < CARDS) @@ -336,7 +339,7 @@ printhand(hand) int *hand; { - register int book, i, j; + int book, i, j; for (book = i = 0; i < RANKS; i++) if (hand[i] < CARDS) @@ -354,9 +357,9 @@ } countcards(hand) - register int *hand; + int *hand; { - register int i, count; + int i, count; for (count = i = 0; i < RANKS; i++) count += *hand++; @@ -381,7 +384,7 @@ init() { - register int i, rank; + int i, rank; for (i = 0; i < RANKS; ++i) deck[i] = CARDS; @@ -408,7 +411,10 @@ instructions() { int input; - char buf[1024]; + pid_t pid; + int fd; + const char *pager; + int status; (void)printf("Would you like instructions (y or n)? "); input = getchar(); @@ -416,8 +422,28 @@ if (input != 'y') return; - (void)sprintf(buf, "%s %s", _PATH_MORE, _PATH_INSTR); - (void)system(buf); + switch (pid = fork()) { + case 0: /* child */ + if (!isatty(1)) + pager = "cat"; + else { + if (!(pager = getenv("PAGER")) || (*pager == 0)) + pager = _PATH_MORE; + } + if ((fd = open(_PATH_INSTR, O_RDONLY)) == -1) + err(1, "open %s", _PATH_INSTR); + if (dup2(fd, 0) == -1) + err(1, "dup2"); + (void)execl("/bin/sh", "sh", "-c", pager, NULL); + err(1, "exec sh -c %s", pager); + /*NOTREACHED*/ + case -1: + err(1, "fork"); + /*NOTREACHED*/ + default: + (void)waitpid(pid, &status, 0); + break; + } (void)printf("Hit return to continue...\n"); while ((input = getchar()) != EOF && input != '\n'); } diff -ur games-990720/trek/computer.c games-990720+patches/trek/computer.c --- games-990720/trek/computer.c Sat May 9 06:39:44 1998 +++ games-990720+patches/trek/computer.c Tue Jul 20 21:11:08 1999 @@ -101,16 +101,16 @@ computer() { int ix, iy; - register int i, j; + int i, j; int numout; int tqx, tqy; - struct cvntab *r; + const struct cvntab *r; int cost; int course; double dist, time; double warpfact; struct quad *q; - register struct event *e; + struct event *e; if (check_out(COMPUTER)) return; @@ -315,7 +315,7 @@ double dx, dy; double quadsize; double angle; - register int course; + int course; /* normalize to quadrant distances */ quadsize = NSECTS; diff -ur games-990720/trek/externs.c games-990720+patches/trek/externs.c --- games-990720/trek/externs.c Sun Sep 4 00:03:24 1994 +++ games-990720+patches/trek/externs.c Tue Jul 20 21:11:46 1999 @@ -41,7 +41,7 @@ ** global variable definitions */ -struct device Device[NDEV] = +const struct device Device[NDEV] = { "warp drive", "Scotty", "S.R. scanners", "Scotty", @@ -61,7 +61,7 @@ "*ERR 15*", "Nobody" }; -char *Systemname[NINHAB] = +const char *const Systemname[NINHAB] = { "ERROR", "Talos IV", diff -ur games-990720/trek/getpar.c games-990720+patches/trek/getpar.c --- games-990720/trek/getpar.c Sat May 9 06:39:45 1998 +++ games-990720+patches/trek/getpar.c Tue Jul 20 21:14:23 1999 @@ -43,10 +43,10 @@ **/ getintpar(s) -char *s; +const char *s; { - register int i; - int n; + int i; + int n; while (1) { @@ -67,10 +67,10 @@ **/ double getfltpar(s) -char *s; +const char *s; { - register int i; - double d; + int i; + double d; while (1) { @@ -90,7 +90,7 @@ ** get yes/no parameter **/ -struct cvntab Yntab[] = +const struct cvntab Yntab[] = { "y", "es", (int (*)())1, 0, "n", "o", (int (*)())0, 0, @@ -98,9 +98,9 @@ }; getynpar(s) -char *s; +const char *s; { - struct cvntab *r; + const struct cvntab *r; r = getcodpar(s, Yntab); return ((long) r->value); @@ -111,14 +111,14 @@ ** get coded parameter **/ -struct cvntab *getcodpar(s, tab) -char *s; -struct cvntab tab[]; +const struct cvntab *getcodpar(s, tab) +const char *s; +const struct cvntab tab[]; { char input[100]; - register struct cvntab *r; + const struct cvntab *r; int flag; - register char *p, *q; + const char *p, *q; int c; int f; @@ -189,14 +189,14 @@ **/ getstrpar(s, r, l, t) -char *s; -char *r; -int l; -char *t; -{ - register int i; - char format[20]; - register int f; +const char *s; +char *r; +int l; +const char *t; +{ + int i; + char format[20]; + int f; if (t == 0) t = " \t\n;"; @@ -223,7 +223,7 @@ testnl() { - register char c; + char c; while ((c = cgetc(0)) != '\n') if ((c >= '0' && c <= '9') || c == '.' || c == '!' || @@ -259,7 +259,7 @@ testterm() { - register char c; + char c; if (!(c = cgetc(0))) return (1); @@ -282,7 +282,7 @@ readdelim(d) char d; { - register char c; + char c; while (c = cgetc(0)) { diff -ur games-990720/trek/getpar.h games-990720+patches/trek/getpar.h --- games-990720/trek/getpar.h Sun Sep 4 00:03:24 1994 +++ games-990720+patches/trek/getpar.h Tue Jul 20 21:31:31 1999 @@ -41,5 +41,5 @@ int value2; }; -extern double getfltpar(); -extern struct cvntab *getcodpar(); +extern double getfltpar(); +extern const struct cvntab *getcodpar(); diff -ur games-990720/trek/help.c games-990720+patches/trek/help.c --- games-990720/trek/help.c Sun Sep 4 00:03:24 1994 +++ games-990720+patches/trek/help.c Tue Jul 20 21:15:17 1999 @@ -57,15 +57,15 @@ ** to drop you. After that, it's your problem. */ -char *Cntvect[3] = +const char *const Cntvect[3] = {"first", "second", "third"}; help() { - register int i; - double dist, x; - register int dx, dy; - int j, l; + int i; + double dist, x; + int dx, dy; + int j, l; /* check to see if calling for help is reasonable ... */ if (Ship.cond == DOCKED) diff -ur games-990720/trek/kill.c games-990720+patches/trek/kill.c --- games-990720/trek/kill.c Sun Sep 4 00:03:24 1994 +++ games-990720+patches/trek/kill.c Tue Jul 20 21:32:45 1999 @@ -56,7 +56,7 @@ killk(ix, iy) int ix, iy; { - register int i, j; + int i, j; printf(" *** Klingon at %d,%d destroyed ***\n", ix, iy); @@ -96,8 +96,8 @@ killb(qx, qy) int qx, qy; { - register struct quad *q; - register struct xy *b; + struct quad *q; + struct xy *b; q = &Quad[qx][qy]; @@ -144,10 +144,9 @@ int x, y; /* quad coords if f == 0, else sector coords */ int f; /* f != 0 -- this quad; f < 0 -- Enterprise's fault */ { - register struct quad *q; - register struct event *e; - register char *name; - char *systemname(); + struct quad *q; + struct event *e; + const char *name; if (f) { @@ -188,9 +187,9 @@ int x, y; /* quadrant coordinates */ int f; /* set if user is to be informed */ { - register struct event *e; - register int i; - register struct quad *q; + struct event *e; + int i; + struct quad *q; q = &Quad[x][y]; for (i = 0; i < MAXEVENTS; i++) diff -ur games-990720/trek/lose.c games-990720+patches/trek/lose.c --- games-990720/trek/lose.c Sun Sep 4 00:03:24 1994 +++ games-990720+patches/trek/lose.c Tue Jul 20 21:16:23 1999 @@ -46,7 +46,7 @@ ** actions which need be taken are taken. */ -char *Losemsg[] = +const char *Losemsg[] = { "You ran out of time", "You ran out of energy", diff -ur games-990720/trek/out.c games-990720+patches/trek/out.c --- games-990720/trek/out.c Sun Sep 4 00:03:25 1994 +++ games-990720+patches/trek/out.c Tue Jul 20 21:16:46 1999 @@ -44,7 +44,7 @@ out(dev) int dev; { - register struct device *d; + const struct device *d; d = &Device[dev]; printf("%s reports %s ", d->person, d->name); diff -ur games-990720/trek/phaser.c games-990720+patches/trek/phaser.c --- games-990720/trek/phaser.c Sat May 9 06:39:46 1998 +++ games-990720+patches/trek/phaser.c Tue Jul 20 21:17:21 1999 @@ -89,19 +89,19 @@ phaser() { - register int i; + int i; int j; - register struct kling *k; + struct kling *k; double dx, dy; double anglefactor, distfactor; - register struct banks *b; + struct banks *b; int manual, flag, extra; int hit; double tot; int n; int hitreqd[NBANKS]; struct banks bank[NBANKS]; - struct cvntab *ptr; + const struct cvntab *ptr; if (Ship.cond == DOCKED) return(printf("Phasers cannot fire through starbase shields\n")); diff -ur games-990720/trek/play.c games-990720+patches/trek/play.c --- games-990720/trek/play.c Sun Sep 4 00:03:25 1994 +++ games-990720+patches/trek/play.c Tue Jul 20 21:18:00 1999 @@ -54,7 +54,7 @@ warp(), dumpgame(), rest(), srscan(), myreset(), torped(), visual(), setwarp(), undock(), phaser(); -struct cvntab Comtab[] = +const struct cvntab Comtab[] = { "abandon", "", abandon, 0, "ca", "pture", capture, 0, @@ -91,7 +91,7 @@ play() { - struct cvntab *r; + const struct cvntab *r; while (1) { diff -ur games-990720/trek/setup.c games-990720+patches/trek/setup.c --- games-990720/trek/setup.c Sat May 9 06:39:47 1998 +++ games-990720+patches/trek/setup.c Tue Jul 20 21:18:55 1999 @@ -50,7 +50,7 @@ ** Game restart and tournament games are handled here. */ -struct cvntab Lentab[] = +const struct cvntab Lentab[] = { "s", "hort", (int (*)())1, 0, "m", "edium", (int (*)())2, 0, @@ -59,7 +59,7 @@ 0 }; -struct cvntab Skitab[] = +const struct cvntab Skitab[] = { "n", "ovice", (int (*)())1, 0, "f", "air", (int (*)())2, 0, @@ -72,14 +72,14 @@ setup() { - struct cvntab *r; - register int i, j; + const struct cvntab *r; + int i, j; double f; int d; int fd; int klump; int ix, iy; - register struct quad *q; + struct quad *q; struct event *e; while (1) diff -ur games-990720/trek/shield.c games-990720+patches/trek/shield.c --- games-990720/trek/shield.c Sat May 9 06:39:48 1998 +++ games-990720+patches/trek/shield.c Tue Jul 20 21:19:45 1999 @@ -55,7 +55,7 @@ ** so you get partial hits. */ -struct cvntab Udtab[] = +const struct cvntab Udtab[] = { "u", "p", (int (*)())1, 0, "d", "own", 0, 0, @@ -65,11 +65,11 @@ shield(f) int f; { - register int i; + int i; char c; - struct cvntab *r; + const struct cvntab *r; char s[100]; - char *device, *dev2, *dev3; + const char *device, *dev2, *dev3; int ind; char *stat; diff -ur games-990720/trek/srscan.c games-990720+patches/trek/srscan.c --- games-990720/trek/srscan.c Sun Sep 4 00:03:26 1994 +++ games-990720+patches/trek/srscan.c Tue Jul 20 21:20:24 1999 @@ -53,7 +53,7 @@ ** The current quadrant is filled in on the computer chart. */ -char *Color[4] = +const char *Color[4] = { "GREEN", "DOCKED", @@ -64,14 +64,14 @@ srscan(f) int f; { - register int i, j; - register int statinfo; - char *s; + int i, j; + int statinfo; + const char *s; int percent; struct quad *q; extern struct cvntab Skitab[]; extern struct cvntab Lentab[]; - struct cvntab *p; + const struct cvntab *p; if (f >= 0 && check_out(SRSCAN)) { diff -ur games-990720/trek/systemname.c games-990720+patches/trek/systemname.c --- games-990720/trek/systemname.c Sun Sep 4 00:03:26 1994 +++ games-990720+patches/trek/systemname.c Tue Jul 20 21:33:47 1999 @@ -48,11 +48,11 @@ ** starsystems, etc. */ -char *systemname(q1) +const char *systemname(q1) struct quad *q1; { - register struct quad *q; - register int i; + const struct quad *q; + int i; q = q1; diff -ur games-990720/trek/trek.h games-990720+patches/trek/trek.h --- games-990720/trek/trek.h Tue Jun 30 15:08:19 1998 +++ games-990720+patches/trek/trek.h Tue Jul 20 21:30:36 1999 @@ -96,7 +96,7 @@ */ /* ascii names of systems */ -extern char *Systemname[NINHAB]; +extern const char *const Systemname[NINHAB]; /* quadrant definition */ struct quad Quad[NQUADS][NQUADS]; @@ -138,11 +138,11 @@ /* device names */ struct device { - char *name; /* device name */ - char *person; /* the person who fixes it */ + const char *name; /* device name */ + const char *person; /* the person who fixes it */ }; -struct device Device[NDEV]; +const struct device Device[NDEV]; /*************************** EVENTS ****************************/ @@ -247,7 +247,7 @@ int secty; /* sector y coord */ char cond; /* condition code */ char sinsbad; /* Space Inertial Navigation System condition */ - char *shipname; /* name of current starship */ + const char *shipname; /* name of current starship */ char ship; /* current starship */ int distressed; /* number of distress calls */ } Ship; @@ -379,4 +379,4 @@ # define xTRACE 1 int Trace; -extern char *systemname(); +extern const char *systemname(); diff -ur games-990720/trek/win.c games-990720+patches/trek/win.c --- games-990720/trek/win.c Sun Sep 4 00:03:29 1994 +++ games-990720+patches/trek/win.c Tue Jul 20 21:23:50 1999 @@ -58,7 +58,7 @@ extern jmp_buf env; extern long score(); extern struct cvntab Skitab[]; - register struct cvntab *p; + const struct cvntab *p; sleep(1); printf("\nCongratulations, you have saved the Federation\n"); diff -ur games-990720/wump/wump.c games-990720+patches/wump/wump.c --- games-990720/wump/wump.c Sun Apr 18 23:59:02 1999 +++ games-990720+patches/wump/wump.c Tue Jul 20 20:51:30 1999 @@ -225,7 +225,7 @@ display_room_stats() { - register int i; + int i; /* * Routine will explain what's going on with the current room, as well @@ -483,7 +483,7 @@ cave_init() { - register int i, j, k, link; + int i, j, k, link; int delta, int_compare(); /* @@ -556,7 +556,7 @@ clear_things_in_cave() { - register int i; + int i; /* * remove bats and pits from the current cave in preparation for us @@ -568,7 +568,7 @@ initialize_things_in_cave() { - register int i, loc; + int i, loc; /* place some bats, pits, the wumpus, and the player. */ for (i = 0; i < bat_num; ++i) { @@ -632,7 +632,7 @@ bats_nearby() { - register int i; + int i; /* check for bats in the immediate vicinity */ for (i = 0; i < link_num; ++i) @@ -643,7 +643,7 @@ pit_nearby() { - register int i; + int i; /* check for pits in the immediate vicinity */ for (i = 0; i < link_num; ++i) @@ -654,7 +654,7 @@ wump_nearby() { - register int i, j; + int i, j; /* check for a wumpus within TWO caves of where we are */ for (i = 0; i < link_num; ++i) { @@ -674,9 +674,9 @@ } int_compare(a, b) - int *a, *b; + const void *a, *b; { - return(*a < *b ? -1 : 1); + return(*(const int *)a < *(const int *)b ? -1 : 1); } instructions() >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message