| Summary: | Game patches from NetBSD | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | sjr <sjr> | ||||
| Component: | bin | Assignee: | Mark Murray <markm> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | 4.0-CURRENT | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
|
Description
sjr
1999-07-21 03:10:01 UTC
Joseph Myers (jsm28@cam.ac.uk) has submitted a series of patches for games to NetBSD. This update incorporates the following NetBSD patches: bin/8056 - Atc memory allocation checks bin/8057 - More backgammon(6) const fixes bin/8062 - Atc: use getopt bin/8080 - Backgammon malloc checks bin/8081 - Backgammon bug fix bin/8085 - Battlestar save file handling 2 bin/8091 - Atc getAChar() cleanup bin/8092 - Backgammon executable save files relic bin/8093 - Bcd const/unsigned fixes bin/8104 - Backgammon trivial fix bin/8102 - Bcd(6) references bin/8103 - Worm display fix bin/8105 - Adventure extern/common fixes Additionally, I've patched the following files to use symbolic values for the lseek() settings: hack/hack.save.c larn/io.c robots/score.c snake/snake/snake.c fortune/fortune/fortune.c Also, for the files that were patched, I deleted all of the "register" declarations. diff -ur games-990720+patches/adventure/hdr.h games-990720+patches2/adventure/hdr.h --- games-990720+patches/adventure/hdr.h Tue Jul 20 20:54:53 1999 +++ games-990720+patches2/adventure/hdr.h Fri Aug 6 22:40:18 1999 @@ -58,9 +58,9 @@ #include <sys/types.h> #include <signal.h> -int datfd; /* message file descriptor */ -volatile sig_atomic_t delhit; -int yea; +extern int datfd; /* message file descriptor */ +extern volatile sig_atomic_t delhit; +extern int yea; extern char data_file[]; /* Virtual data file */ #define TAB 011 @@ -68,18 +68,18 @@ #define FLUSHLINE do { int flushline_ch; while ((flushline_ch = getchar()) != EOF && flushline_ch != '\n'); } while (0) #define FLUSHLF while (next()!=LF) -int loc,newloc,oldloc,oldlc2,wzdark,gaveup,kq,k,k2; -char *wd1,*wd2; /* the complete words */ -int verb,obj,spk; +extern int loc,newloc,oldloc,oldlc2,wzdark,gaveup,kq,k,k2; +extern char *wd1,*wd2; /* the complete words */ +extern int verb,obj,spk; extern int blklin; -int saveday,savet,mxscor,latncy; +extern int saveday,savet,mxscor,latncy; #define SHORT 50 /* How short is a demo game? */ #define MAXSTR 20 /* max length of user's words */ #define HTSIZE 512 /* max number of vocab words */ -struct hashtab /* hash table for vocabulary */ +extern struct hashtab /* hash table for vocabulary */ { int val; /* word type &index (ktab) */ char *atab; /* pointer to actual string */ } voc[HTSIZE]; @@ -87,61 +87,58 @@ #define SEED 1815622 /* "Encryption" seed */ struct text -#ifdef OLDSTUFF -{ int seekadr; /* DATFILE must be < 2**16 */ -#endif OLDSTUFF { char *seekadr; /* Msg start in virtual disk */ int txtlen; /* length of msg starting here */ }; #define RTXSIZ 205 -struct text rtext[RTXSIZ]; /* random text messages */ +extern struct text rtext[RTXSIZ]; /* random text messages */ #define MAGSIZ 35 -struct text mtext[MAGSIZ]; /* magic messages */ +extern struct text mtext[MAGSIZ]; /* magic messages */ -int clsses; +extern int clsses; #define CLSMAX 12 -struct text ctext[CLSMAX]; /* classes of adventurer */ -int cval[CLSMAX]; +extern struct text ctext[CLSMAX]; /* classes of adventurer */ +extern int cval[CLSMAX]; -struct text ptext[101]; /* object descriptions */ +extern struct text ptext[101]; /* object descriptions */ #define LOCSIZ 141 /* number of locations */ -struct text ltext[LOCSIZ]; /* long loc description */ -struct text stext[LOCSIZ]; /* short loc descriptions */ +extern struct text ltext[LOCSIZ]; /* long loc description */ +extern struct text stext[LOCSIZ]; /* short loc descriptions */ -struct travlist /* direcs & conditions of travel*/ +extern struct travlist /* direcs & conditions of travel*/ { struct travlist *next; /* ptr to next list entry */ int conditions; /* m in writeup (newloc / 1000) */ int tloc; /* n in writeup (newloc % 1000) */ int tverb; /* the verb that takes you there*/ } *travel[LOCSIZ],*tkk; /* travel is closer to keys(...)*/ -int atloc[LOCSIZ]; +extern int atloc[LOCSIZ]; -int plac[101]; /* initial object placement */ -int fixd[101],fixed[101]; /* location fixed? */ +extern int plac[101]; /* initial object placement */ +extern int fixd[101],fixed[101]; /* location fixed? */ -int actspk[35]; /* rtext msg for verb <n> */ +extern int actspk[35]; /* rtext msg for verb <n> */ -int cond[LOCSIZ]; /* various condition bits */ +extern int cond[LOCSIZ]; /* various condition bits */ extern int setbit[16]; /* bit defn masks 1,2,4,... */ -int hntmax; -int hints[20][5]; /* info on hints */ -int hinted[20],hintlc[20]; +extern int hntmax; +extern int hints[20][5]; /* info on hints */ +extern int hinted[20],hintlc[20]; -int place[101], prop[101],linkx[201]; -int abb[LOCSIZ]; +extern int place[101], prop[101],linkx[201]; +extern int abb[LOCSIZ]; -int maxtrs,tally,tally2; /* treasure values */ +extern int maxtrs,tally,tally2; /* treasure values */ #define FALSE 0 #define TRUE 1 -int keys,lamp,grate,cage,rod,rod2,steps,/* mnemonics */ +extern int keys,lamp,grate,cage,rod,rod2,steps,/* mnemonics */ bird,door,pillow,snake,fissur,tablet,clam,oyster,magzin, dwarf,knife,food,bottle,water,oil,plant,plant2,axe,mirror,dragon, chasm,troll,troll2,bear,messag,vend,batter, @@ -151,15 +148,15 @@ enter, stream, pour, say,lock,throw,find,invent; -int chloc,chloc2,dseen[7],dloc[7], /* dwarf stuff */ +extern int chloc,chloc2,dseen[7],dloc[7], /* dwarf stuff */ odloc[7],dflag,daltlc; -int tk[21],stick,dtotal,attack; -int turns,lmwarn,iwest,knfloc,detail, /* various flags & counters */ +extern int tk[21],stick,dtotal,attack; +extern int turns,lmwarn,iwest,knfloc,detail, /* various flags & counters*/ abbnum,maxdie,numdie,holdng,dkill,foobar,bonus,clock1,clock2, saved,closng,panic,closed,scorng; -int demo,newloc,limit; +extern int demo,newloc,limit; char *decr(); unsigned long crc(); @@ -167,4 +164,4 @@ /* We need to get a little tricky to avoid strings */ #define DECR(a,b,c,d,e) decr('a'+'+','b'+'-','c'+'#','d'+'&','e'+'%') -gid_t egid; +extern gid_t egid; diff -ur games-990720+patches/adventure/init.c games-990720+patches2/adventure/init.c --- games-990720+patches/adventure/init.c Sun Apr 18 23:58:42 1999 +++ games-990720+patches2/adventure/init.c Fri Aug 6 22:40:58 1999 @@ -53,6 +53,72 @@ int setbit[16] = {1,2,4,010,020,040,0100,0200,0400,01000,02000,04000, 010000,020000,040000,0100000}; +int datfd; /* message file descriptor */ +volatile sig_atomic_t delhit; +int yea; + +int loc, newloc, oldloc, oldlc2, wzdark, gaveup, kq, k, k2; +char *wd1, *wd2; /* the complete words */ +int verb, obj, spk; +int saveday, savet, mxscor, latncy; + +struct hashtab voc[HTSIZE]; + +struct text rtext[RTXSIZ]; /* random text messages */ + +struct text mtext[MAGSIZ]; /* magic messages */ + +int clsses; + +struct text ctext[CLSMAX]; /* classes of adventurer */ +int cval[CLSMAX]; + +struct text ptext[101]; /* object descriptions */ + +struct text ltext[LOCSIZ]; /* long loc description */ +struct text stext[LOCSIZ]; /* short loc descriptions */ + +struct travlist *travel[LOCSIZ], *tkk; /* travel is closer to keys(...) */ + +int atloc[LOCSIZ]; + +int plac[101]; /* initial object placement */ +int fixd[101], fixed[101]; /* location fixed? */ + +int actspk[35]; /* rtext msg for verb <n> */ + +int cond[LOCSIZ]; /* various condition bits */ + +int hntmax; +int hints[20][5]; /* info on hints */ +int hinted[20], hintlc[20]; + +int place[101], prop[101], linkx[201]; +int abb[LOCSIZ]; + +int maxtrs, tally, tally2; /* treasure values */ + +int keys, lamp, grate, cage, rod, rod2, steps, /* mnemonics */ + bird, door, pillow, snake, fissur, tablet, clam, oyster, + magzin, dwarf, knife, food, bottle, water, oil, plant, plant2, + axe, mirror, dragon, chasm, troll, troll2, bear, messag, + vend, batter, nugget, coins, chest, eggs, tridnt, vase, + emrald, pyram, pearl, rug, chain, spices, back, look, cave, + null, entrnc, dprssn, enter, stream, pour, say, lock, throw, + find, invent; + +int chloc, chloc2, dseen[7], dloc[7], /* dwarf stuff */ + odloc[7], dflag, daltlc; + +int tk[21], stick, dtotal, attack; +int turns, lmwarn, iwest, knfloc, detail, /* various flags and + * counters */ + abbnum, maxdie, numdie, holdng, dkill, foobar, bonus, clock1, + clock2, saved, closng, panic, closed, scorng; + +int demo, newloc, limit; + +gid_t egid; init() /* everything for 1st time run */ { diff -ur games-990720+patches/atc/graphics.c games-990720+patches2/atc/graphics.c --- games-990720+patches/atc/graphics.c Sun Apr 18 23:58:50 1999 +++ games-990720+patches2/atc/graphics.c Fri Aug 6 22:17:53 1999 @@ -49,9 +49,7 @@ #include <string.h> #include "include.h" -#ifdef SYSV #include <errno.h> -#endif #define C_TOPBOTTOM '-' #define C_LEFTRIGHT '|' @@ -65,15 +63,14 @@ getAChar() { -#ifdef BSD - return (getchar()); -#endif -#ifdef SYSV int c; - while ((c = getchar()) == -1 && errno == EINTR) ; + errno = 0; + while ((c = getchar()) == -1 && errno == EINTR) { + errno = 0; + clearerr(stdin); + } return(c); -#endif } erase_all() @@ -124,7 +121,7 @@ setup_screen(scp) const C_SCREEN *scp; { - register int i, j; + int i, j; char str[3]; const char *airstr; @@ -381,7 +378,11 @@ wmove(input, 0, 0); wclrtobot(input); - wprintw(input, "Plane '%c' %s\n\nHit space for top players list...", + /* p may be NULL if we ran out of memory */ + if (p == NULL) + wprintw(input, "%s\n\nHit space for top players list...", s); + else + wprintw(input, "Plane '%c' %s\n\nHit space for top players list...", name(p), s); wrefresh(input); fflush(stdout); diff -ur games-990720+patches/atc/main.c games-990720+patches2/atc/main.c --- games-990720+patches/atc/main.c Sun May 2 22:08:18 1999 +++ games-990720+patches2/atc/main.c Fri Aug 6 22:18:34 1999 @@ -54,6 +54,7 @@ #endif /* not lint */ #include <string.h> +#include <unistd.h> #include "include.h" #include "pathnames.h" @@ -65,7 +66,7 @@ int f_usage = 0, f_list = 0, f_showscore = 0; int f_printpath = 0; const char *file = NULL; - char *name, *ptr; + int ch; #ifdef BSD struct itimerval itv; #endif @@ -77,57 +78,41 @@ setregid(getgid(), getgid()); start_time = time(0); - - name = *av++; - while (*av) { -#ifndef SAVEDASH - if (**av == '-') - *++*av; - else + while ((ch = getopt(ac, av, "ulstpg:f:r:")) != -1) { + switch (ch) { + case '?': + case 'u': + default: + f_usage++; + break; + case 'l': + f_list++; + break; + case 's': + case 't': + f_showscore++; + break; + case 'p': + f_printpath++; + break; + case 'r': + seed = atoi(optarg); + break; + case 'f': + case 'g': + file = optarg; break; -#endif - ptr = *av++; - while (*ptr) { - switch (*ptr) { - case '?': - case 'u': - f_usage++; - break; - case 'l': - f_list++; - break; - case 's': - case 't': - f_showscore++; - break; - case 'p': - f_printpath++; - break; - case 'r': - srandom(atoi(*av)); - seed = 1; - av++; - break; - case 'f': - case 'g': - file = *av; - av++; - break; - default: - fprintf(stderr, "Unknown option '%c'\n", *ptr); - f_usage++; - break; - } - ptr++; } } + if (optind < ac) + f_usage++; if (!seed) srandomdev(); if (f_usage) fprintf(stderr, "Usage: %s -[u?lstp] [-[gf] game_name] [-r random seed]\n", - name); + av[0]); if (f_showscore) log_score(1); if (f_list) diff -ur games-990720+patches/atc/update.c games-990720+patches2/atc/update.c --- games-990720+patches/atc/update.c Sun Apr 18 23:58:51 1999 +++ games-990720+patches2/atc/update.c Fri Aug 6 21:42:42 1999 @@ -363,6 +363,8 @@ p.plane_no = pnum; pp = newplane(); + if (pp == NULL) + loser(pp, "Out of memory!"); bcopy(&p, pp, sizeof (p)); if (pp->orig_type == T_AIRPORT) diff -ur games-990720+patches/backgammon/backgammon/main.c games-990720+patches2/backgammon/backgammon/main.c --- games-990720+patches/backgammon/backgammon/main.c Tue Jul 20 20:50:01 1999 +++ games-990720+patches2/backgammon/backgammon/main.c Fri Aug 6 22:07:01 1999 @@ -69,7 +69,7 @@ }; static const char rules[] = "\nDo you want the rules of the game?"; -static const char noteach[] = "Teachgammon not available!\n\007"; +static const char noteach[] = "Teachgammon not available!\n\a"; static const char need[] = "Do you need instructions for this program?"; static const char askcol[] = "Enter 'r' to play red, 'w' to play white, 'b' to play both:"; diff -ur games-990720+patches/backgammon/common_source/fancy.c games-990720+patches2/backgammon/common_source/fancy.c --- games-990720+patches/backgammon/common_source/fancy.c Sun Apr 18 23:58:52 1999 +++ games-990720+patches2/backgammon/common_source/fancy.c Fri Aug 6 22:05:59 1999 @@ -84,7 +84,7 @@ int addbuf __P((int)); fboard () { - register int i, j, l; + int i, j, l; curmove (0,0); /* do top line */ for (i = 0; i < 53; i++) @@ -198,11 +198,11 @@ int cnext; /* direction of position */ { - register int j; /* index */ - register int n; /* number of men on position */ - register int bct; /* counter */ - int k; /* index */ - char pc; /* color of men on position */ + int j; /* index */ + int n; /* number of men on position */ + int bct; /* counter */ + int k; /* index */ + char pc; /* color of men on position */ n = abs(b); /* initialize n and pc */ pc = (b > 0? 'r': 'w'); @@ -252,7 +252,7 @@ } refresh() { - register int i, r, c; + int i, r, c; r = curr; /* save current position */ c = curc; @@ -312,7 +312,7 @@ int old, new, r, c, inc; { - register int o, n, nv; + int o, n, nv; int ov, nc; char col; @@ -379,11 +379,11 @@ } fixcol (r,c,l,ch,inc) -register int l, ch; -int r, c, inc; +int l, ch; +int r, c, inc; { - register int i; + int i; curmove (r,c); fancyc (ch); @@ -394,7 +394,7 @@ } curmove (r,c) -register int r, c; +int r, c; { if (curr == r && curc == c) @@ -408,9 +408,9 @@ } newpos () { - register int r; /* destination row */ - register int c; /* destination column */ - register int mode = -1; /* mode of movement */ + int r; /* destination row */ + int c; /* destination column */ + int mode = -1; /* mode of movement */ int count = 1000; /* character count */ int i; /* index */ @@ -575,7 +575,7 @@ } clear () { - register int i; + int i; /* double space if can't clear */ if (CL == 0) { @@ -593,9 +593,9 @@ fancyc (c) -register char c; /* character to output */ +char c; /* character to output */ { - register int sp; /* counts spaces in a tab */ + int sp; /* counts spaces in a tab */ if (c == '\007') { /* bells go in blindly */ addbuf (c); @@ -649,8 +649,8 @@ } clend() { - register int i; - register char *s; + int i; + char *s; if (CD) { @@ -671,9 +671,9 @@ } cline () { - register int i; - register int c; - register char *s; + int i; + int c; + char *s; if (curc > linect[curr]) return; @@ -705,10 +705,10 @@ const char *s; { - register char *code; /* two letter code */ - register char ***cap; /* pointer to cap string */ - char *bufp; /* pointer to cap buffer */ - char tentry[1024]; /* temporary uncoded caps buffer */ + char *code; /* two letter code */ + char ***cap; /* pointer to cap string */ + char *bufp; /* pointer to cap buffer */ + char tentry[1024]; /* temporary uncoded caps buffer */ tgetent (tentry, (char *)s); /* get uncoded termcap entry */ @@ -745,5 +745,9 @@ if (LI < 24 || CO < 72 || !(CL && UP && ND)) return (0); linect = (int *)calloc (LI+1,sizeof(int)); + if (linect == NULL) { + write(2, "\r\nOut of memory!\r\n", 18); + getout(0); + } return (1); } diff -ur games-990720+patches/backgammon/common_source/save.c games-990720+patches2/backgammon/common_source/save.c --- games-990720+patches/backgammon/common_source/save.c Sun Apr 18 23:58:52 1999 +++ games-990720+patches2/backgammon/common_source/save.c Fri Aug 6 22:04:46 1999 @@ -51,12 +51,12 @@ static const char cantrec[] = "Can't recover file: "; save (n) -register int n; +int n; { - register int fdesc; - register char *fs; - char fname[50]; + int fdesc; + char *fs; + char fname[50]; if (n) { if (tflag) { @@ -104,7 +104,7 @@ close (fdesc); if (yorn (0)) { unlink (fname); - fdesc = creat (fname,0700); + fdesc = creat (fname,0600); break; } else { cflag = 1; @@ -146,7 +146,7 @@ const char *s; { - register int i; + int i; int fdesc; if ((fdesc = open (s,O_RDONLY)) == -1) diff -ur games-990720+patches/backgammon/common_source/subs.c games-990720+patches2/backgammon/common_source/subs.c --- games-990720+patches/backgammon/common_source/subs.c Sun Apr 18 23:58:52 1999 +++ games-990720+patches2/backgammon/common_source/subs.c Fri Aug 6 22:05:10 1999 @@ -61,7 +61,7 @@ }; errexit (s) -register char *s; +char *s; { write (2,"\n",1); perror (s); @@ -69,7 +69,7 @@ } int addbuf (c) -register int c; +int c; { buffnum++; @@ -167,7 +167,7 @@ wrint (n) int n; { - register int i, j, t; + int i, j, t; for (i = 4; i > 0; i--) { t = 1; @@ -180,7 +180,7 @@ } gwrite() { - register int r, c; + int r, c; if (tflag) { r = curr; @@ -222,7 +222,7 @@ } quit () { - register int i; + int i; if (tflag) { curmove (20,0); @@ -243,10 +243,10 @@ } yorn (special) -register char special; /* special response */ +char special; /* special response */ { - register char c; - register int i; + char c; + int i; i = 1; while ( (c = readc()) != 'Y' && c != 'N') { @@ -273,7 +273,7 @@ } wrhit (i) -register int i; +int i; { writel ("Blot hit on "); wrint (i); @@ -282,7 +282,7 @@ } nexturn () { - register int c; + int c; cturn = -cturn; c = cturn/abs(cturn); @@ -297,11 +297,11 @@ } getarg (argc, argv) -register int argc; -register char **argv; +int argc; +char **argv; { - register char ch; + char ch; extern int optind; extern char *optarg; int i; @@ -367,7 +367,11 @@ case 's': /* recover file */ - recover (optarg); + if (optarg == NULL) { + writel("No save file named\n"); + getout(0); + } else + recover (optarg); break; case 'h': for (i = 0; descr[i] != 0; i++) @@ -382,7 +386,7 @@ } init () { - register int i; + int i; for (i = 0; i < 26;) board[i++] = 0; board[1] = 2; @@ -433,9 +437,9 @@ exit(0); } roll () { - register char c; - register int row; - register int col; + char c; + int row; + int col; if (iroll) { if (tflag) { diff -ur games-990720+patches/backgammon/teachgammon/ttext1.c games-990720+patches2/backgammon/teachgammon/ttext1.c --- games-990720+patches/backgammon/teachgammon/ttext1.c Sun Apr 18 23:58:52 1999 +++ games-990720+patches2/backgammon/teachgammon/ttext1.c Fri Aug 6 21:46:05 1999 @@ -37,8 +37,8 @@ #include "back.h" -const char *opts = " QIMRHEDSPT"; -const char *prompt = "-->"; +const char *const opts = " QIMRHEDSPT"; +const char *const prompt = "-->"; const char *const list[] = { "\n\n\tI\tIntroduction to Backgammon", diff -ur games-990720+patches/battlestar/battlestar.6 games-990720+patches2/battlestar/battlestar.6 --- games-990720+patches/battlestar/battlestar.6 Mon Jul 12 16:30:17 1999 +++ games-990720+patches2/battlestar/battlestar.6 Fri Aug 6 23:09:11 1999 @@ -39,7 +39,10 @@ .SH SYNOPSIS .B battlestar [ -.B -r (recover a saved game) +.B -r +] +[ +.B saved-file ] .br .fi @@ -129,10 +132,12 @@ in the game. .SH "SAVING A GAME" -The command "save" will save your game in a file called "Bstar." You -can -recover a saved game by using the "-r" option when you start up the -game. +The command "save" will save your game in a file, by default called +".Bstar" in your home directory. You +can recover a saved game by using the +.B -r +option when you start up the +game, or by giving the name of the saved file as an argument. .SH DIRECTIONS The compass directions N, S, E, and W can be used if you have a compass. If you don't have a compass, you'll have to say R, L, A, or B, which diff -ur games-990720+patches/battlestar/battlestar.c games-990720+patches2/battlestar/battlestar.c --- games-990720+patches/battlestar/battlestar.c Sun Apr 18 23:58:53 1999 +++ games-990720+patches2/battlestar/battlestar.c Fri Aug 6 23:10:30 1999 @@ -62,7 +62,9 @@ /* revoke privs. */ setgid(getgid()); - initialize(argc < 2 || strcmp(argv[1], "-r")); + initialize((argc < 2) ? NULL : (strcmp(argv[1], "-r") ? argv[1] + : (argv[2] ? argv[2] + : DEFAULT_SAVE_FILE))); start: news(); beenthere[position]++; diff -ur games-990720+patches/battlestar/cypher.c games-990720+patches2/battlestar/cypher.c --- games-990720+patches/battlestar/cypher.c Sun Apr 18 23:58:53 1999 +++ games-990720+patches2/battlestar/cypher.c Fri Aug 6 23:16:54 1999 @@ -39,10 +39,12 @@ cypher() { - register int n; + int n; int junk; int lflag = -1; char buffer[10]; + char *filename, *rfilename; + size_t filename_len; while (wordtype[wordnumber] == ADJS) wordnumber++; @@ -339,7 +341,21 @@ break; case SAVE: - save(); + printf("\nSave file name (default %s) ", + DEFAULT_SAVE_FILE); + filename = fgetln(stdin, &filename_len); + if (filename_len == 0 + || (filename_len == 1 && filename[0] == '\n')) + rfilename = save_file_name(DEFAULT_SAVE_FILE, + strlen(DEFAULT_SAVE_FILE)); + else { + if (filename[filename_len - 1] == '\n') + filename_len--; + rfilename = save_file_name(filename, + filename_len); + } + save(rfilename); + free(rfilename); break; case FOLLOW: diff -ur games-990720+patches/battlestar/externs.h games-990720+patches2/battlestar/externs.h --- games-990720+patches/battlestar/externs.h Sun Apr 18 23:58:53 1999 +++ games-990720+patches2/battlestar/externs.h Fri Aug 6 23:19:31 1999 @@ -38,6 +38,7 @@ #include <sys/signal.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #define BITS (8) @@ -302,3 +303,5 @@ extern const struct objs nightobjs[]; gid_t egid; + +#define DEFAULT_SAVE_FILE ".Bstar" diff -ur games-990720+patches/battlestar/init.c games-990720+patches2/battlestar/init.c --- games-990720+patches/battlestar/init.c Sun Apr 18 23:58:53 1999 +++ games-990720+patches2/battlestar/init.c Fri Aug 6 23:31:34 1999 @@ -41,10 +41,12 @@ #include <string.h> initialize(startup) - char startup; + const char *startup; { const struct objs *p; + char *savefile; void die(); + char *save_file_name(); puts("Version 4.2, fall 1984."); puts("First Adventure game written by His Lordship, the honorable"); @@ -55,7 +57,7 @@ location = dayfile; wiz = wizard(uname); wordinit(); - if (startup) { + if (startup == NULL) { direction = NORTH; gtime = 0; snooze = CYCLE * 1.5; @@ -65,8 +67,11 @@ torps = TORPEDOES; for (p = dayobjs; p->room != 0; p++) setbit(location[p->room].objects, p->obj); - } else - restore(); + } else { + savefile = save_file_name(startup, strlen(startup)); + restore(savefile); + free(savefile); + } signal(SIGINT, die); } diff -ur games-990720+patches/battlestar/save.c games-990720+patches2/battlestar/save.c --- games-990720+patches/battlestar/save.c Sun Apr 18 23:58:54 1999 +++ games-990720+patches2/battlestar/save.c Fri Aug 6 23:30:32 1999 @@ -44,21 +44,17 @@ #include "externs.h" void -restore() +restore(filename) +const char *filename; { - char *home; - char home1[MAXPATHLEN]; - register int n; + int n; int tmp; - register FILE *fp; - - if ( (home = getenv("HOME")) != NULL) - sprintf(home1, "%.*s/Bstar", MAXPATHLEN - 7, home); - else return; + FILE *fp; - if ((fp = fopen(home1, "r")) == 0) { - perror(home1); - return; + if (filename == NULL) + exit(1); /* Error determining save file name. */ + if ((fp = fopen(filename, "r")) == 0) { + err(1, "fopen %s", filename); } fread(&WEIGHT, sizeof WEIGHT, 1, fp); fread(&CUMBER, sizeof CUMBER, 1, fp); @@ -96,30 +92,27 @@ fread(&power, sizeof power, 1, fp); /* We must check the last read, to catch truncated save files. */ if (fread(&ego, sizeof ego, 1, fp) < 1) - errx(1, "save file %s too short", home1); + errx(1, "save file %s too short", filename); fclose(fp); } void -save() +save(filename) +const char *filename; { struct stat sbuf; - char *home; - char home1[MAXPATHLEN]; - register int n; + int n; int tmp, fd; FILE *fp; - home = getenv("HOME"); - if (home == 0) - return; - sprintf(home1, "%.*s/Bstar", MAXPATHLEN - 7, home); + if (filename == NULL) + return; /* Error determining save file name. */ /* Try to open the file safely. */ - if (stat(home1, &sbuf) < 0) { - fd = open(home1, O_WRONLY|O_CREAT|O_EXCL, 0600); + if (stat(filename, &sbuf) < 0) { + fd = open(filename, O_WRONLY|O_CREAT|O_EXCL, 0600); if (fd < 0) { - fprintf(stderr, "Can't create %s\n", home1); + fprintf(stderr, "Can't create %s\n", filename); return; } } else { @@ -128,19 +121,19 @@ return; } - fd = open(home1, O_WRONLY|O_EXCL); + fd = open(filename, O_WRONLY|O_EXCL); if (fd < 0) { - fprintf(stderr, "Can't open %s for writing\n", home1); + fprintf(stderr, "Can't open %s for writing\n", filename); return; } } if ((fp = fdopen(fd, "w")) == 0) { - perror(home1); + perror(filename); return; } - printf("Saved in %s.\n", home1); + printf("Saved in %s.\n", filename); fwrite(&WEIGHT, sizeof WEIGHT, 1, fp); fwrite(&CUMBER, sizeof CUMBER, 1, fp); fwrite(&gclock, sizeof gclock, 1, fp); @@ -176,4 +169,53 @@ fwrite(&pleasure, sizeof pleasure, 1, fp); fwrite(&power, sizeof power, 1, fp); fwrite(&ego, sizeof ego, 1, fp); +} + +/* + * Given a save file name (possibly from fgetln, so without terminating NUL), + * determine the name of the file to be saved to by adding the HOME + * directory if the name does not contain a slash. Name will be allocated + * with malloc(3). + */ +char * +save_file_name(filename, len) + const char *filename; + size_t len; +{ + char *home; + char *newname; + size_t tmpl; + + if (memchr(filename, '/', len)) { + newname = malloc(len + 1); + if (newname == NULL) { + warnx("out of memory"); + return NULL; + } + memcpy(newname, filename, len); + newname[len] = 0; + } else { + home = getenv("HOME"); + if (home != NULL) { + tmpl = strlen(home); + newname = malloc(tmpl + len + 2); + if (newname == NULL) { + warnx("out of memory"); + return NULL; + } + memcpy(newname, home, tmpl); + newname[tmpl] = '/'; + memcpy(newname + tmpl + 1, filename, len); + newname[tmpl + len + 1] = 0; + } else { + newname = malloc(len + 1); + if (newname == NULL) { + warnx("out of memory"); + return NULL; + } + memcpy(newname, filename, len); + newname[len] = 0; + } + } + return newname; } diff -ur games-990720+patches/bcd/bcd.6 games-990720+patches2/bcd/bcd.6 --- games-990720+patches/bcd/bcd.6 Mon Jul 12 16:30:18 1999 +++ games-990720+patches2/bcd/bcd.6 Fri Aug 6 22:09:14 1999 @@ -141,3 +141,17 @@ .Pp Sends a bit slower than it should due to system overhead. Some people would call this a feature. +.Sh SEE ALSO +.Rs +.%B "ISO 1681:1973: Information processing--Unpunched paper cards--Specification" +.Re +.Rs +.%B "ISO 1682:1973: Information processing--80 columns punched paper cards--Dimensions and location of rectangular punched holes" +.Re +.Rs +.%B "ECMA-10: ECMA Standard for Data Interchange on Punched Tape" +.Re +.Rs +.%B "ITU-T Recommendation F.1: Operational provisions for the international public telegram service" +.%O "Division B, I. Morse code" +.Re diff -ur games-990720+patches/bcd/bcd.c games-990720+patches2/bcd/bcd.c --- games-990720+patches/bcd/bcd.c Sun Apr 18 23:58:54 1999 +++ games-990720+patches2/bcd/bcd.c Fri Aug 6 22:03:19 1999 @@ -80,7 +80,7 @@ #include <string.h> #include <ctype.h> -u_short holes[256] = { +const u_short holes[256] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, @@ -147,11 +147,11 @@ #define COLUMNS 48 printcard(str) - register char *str; + char *str; { - static char rowchars[] = " 123456789"; - register int i, row; - register char *p; + static const char rowchars[] = " 123456789"; + int i, row; + unsigned char *p; char *index(); /* ruthlessly remove newlines and truncate at 48 characters. */ diff -ur games-990720+patches/fortune/fortune/fortune.c games-990720+patches2/fortune/fortune/fortune.c --- games-990720+patches/fortune/fortune/fortune.c Fri Jun 11 00:36:16 1999 +++ games-990720+patches2/fortune/fortune/fortune.c Fri Aug 6 22:55:42 1999 @@ -240,8 +240,8 @@ display(fp) FILEDESC *fp; { - register char *p; - register unsigned char ch; + char *p; + unsigned char ch; char line[BUFSIZ]; open_fp(fp); @@ -269,7 +269,7 @@ int fortlen() { - register int nchar; + int nchar; char line[BUFSIZ]; if (!(Fortfile->tbl.str_flags & (STR_RANDOM | STR_ORDERED))) @@ -291,12 +291,12 @@ */ void getargs(argc, argv) -register int argc; -register char **argv; +int argc; +char **argv; { - register int ignore_case; + int ignore_case; # ifndef NO_REGEX - register char *pat; + char *pat; # endif /* NO_REGEX */ extern char *optarg; extern int optind; @@ -395,11 +395,11 @@ */ int form_file_list(files, file_cnt) -register char **files; -register int file_cnt; +char **files; +int file_cnt; { - register int i, percent; - register char *sp; + int i, percent; + char *sp; if (file_cnt == 0) if (Find_files) { @@ -459,16 +459,16 @@ int add_file(percent, file, dir, head, tail, parent) int percent; -register char *file; +char *file; char *dir; FILEDESC **head, **tail; FILEDESC *parent; { - register FILEDESC *fp; - register int fd; - register char *path, *offensive; - register bool was_malloc; - register bool isdir; + FILEDESC *fp; + int fd; + char *path, *offensive; + bool was_malloc; + bool isdir; if (dir == NULL) { path = file; @@ -589,7 +589,7 @@ FILEDESC * new_fp() { - register FILEDESC *fp; + FILEDESC *fp; fp = (FILEDESC *) do_malloc(sizeof *fp); fp->datfd = -1; @@ -642,13 +642,13 @@ */ void all_forts(fp, offensive) -register FILEDESC *fp; -char *offensive; +FILEDESC *fp; +char *offensive; { - register char *sp; - register FILEDESC *scene, *obscene; - register int fd; - auto char *datfile, *posfile; + char *sp; + FILEDESC *scene, *obscene; + int fd; + auto char *datfile, *posfile; if (fp->child != NULL) /* this is a directory, not a file */ return; @@ -692,10 +692,10 @@ */ int add_dir(fp) -register FILEDESC *fp; +FILEDESC *fp; { - register DIR *dir; - register struct dirent *dirent; + DIR *dir; + struct dirent *dirent; auto FILEDESC *tailp; auto char *name; @@ -753,9 +753,9 @@ char *file, **datp, **posp; int check_for_offend; { - register int i; - register char *sp; - register char *datfile; + int i; + char *sp; + char *datfile; static char *suflist[] = { /* list of "illegal" suffixes" */ "dat", "pos", "c", "h", "p", "i", "f", "pas", "ftn", "ins.c", "ins,pas", @@ -880,8 +880,8 @@ void init_prob() { - register FILEDESC *fp, *last = NULL; - register int percent, num_noprob, frac; + FILEDESC *fp, *last = NULL; + int percent, num_noprob, frac; /* * Distribute the residual probability (if any) across all @@ -952,8 +952,8 @@ void get_fort() { - register FILEDESC *fp; - register int choice; + FILEDESC *fp; + int choice; if (File_list->next == NULL || File_list->percent == NO_PROB) fp = File_list; @@ -1002,7 +1002,8 @@ get_pos(fp); open_dat(fp); (void) lseek(fp->datfd, - (off_t) (sizeof fp->tbl + fp->pos * sizeof Seekpts[0]), 0); + (off_t) (sizeof fp->tbl + fp->pos * sizeof Seekpts[0]), + SEEK_SET); read(fp->datfd, Seekpts, sizeof Seekpts); Seekpts[0] = ntohl(Seekpts[0]); Seekpts[1] = ntohl(Seekpts[1]); @@ -1016,8 +1017,8 @@ pick_child(parent) FILEDESC *parent; { - register FILEDESC *fp; - register int choice; + FILEDESC *fp; + int choice; if (Equal_probs) { choice = random() % parent->num_children; @@ -1051,7 +1052,7 @@ */ void sum_noprobs(fp) -register FILEDESC *fp; +FILEDESC *fp; { static bool did_noprobs = FALSE; @@ -1068,7 +1069,7 @@ int max(i, j) -register int i, j; +int i, j; { return (i >= j ? i : j); } @@ -1141,8 +1142,8 @@ get_tbl(fp) FILEDESC *fp; { - auto int fd; - register FILEDESC *child; + auto int fd; + FILEDESC *child; if (fp->read_tbl) return; @@ -1179,7 +1180,7 @@ */ void zero_tbl(tp) -register STRFILE *tp; +STRFILE *tp; { tp->str_numstr = 0; tp->str_longlen = 0; @@ -1192,7 +1193,7 @@ */ void sum_tbl(t1, t2) -register STRFILE *t1, *t2; +STRFILE *t1, *t2; { t1->str_numstr += t2->str_numstr; if (t1->str_longlen < t2->str_longlen) @@ -1219,8 +1220,8 @@ */ void print_list(list, lev) -register FILEDESC *list; -int lev; +FILEDESC *list; +int lev; { while (list != NULL) { fprintf(stderr, "%*s", lev * 4, ""); @@ -1245,11 +1246,11 @@ */ char * conv_pat(orig) -register char *orig; +char *orig; { - register char *sp; - register unsigned int cnt; - register char *new; + char *sp; + unsigned int cnt; + char *new; cnt = 1; /* allow for '\0' */ for (sp = orig; *sp != '\0'; sp++) @@ -1308,8 +1309,8 @@ maxlen_in_list(list) FILEDESC *list; { - register FILEDESC *fp; - register int len, maxlen; + FILEDESC *fp; + int len, maxlen; maxlen = 0; for (fp = list; fp != NULL; fp = fp->next) { @@ -1334,8 +1335,8 @@ matches_in_list(list) FILEDESC *list; { - register char *sp, *p; - register FILEDESC *fp; + char *sp, *p; + FILEDESC *fp; int in_file; unsigned char ch; diff -ur games-990720+patches/hack/hack.save.c games-990720+patches2/hack/hack.save.c --- games-990720+patches/hack/hack.save.c Sun Sep 4 00:02:53 1994 +++ games-990720+patches2/hack/hack.save.c Fri Aug 6 22:52:14 1999 @@ -31,7 +31,7 @@ /* returns 1 if save successful */ dosave0(hu) int hu; { - register fd, ofd; + int fd, ofd; int tmp; /* not register ! */ (void) signal(SIGHUP, SIG_IGN); @@ -88,9 +88,9 @@ } dorecover(fd) -register fd; +int fd; { - register nfd; + int nfd; int tmp; /* not a register ! */ unsigned mid; /* idem */ struct obj *otmp; @@ -133,7 +133,7 @@ savelev(nfd,tmp); (void) close(nfd); } - (void) lseek(fd, (off_t)0, 0); + (void) lseek(fd, (off_t)0, SEEK_SET); getlev(fd, 0, 0); (void) close(fd); (void) unlink(SAVEF); @@ -153,7 +153,7 @@ } } if(u.ustuck) { - register struct monst *mtmp; + struct monst *mtmp; for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) if(mtmp->m_id == mid) goto monfnd; @@ -171,10 +171,10 @@ struct obj * restobjchn(fd) -register fd; +int fd; { - register struct obj *otmp, *otmp2; - register struct obj *first = 0; + struct obj *otmp, *otmp2; + struct obj *first = 0; int xl; #ifdef lint /* suppress "used before set" warning from lint */ @@ -199,10 +199,10 @@ struct monst * restmonchn(fd) -register fd; +int fd; { - register struct monst *mtmp, *mtmp2; - register struct monst *first = 0; + struct monst *mtmp, *mtmp2; + struct monst *first = 0; int xl; struct permonst *monbegin; diff -ur games-990720+patches/larn/io.c games-990720+patches2/larn/io.c --- games-990720+patches/larn/io.c Wed Sep 24 16:17:31 1997 +++ games-990720+patches2/larn/io.c Fri Aug 6 22:51:19 1999 @@ -155,7 +155,7 @@ */ newgame() { - register long *p,*pe; + long *p,*pe; for (p=c,pe=c+100; p<pe; *p++ =0); time(&initialtime); srandomdev(); lcreat((char*)0); /* open buffering for output to terminal */ @@ -197,9 +197,9 @@ va_dcl { va_list ap; /* pointer for variable argument list */ - register char *fmt; - register char *outb,*tmpb; - register long wide,left,cont,n; /* data for lprintf */ + char *fmt; + char *outb,*tmpb; + long wide,left,cont,n; /* data for lprintf */ char db[12]; /* %d buffer in lprintf */ va_start(ap); /* initialize the var args pointer */ @@ -279,7 +279,7 @@ * Returns nothing of value. */ lprint(x) - register long x; + long x; { if (lpnt >= lpend) lflush(); *lpnt++ = 255 & x; *lpnt++ = 255 & (x>>8); @@ -295,11 +295,11 @@ * Returns nothing of value */ lwrite(buf,len) - register char *buf; + char *buf; int len; { - register char *str; - register int num2; + char *str; + int num2; if (len > 399) /* don't copy data if can just write it */ { #ifdef EXTRA @@ -332,7 +332,7 @@ */ long lgetc() { - register int i; + int i; if (ipoint != iepoint) return(inbuffer[ipoint++]); if (iepoint!=MAXIBUF) return(0); if ((i=read(fd,inbuffer,MAXIBUF))<=0) @@ -358,7 +358,7 @@ */ long lrint() { - register unsigned long i; + unsigned long i; i = 255 & lgetc(); i |= (255 & lgetc()) << 8; i |= (255 & lgetc()) << 16; i |= (255 & lgetc()) << 24; return(i); @@ -373,11 +373,11 @@ * Returns nothing of value */ lrfill(adr,num) - register char *adr; + char *adr; int num; { - register char *pnt; - register int num2; + char *pnt; + int num2; while (num) { if (iepoint == ipoint) @@ -407,8 +407,8 @@ */ char *lgetw() { - register char *lgp,cc; - register int n=LINBUFSIZE,quote=0; + char *lgp,cc; + int n=LINBUFSIZE,quote=0; lgp = lgetwbuf; do cc=lgetc(); while ((cc <= 32) && (cc > NULL)); /* eat whitespace */ for ( ; ; --n,cc=lgetc()) @@ -426,8 +426,8 @@ */ char *lgetl() { - register int i=LINBUFSIZE,ch; - register char *str=lgetwbuf; + int i=LINBUFSIZE,ch; + char *str=lgetwbuf; for ( ; ; --i) { if ((*str++ = ch = lgetc()) == NULL) @@ -493,7 +493,7 @@ { lfd=1; return(-1); } - lseek(lfd,0,2); /* seek to end of file */ + lseek(lfd,0,SEEK_END); /* seek to end of file */ return(lfd); } @@ -522,9 +522,9 @@ * avoids calls to lprintf (time consuming) */ lprcat(str) - register char *str; + char *str; { - register char *str2; + char *str2; if (lpnt >= lpend) lflush(); str2 = lpnt; while (*str2++ = *str++); @@ -556,7 +556,7 @@ cursor(x,y) int x,y; { - register char *p; + char *p; if (lpnt >= lpend) lflush(); p = y_num[y]; /* get the string to print */ @@ -679,12 +679,12 @@ * cl_up(x,y) Clear screen from [x,1] to current position. Leave cursor at [x,y] */ cl_up(x,y) - register int x,y; + int x,y; { #ifdef VT100 cursor(x,y); lprcat("\33[1J\33[2K"); #else VT100 - register int i; + int i; cursor(1,1); for (i=1; i<=y; i++) { *lpnt++ = CL_LINE; *lpnt++ = '\n'; } cursor(x,y); @@ -695,12 +695,12 @@ * cl_dn(x,y) Clear screen from [1,y] to end of display. Leave cursor at [x,y] */ cl_dn(x,y) - register int x,y; + int x,y; { #ifdef VT100 cursor(x,y); lprcat("\33[J\33[2K"); #else VT100 - register int i; + int i; cursor(1,y); if (!CD) { @@ -718,7 +718,7 @@ * standout(str) Print the argument string in inverse video (standout mode). */ standout(str) - register char *str; + char *str; { #ifdef VT100 setbold(); @@ -752,8 +752,8 @@ static int scrline=18; /* line # for wraparound instead of scrolling if no DL */ lflush () { - register int lpoint; - register char *str; + int lpoint; + char *str; static int curx = 0; static int cury = 0; @@ -838,7 +838,7 @@ */ lflush() { - register int lpoint; + int lpoint; if ((lpoint = lpnt - lpbuf) > 0) { #ifdef EXTRA @@ -878,9 +878,9 @@ * Processes only the \33[#m sequence (converts . files for termcap use */ char *tmcapcnv(sd,ss) - register char *sd,*ss; + char *sd,*ss; { - register int tmstate=0; /* 0=normal, 1=\33 2=[ 3=# */ + int tmstate=0; /* 0=normal, 1=\33 2=[ 3=# */ char tmdigit=0; /* the # in \33[#m */ while (*ss) { diff -ur games-990720+patches/robots/score.c games-990720+patches2/robots/score.c --- games-990720+patches/robots/score.c Tue Jun 30 15:10:47 1998 +++ games-990720+patches2/robots/score.c Fri Aug 6 22:52:56 1999 @@ -61,10 +61,10 @@ */ score() { - register int inf; - register SCORE *scp; - register int uid; - register bool done_show = FALSE; + int inf; + SCORE *scp; + int uid; + bool done_show = FALSE; static int numscores, max_uid; Newscore = FALSE; @@ -129,7 +129,7 @@ refresh(); if (Newscore) { - lseek(inf, 0L, 0); + lseek(inf, 0L, SEEK_SET); write(inf, &max_uid, sizeof max_uid); write(inf, Top, sizeof Top); } @@ -137,9 +137,9 @@ } set_name(scp) -register SCORE *scp; +SCORE *scp; { - register PASSWD *pp; + PASSWD *pp; if ((pp = getpwuid(scp->s_uid)) == NULL) pp->pw_name = "???"; @@ -151,7 +151,7 @@ * Compare two scores. */ cmp_sc(s1, s2) -register SCORE *s1, *s2; +SCORE *s1, *s2; { return s2->s_score - s1->s_score; } @@ -162,8 +162,8 @@ */ show_score() { - register SCORE *scp; - register int inf; + SCORE *scp; + int inf; static int max_score; if ((inf = open(Scorefile, 0)) < 0) { diff -ur games-990720+patches/snake/snake/snake.c games-990720+patches2/snake/snake/snake.c --- games-990720+patches/snake/snake/snake.c Sun May 23 19:17:28 1999 +++ games-990720+patches2/snake/snake/snake.c Fri Aug 6 22:53:48 1999 @@ -415,7 +415,7 @@ drawbox() { - register int i; + int i; struct point p; p.line = -1; @@ -444,7 +444,7 @@ struct point *sp; { struct point p; - register int i; + int i; for (;;) { p.col = random() % ccnt; @@ -493,14 +493,14 @@ /* Figure out what happened in the past */ read(rawscores, &allbscore, sizeof(short)); read(rawscores, &allbwho, sizeof(short)); - lseek(rawscores, ((off_t)uid)*sizeof(short), 0); + lseek(rawscores, ((off_t)uid)*sizeof(short), SEEK_SET); read(rawscores, &oldbest, sizeof(short)); if (!flag) return (score > oldbest ? 1 : 0); /* Update this jokers best */ if (score > oldbest) { - lseek(rawscores, ((off_t)uid)*sizeof(short), 0); + lseek(rawscores, ((off_t)uid)*sizeof(short), SEEK_SET); write(rawscores, &score, sizeof(short)); pr("You bettered your previous best of $%d\n", oldbest); } else @@ -509,7 +509,7 @@ /* See if we have a new champ */ p = getpwuid(allbwho); if (p == NULL || score > allbscore) { - lseek(rawscores, (off_t)0, 0); + lseek(rawscores, (off_t)0, SEEK_SET); write(rawscores, &score, sizeof(short)); write(rawscores, &uid, sizeof(short)); if (allbwho) diff -ur games-990720+patches/worm/worm.c games-990720+patches2/worm/worm.c --- games-990720+patches/worm/worm.c Wed Sep 24 18:29:08 1997 +++ games-990720+patches2/worm/worm.c Fri Aug 6 22:11:33 1999 @@ -135,8 +135,8 @@ life() { - register struct body *bp, *np; - register int i; + struct body *bp, *np; + int i; head = newlink(); head->x = start_len+2; @@ -206,7 +206,7 @@ process(ch) char ch; { - register int x,y; + int x,y; struct body *nh; alarm(0); @@ -261,7 +261,10 @@ display(nh, HEAD); head = nh; if (!(slow && running)) + { + wmove(tv, head->y, head->x); wrefresh(tv); + } if (!running) alarm(1); } Responsible Changed From-To: freebsd-bugs->steve I'll work on this one during a meeting I have in the morning. :) Responsible Changed From-To: steve->billf Bill said he has other things brewing in this area and that we might be stepping on each others toes if we do it concurrently. :) Hi, it seems, that part of this PR is out of date. The register usage was cleaned at 16.11.1999 - but the rest of the patches was not (I checked for backgammon/main.c and adventure/main.c). If patching is still wanted I will produce unified diffs against the current code. Thanks Marc On Wed, May 29, 2002 at 12:57:10AM +0200, Marc Perisa wrote: > Hi, > > it seems, that part of this PR is out of date. > > The register usage was cleaned at 16.11.1999 - but the rest of the > patches was not (I checked for backgammon/main.c and adventure/main.c). right, this PR still contains non-register removal deltas and is still valid. > If patching is still wanted I will produce unified diffs against the > current code. submitting that as a followup to this pr wouldn't hurt anything. -- - bill fumerola / fumerola@yahoo-inc.com / billf@FreeBSD.org / billf@mu.org Attached is a shar file for the "freebsd-games" port that incorporates the relevant parts of this PR. If one of you could look this over and apply it to the port [either as files, or update the CVS tree], then this PR could be closed. Also, the "rogue" portion of Makefile is still missing.... Thanks, Stephen J. Roznowski (sjr@comcast.net) # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # files # files/patch-adventure-hdr # files/patch-adventure-init # files/patch-adventure-main # files/patch-adventure-save # files/patch-adventure-setup # files/patch-adventure-wizard # files/patch-atc-grammar # files/patch-atc-graphics # files/patch-atc-main # files/patch-atc-update # files/patch-backgammon-fancy # files/patch-backgammon-main # files/patch-backgammon-save # files/patch-backgammon-ttext1 # files/patch-battlestar-battlestar # files/patch-battlestar-battlestar6 # files/patch-battlestar-com1 # files/patch-battlestar-com5 # files/patch-battlestar-cypher # files/patch-battlestar-externs # files/patch-battlestar-init # files/patch-battlestar-nightfile # files/patch-battlestar-save # files/patch-fish # files/patch-hack # files/patch-robots # files/patch-snake # files/patch-trek-computer # files/patch-trek-externs # files/patch-trek-getparc # files/patch-trek-getparh # files/patch-trek-help # files/patch-trek-kill # files/patch-trek-lose # files/patch-trek-out # files/patch-trek-phaser # files/patch-trek-play # files/patch-trek-setup # files/patch-trek-shield # files/patch-trek-srscan # files/patch-trek-systemname # files/patch-trek-trek # files/patch-trek-win # files/patch-worm # echo c - files mkdir -p files > /dev/null 2>&1 echo x - files/patch-adventure-hdr sed 's/^X//' >files/patch-adventure-hdr << 'END-of-files/patch-adventure-hdr' X--- adventure/hdr.h Sat Feb 23 04:59:45 2002 X+++ adventure/hdr.h Sun Jul 13 22:10:28 2003 X@@ -50,6 +50,9 @@ X * The data file distributed with the fortran source is assumed to be called X * "glorkz" in the directory where the program is first run. X * X+ * The original FORTRAN version can be found at X+ * <URL:ftp://ftp.gmd.de/if-archive/games/source/advent-original.tar.gz>. X+ * X * $FreeBSD$ X */ X X@@ -57,9 +60,9 @@ X #include <sys/types.h> X #include <signal.h> X X-int datfd; /* message file descriptor */ X-volatile sig_atomic_t delhit; X-int yea; X+extern int datfd; /* message file descriptor */ X+extern volatile sig_atomic_t delhit; X+extern int yea; X extern char data_file[]; /* Virtual data file */ X X #define TAB 011 X@@ -67,18 +70,18 @@ X #define FLUSHLINE do { int flushline_ch; while ((flushline_ch = getchar()) != EOF && flushline_ch != '\n'); } while (0) X #define FLUSHLF while (next()!=LF) X X-int loc,newloc,oldloc,oldlc2,wzdark,gaveup,kq,k,k2; X-char *wd1,*wd2; /* the complete words */ X-int verb,obj,spk; X+extern int loc,newloc,oldloc,oldlc2,wzdark,gaveup,kq,k,k2; X+extern char *wd1,*wd2; /* the complete words */ X+extern int verb,obj,spk; X extern int blklin; X-int saved,savet,mxscor,latncy; X+extern int saveday,savet,mxscor,latncy; X X #define SHORT 50 /* How short is a demo game? */ X X #define MAXSTR 20 /* max length of user's words */ X X #define HTSIZE 512 /* max number of vocab words */ X-struct hashtab /* hash table for vocabulary */ X+extern struct hashtab /* hash table for vocabulary */ X { int val; /* word type &index (ktab) */ X char *atab; /* pointer to actual string */ X } voc[HTSIZE]; X@@ -86,61 +89,58 @@ X #define SEED 1815622 /* "Encryption" seed */ X X struct text X-#ifdef OLDSTUFF X-{ int seekadr; /* DATFILE must be < 2**16 */ X-#endif /* !OLDSTUFF */ X { char *seekadr; /* Msg start in virtual disk */ X int txtlen; /* length of msg starting here */ X }; X X #define RTXSIZ 205 X-struct text rtext[RTXSIZ]; /* random text messages */ X+extern struct text rtext[RTXSIZ]; /* random text messages */ X X #define MAGSIZ 35 X-struct text mtext[MAGSIZ]; /* magic messages */ X+extern struct text mtext[MAGSIZ]; /* magic messages */ X X-int clsses; X+extern int clsses; X #define CLSMAX 12 X-struct text ctext[CLSMAX]; /* classes of adventurer */ X-int cval[CLSMAX]; X+extern struct text ctext[CLSMAX]; /* classes of adventurer */ X+extern int cval[CLSMAX]; X X-struct text ptext[101]; /* object descriptions */ X+extern struct text ptext[101]; /* object descriptions */ X X #define LOCSIZ 141 /* number of locations */ X-struct text ltext[LOCSIZ]; /* long loc description */ X-struct text stext[LOCSIZ]; /* short loc descriptions */ X+extern struct text ltext[LOCSIZ]; /* long loc description */ X+extern struct text stext[LOCSIZ]; /* short loc descriptions */ X X-struct travlist /* direcs & conditions of travel*/ X+extern struct travlist /* direcs & conditions of travel*/ X { struct travlist *next; /* ptr to next list entry */ X int conditions; /* m in writeup (newloc / 1000) */ X int tloc; /* n in writeup (newloc % 1000) */ X int tverb; /* the verb that takes you there*/ X } *travel[LOCSIZ],*tkk; /* travel is closer to keys(...)*/ X X-int atloc[LOCSIZ]; X+extern int atloc[LOCSIZ]; X X-int plac[101]; /* initial object placement */ X-int fixd[101],fixed[101]; /* location fixed? */ X+extern int plac[101]; /* initial object placement */ X+extern int fixd[101],fixed[101]; /* location fixed? */ X X-int actspk[35]; /* rtext msg for verb <n> */ X+extern int actspk[35]; /* rtext msg for verb <n> */ X X-int cond[LOCSIZ]; /* various condition bits */ X+extern int cond[LOCSIZ]; /* various condition bits */ X X extern int setbit[16]; /* bit defn masks 1,2,4,... */ X X-int hntmax; X-int hints[20][5]; /* info on hints */ X-int hinted[20],hintlc[20]; X+extern int hntmax; X+extern int hints[20][5]; /* info on hints */ X+extern int hinted[20],hintlc[20]; X X-int place[101], prop[101],linkx[201]; X-int abb[LOCSIZ]; X+extern int place[101], prop[101],linkx[201]; X+extern int abb[LOCSIZ]; X X-int maxtrs,tally,tally2; /* treasure values */ X+extern int maxtrs,tally,tally2; /* treasure values */ X X #define FALSE 0 X #define TRUE 1 X X-int keys,lamp,grate,cage,rod,rod2,steps,/* mnemonics */ X+extern int keys,lamp,grate,cage,rod,rod2,steps,/* mnemonics */ X bird,door,pillow,snake,fissur,tablet,clam,oyster,magzin, X dwarf,knife,food,bottle,water,oil,plant,plant2,axe,mirror,dragon, X chasm,troll,troll2,bear,messag,vend,batter, X@@ -150,15 +150,15 @@ X enter, stream, pour, X say,lock,throw,find,invent; X X-int chloc,chloc2,dseen[7],dloc[7], /* dwarf stuff */ X+extern int chloc,chloc2,dseen[7],dloc[7], /* dwarf stuff */ X odloc[7],dflag,daltlc; X X-int tk[21],stick,dtotal,attack; X-int turns,lmwarn,iwest,knfloc,detail, /* various flags & counters */ X+extern int tk[21],stick,dtotal,attack; X+extern int turns,lmwarn,iwest,knfloc,detail, /* various flags & counters*/ X abbnum,maxdie,numdie,holdng,dkill,foobar,bonus,clock1,clock2, X- closng,panic,closed,scorng; X+ saved,closng,panic,closed,scorng; X X-int demo,limit; X+extern int demo,limit; X X int at (int objj); X int bug (int n); X@@ -166,7 +166,7 @@ X void caveclose (void); X void checkhints (void); X void ciao (void); X-void closing (void); X+extern gid_t egid; X u_long crc (const char *ptr, size_t nr); X void crc_start (void); X int dark (void); END-of-files/patch-adventure-hdr echo x - files/patch-adventure-init sed 's/^X//' >files/patch-adventure-init << 'END-of-files/patch-adventure-init' X--- adventure/init.c Sat Feb 23 04:53:27 2002 X+++ adventure/init.c Sun Jul 13 21:08:43 2003 X@@ -202,6 +202,72 @@ X closng=panic=closed=scorng=FALSE; X } X X+int datfd; /* message file descriptor */ X+volatile sig_atomic_t delhit; X+int yea; X+ X+int loc, newloc, oldloc, oldlc2, wzdark, gaveup, kq, k, k2; X+char *wd1, *wd2; /* the complete words */ X+int verb, obj, spk; X+int saveday, savet, mxscor, latncy; X+ X+struct hashtab voc[HTSIZE]; X+ X+struct text rtext[RTXSIZ]; /* random text messages */ X+ X+struct text mtext[MAGSIZ]; /* magic messages */ X+ X+int clsses; X+ X+struct text ctext[CLSMAX]; /* classes of adventurer */ X+int cval[CLSMAX]; X+ X+struct text ptext[101]; /* object descriptions */ X+ X+struct text ltext[LOCSIZ]; /* long loc description */ X+struct text stext[LOCSIZ]; /* short loc descriptions */ X+ X+struct travlist *travel[LOCSIZ], *tkk; /* travel is closer to keys(...) */ X+ X+int atloc[LOCSIZ]; X+ X+int plac[101]; /* initial object placement */ X+int fixd[101], fixed[101]; /* location fixed? */ X+ X+int actspk[35]; /* rtext msg for verb <n> */ X+ X+int cond[LOCSIZ]; /* various condition bits */ X+ X+int hntmax; X+int hints[20][5]; /* info on hints */ X+int hinted[20], hintlc[20]; X+ X+int place[101], prop[101], linkx[201]; X+int abb[LOCSIZ]; X+ X+int maxtrs, tally, tally2; /* treasure values */ X+ X+int keys, lamp, grate, cage, rod, rod2, steps, /* mnemonics */ X+ bird, door, pillow, snake, fissur, tablet, clam, oyster, X+ magzin, dwarf, knife, food, bottle, water, oil, plant, plant2, X+ axe, mirror, dragon, chasm, troll, troll2, bear, messag, X+ vend, batter, nugget, coins, chest, eggs, tridnt, vase, X+ emrald, pyram, pearl, rug, chain, spices, back, look, cave, X+ null, entrnc, dprssn, enter, stream, pour, say, lock, throw, X+ find, invent; X+ X+int chloc, chloc2, dseen[7], dloc[7], /* dwarf stuff */ X+ odloc[7], dflag, daltlc; X+ X+int tk[21], stick, dtotal, attack; X+int turns, lmwarn, iwest, knfloc, detail, /* various flags and X+ * counters */ X+ abbnum, maxdie, numdie, holdng, dkill, foobar, bonus, clock1, X+ clock2, saved, closng, panic, closed, scorng; X+ X+int demo, newloc, limit; X+ X+gid_t egid; X X X void END-of-files/patch-adventure-init echo x - files/patch-adventure-main sed 's/^X//' >files/patch-adventure-main << 'END-of-files/patch-adventure-main' X--- adventure/main.c Thu Jun 21 08:10:35 2001 X+++ adventure/main.c Sun Jul 13 20:19:15 2003 X@@ -367,7 +367,7 @@ X printf("you will have to wait at least"); X printf(" %d minutes before continuing.",latncy); X if (!yes(200,54,54)) goto l2012; X- datime(&saved,&savet); X+ datime(&saveday,&savet); X ciao(); /* Do we quit? */ X continue; /* Maybe not */ X case 31: /* hours=8310 */ END-of-files/patch-adventure-main echo x - files/patch-adventure-save sed 's/^X//' >files/patch-adventure-save << 'END-of-files/patch-adventure-save' X--- adventure/save.c Sat Feb 23 04:59:45 2002 X+++ adventure/save.c Sun Jul 13 20:22:18 2003 X@@ -44,6 +44,7 @@ X "$FreeBSD$"; X #endif /* not lint */ X X+#include <err.h> X #include <stdio.h> X #include <stdlib.h> X #include <sys/types.h> X@@ -93,7 +94,7 @@ X {&oldlc2, sizeof(oldlc2)}, X {&oldloc, sizeof(oldloc)}, X {&panic, sizeof(panic)}, X- {&saved, sizeof(saved)}, X+ {&saveday, sizeof(saveday)}, X {&savet, sizeof(savet)}, X {&scorng, sizeof(scorng)}, X {&spk, sizeof(spk)}, X@@ -152,7 +153,10 @@ X *s = (*s ^ random()) & 0xFF; /* Lightly encrypt */ X fwrite(p->address, p->width, 1, out); X } X- fclose(out); X+ if (fclose(out) != 0) { X+ warn("writing %s", outfile); X+ return 1; X+ } X return 0; X } X END-of-files/patch-adventure-save echo x - files/patch-adventure-setup sed 's/^X//' >files/patch-adventure-setup << 'END-of-files/patch-adventure-setup' X--- adventure/setup.c Mon Apr 22 09:44:17 2002 X+++ adventure/setup.c Sun Jul 13 20:24:20 2003 X@@ -118,5 +118,8 @@ X } X puts("\n\t0\n};"); X fclose(infile); X+ fflush(stdout); X+ if (ferror(stdout)) X+ err(1, "writing standard output"); X exit(0); X } END-of-files/patch-adventure-setup echo x - files/patch-adventure-wizard sed 's/^X//' >files/patch-adventure-wizard << 'END-of-files/patch-adventure-wizard' X--- adventure/wizard.c Sat Feb 23 04:53:27 2002 X+++ adventure/wizard.c Sun Jul 13 20:24:36 2003 X@@ -88,7 +88,7 @@ X { int d,t,delay; X X datime(&d,&t); X- delay=(d-saved)*1440+(t-savet); /* good for about a month */ X+ delay=(d-saveday)*1440+(t-savet); /* good for about a month */ X X if (delay >= latncy) X { saved = -1; END-of-files/patch-adventure-wizard echo x - files/patch-atc-grammar sed 's/^X//' >files/patch-atc-grammar << 'END-of-files/patch-atc-grammar' X--- atc/grammar.y Tue Jun 30 14:31:17 1998 X+++ atc/grammar.y Sun Jul 13 20:26:40 2003 X@@ -130,7 +130,7 @@ X wdef: X WidthOp '=' ConstOp ';' X { X- if (sp->height != 0) X+ if (sp->width != 0) X return (yyerror("Redefinition of 'width'.")); X else if ($3 < 3) X return (yyerror("'width' is too small.")); END-of-files/patch-atc-grammar echo x - files/patch-atc-graphics sed 's/^X//' >files/patch-atc-graphics << 'END-of-files/patch-atc-graphics' X--- atc/graphics.c Mon Nov 29 22:48:19 1999 X+++ atc/graphics.c Sun Jul 13 21:09:23 2003 X@@ -53,9 +53,7 @@ X X #include <string.h> X #include "include.h" X-#ifdef SYSV X #include <errno.h> X-#endif X X #define C_TOPBOTTOM '-' X #define C_LEFTRIGHT '|' X@@ -69,15 +67,14 @@ X X getAChar() X { X-#ifdef BSD X- return (getchar()); X-#endif X-#ifdef SYSV X int c; X X- while ((c = getchar()) == -1 && errno == EINTR) ; X+ errno = 0; X+ while ((c = getchar()) == -1 && errno == EINTR) { X+ errno = 0; X+ clearerr(stdin); X+ } X return(c); X-#endif X } X X erase_all() X@@ -385,7 +382,11 @@ X X wmove(input, 0, 0); X wclrtobot(input); X- wprintw(input, "Plane '%c' %s\n\nHit space for top players list...", X+ /* p may be NULL if we ran out of memory */ X+ if (p == NULL) X+ wprintw(input, "%s\n\nHit space for top players list...", s); X+ else X+ wprintw(input, "Plane '%c' %s\n\nHit space for top players list...", X name(p), s); X wrefresh(input); X fflush(stdout); END-of-files/patch-atc-graphics echo x - files/patch-atc-main sed 's/^X//' >files/patch-atc-main << 'END-of-files/patch-atc-main' X--- atc/main.c Mon Apr 22 09:44:18 2002 X+++ atc/main.c Sun Jul 13 21:18:20 2003 X@@ -58,6 +58,7 @@ X #endif /* not lint */ X X #include <string.h> X+#include <unistd.h> X #include "include.h" X #include "pathnames.h" X X@@ -69,7 +70,7 @@ X int f_usage = 0, f_list = 0, f_showscore = 0; X int f_printpath = 0; X const char *file = NULL; X- char *name, *ptr; X+ int ch; X #ifdef BSD X struct itimerval itv; X #endif X@@ -81,57 +82,42 @@ X setregid(getgid(), getgid()); X X start_time = time(0); X- X- name = *av++; X- while (*av) { X-#ifndef SAVEDASH X- if (**av == '-') X- *++*av; X- else X+ while ((ch = getopt(ac, av, "ulstpg:f:r:")) != -1) { X+ switch (ch) { X+ case '?': X+ case 'u': X+ default: X+ f_usage++; X+ break; X+ case 'l': X+ f_list++; X+ break; X+ case 's': X+ case 't': X+ f_showscore++; X+ break; X+ case 'p': X+ f_printpath++; X+ break; X+ case 'r': X+ seed = atoi(optarg); X+ break; X+ case 'f': X+ case 'g': X+ file = optarg; X break; X-#endif X- ptr = *av++; X- while (*ptr) { X- switch (*ptr) { X- case '?': X- case 'u': X- f_usage++; X- break; X- case 'l': X- f_list++; X- break; X- case 's': X- case 't': X- f_showscore++; X- break; X- case 'p': X- f_printpath++; X- break; X- case 'r': X- srandom(atoi(*av)); X- seed = 1; X- av++; X- break; X- case 'f': X- case 'g': X- file = *av; X- av++; X- break; X- default: X- fprintf(stderr, "Unknown option '%c'\n", *ptr); X- f_usage++; X- break; X- } X- ptr++; X } X } X+ if (optind < ac) X+ f_usage++; X+ X if (!seed) X srandomdev(); X X if (f_usage) X fprintf(stderr, X- "usage: %s -[u?lstp] [-[gf] game_name] [-r random seed]\n", X- name); X+ "Usage: %s -[u?lstp] [-[gf] game_name] [-r random seed]\n", X+ av[0]); X if (f_showscore) X log_score(1); X if (f_list) END-of-files/patch-atc-main echo x - files/patch-atc-update sed 's/^X//' >files/patch-atc-update << 'END-of-files/patch-atc-update' X--- atc/update.c Wed May 8 16:37:48 2002 X+++ atc/update.c Sun Jul 13 21:19:42 2003 X@@ -367,6 +367,8 @@ X p.plane_no = pnum; X X pp = newplane(); X+ if (pp == NULL) X+ loser(pp, "Out of memory!"); X bcopy(&p, pp, sizeof (p)); X X if (pp->orig_type == T_AIRPORT) END-of-files/patch-atc-update echo x - files/patch-backgammon-fancy sed 's/^X//' >files/patch-backgammon-fancy << 'END-of-files/patch-backgammon-fancy' X--- backgammon/common_source/fancy.c Sat Mar 23 20:09:34 2002 X+++ backgammon/common_source/fancy.c Sun Jul 13 21:24:55 2003 X@@ -748,5 +748,9 @@ X if (LI < 24 || CO < 72 || !(CL && UP && ND)) X return (0); X linect = (int *)calloc (LI+1,sizeof(int)); X+ if (linect == NULL) { X+ write (2, "\r\nOut of memory!\r\n", 18); X+ getout(0); X+ } X return (1); X } END-of-files/patch-backgammon-fancy echo x - files/patch-backgammon-main sed 's/^X//' >files/patch-backgammon-main << 'END-of-files/patch-backgammon-main' X--- backgammon/backgammon/main.c Sat Feb 2 04:32:09 2002 X+++ backgammon/backgammon/main.c Sun Jul 13 21:25:28 2003 X@@ -73,7 +73,7 @@ X }; X X static const char rules[] = "\nDo you want the rules of the game?"; X-static const char noteach[] = "Teachgammon not available!\n\007"; X+static const char noteach[] = "Teachgammon not available!\n\a"; X static const char need[] = "Do you need instructions for this program?"; X static const char askcol[] = X "Enter 'r' to play red, 'w' to play white, 'b' to play both:"; X@@ -509,12 +509,12 @@ X /* compute game value */ X if (tflag) X curmove (20,0); X- if (*offopp == 15) { X+ if (*offopp == 15 && *offptr <= 0) { X if (mflag) { X writel (bgammon); X gvalue *= 3; X } X- else if (*offptr <= 0) { X+ else { X writel (gammon); X gvalue *= 2; X } END-of-files/patch-backgammon-main echo x - files/patch-backgammon-save sed 's/^X//' >files/patch-backgammon-save << 'END-of-files/patch-backgammon-save' X--- backgammon/common_source/save.c Mon Nov 29 22:48:27 1999 X+++ backgammon/common_source/save.c Sun Jul 13 21:28:00 2003 X@@ -108,7 +108,7 @@ X close (fdesc); X if (yorn (0)) { X unlink (fname); X- fdesc = creat (fname,0700); X+ fdesc = creat (fname,0600); X break; X } else { X cflag = 1; END-of-files/patch-backgammon-save echo x - files/patch-backgammon-ttext1 sed 's/^X//' >files/patch-backgammon-ttext1 << 'END-of-files/patch-backgammon-ttext1' X--- backgammon/teachgammon/ttext1.c Mon Nov 29 22:48:30 1999 X+++ backgammon/teachgammon/ttext1.c Sun Jul 13 21:29:10 2003 X@@ -41,8 +41,8 @@ X X #include "back.h" X X-const char *opts = " QIMRHEDSPT"; X-const char *prompt = "-->"; X+const char *const opts = " QIMRHEDSPT"; X+const char *const prompt = "-->"; X X const char *const list[] = { X "\n\n\tI\tIntroduction to Backgammon", END-of-files/patch-backgammon-ttext1 echo x - files/patch-battlestar-battlestar sed 's/^X//' >files/patch-battlestar-battlestar << 'END-of-files/patch-battlestar-battlestar' X--- battlestar/battlestar.c Sat Oct 7 23:24:29 2000 X+++ battlestar/battlestar.c Sun Jul 13 21:29:30 2003 X@@ -67,7 +67,9 @@ X /* revoke privs. */ X setgid(getgid()); X X- initialize(argc < 2 || strcmp(argv[1], "-r")); X+ initialize((argc < 2) ? NULL : (strcmp(argv[1], "-r") ? argv[1] X+ : (argv[2] ? argv[2] X+ : DEFAULT_SAVE_FILE))); X start: X news(); X beenthere[position]++; END-of-files/patch-battlestar-battlestar echo x - files/patch-battlestar-battlestar6 sed 's/^X//' >files/patch-battlestar-battlestar6 << 'END-of-files/patch-battlestar-battlestar6' X--- battlestar/battlestar.6 Sun Jul 15 03:49:18 2001 X+++ battlestar/battlestar.6 Sun Jul 13 21:29:45 2003 X@@ -39,7 +39,10 @@ X .SH SYNOPSIS X .B battlestar X [ X-.B -r (recover a saved game) X+.B -r X+] X+[ X+.B saved-file X ] X .br X .fi X@@ -129,10 +132,12 @@ X in X the game. X .SH "SAVING A GAME" X-The command "save" will save your game in a file called "Bstar." You X-can X-recover a saved game by using the "-r" option when you start up the X-game. X+The command "save" will save your game in a file, by default called X+".Bstar" in your home directory. You X+can recover a saved game by using the X+.B -r X+option when you start up the X+game, or by giving the name of the saved file as an argument. X .SH DIRECTIONS X The compass directions N, S, E, and W can be used if you have a compass. X If you don't have a compass, you'll have to say R, L, A, or B, which END-of-files/patch-battlestar-battlestar6 echo x - files/patch-battlestar-com1 sed 's/^X//' >files/patch-battlestar-com1 << 'END-of-files/patch-battlestar-com1' X--- battlestar/com1.c Mon Feb 18 00:15:14 2002 X+++ battlestar/com1.c Sun Jul 13 20:30:42 2003 X@@ -240,7 +240,7 @@ X else{ X puts("You're out of fuel. We'll have to crash land!"); X if (!location[position].down){ X- puts("Your viper strikes the ground and explodes into firey fragments."); X+ puts("Your viper strikes the ground and explodes into fiery fragments."); X puts("Thick black smoke billows up from the wreckage."); X die(0); X } END-of-files/patch-battlestar-com1 echo x - files/patch-battlestar-com5 sed 's/^X//' >files/patch-battlestar-com5 << 'END-of-files/patch-battlestar-com5' X--- battlestar/com5.c Sat Oct 7 23:24:29 2000 X+++ battlestar/com5.c Sun Jul 13 20:33:20 2003 X@@ -90,7 +90,7 @@ X if (wordtype[wordnumber] == NOUNS && testbit(location[position].objects,wordvalue[wordnumber])){ X if (wordvalue[wordnumber] == NORMGOD && !loved) { X if (godready >= 2){ X- 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."); X+ 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,"); X 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."); X power++; X pleasure += 15; X@@ -304,7 +304,7 @@ X power -= 5; X if (bs_win >= 3){ X puts("The powers of the earth are now legitimate. You have destroyed the Darkness"); X- puts("and restored the goddess to her thrown. The entire island celebrates with"); X+ puts("and restored the goddess to her throne. The entire island celebrates with"); X puts("dancing and spring feasts. As a measure of her gratitude, the goddess weds you"); X puts("in the late summer and crowns you Prince Liverwort, Lord of Fungus."); X puts("\nBut, as the year wears on and autumn comes along, you become restless and"); END-of-files/patch-battlestar-com5 echo x - files/patch-battlestar-cypher sed 's/^X//' >files/patch-battlestar-cypher << 'END-of-files/patch-battlestar-cypher' X--- battlestar/cypher.c Sat Oct 7 23:24:29 2000 X+++ battlestar/cypher.c Sun Jul 13 21:31:58 2003 X@@ -48,6 +48,8 @@ X int junk; X int lflag = -1; X char buffer[10]; X+ char *filename, *rfilename; X+ size_t filename_len; X X while (wordtype[wordnumber] == ADJS) X wordnumber++; X@@ -345,7 +347,21 @@ X break; X X case SAVE: X- save(); X+ printf("\nSave file name (default %s) ", X+ DEFAULT_SAVE_FILE); X+ filename = fgetln(stdin, &filename_len); X+ if (filename_len == 0 X+ || (filename_len == 1 && filename[0] == '\n')) X+ rfilename = save_file_name(DEFAULT_SAVE_FILE, X+ strlen(DEFAULT_SAVE_FILE)); X+ else { X+ if (filename[filename_len - 1] == '\n') X+ filename_len--; X+ rfilename = save_file_name(filename, X+ filename_len); X+ } X+ save(rfilename); X+ free(rfilename); X break; X X case FOLLOW: END-of-files/patch-battlestar-cypher echo x - files/patch-battlestar-externs sed 's/^X//' >files/patch-battlestar-externs << 'END-of-files/patch-battlestar-externs' X--- battlestar/externs.h Mon Feb 18 00:15:14 2002 X+++ battlestar/externs.h Sun Jul 13 22:52:25 2003 X@@ -41,6 +41,7 @@ X #include <sys/types.h> X #include <stdio.h> X #include <stdlib.h> X+#include <string.h> X #include <unistd.h> X X #define BITS (8) X@@ -272,7 +273,7 @@ X char *getcom(char *, int, const char *, const char *); X char *getword(char *, char *, int); X int give(void); X-void initialize(int); X+void initialize(const char *); X int jump(void); X void kiss(void); X int land(void); X@@ -290,9 +291,10 @@ X int puton(void); X void ravage(void); X const char *rate(void); X-void restore(void); X+void restore(const char *); X int ride(void); X-void save(void); X+void save(const char *); X+char *save_file_name(const char *, size_t); X int shoot(void); X int take(unsigned int from[]); X int takeoff(void); X@@ -359,3 +361,5 @@ X extern const struct objs nightobjs[]; X X extern gid_t egid; X+ X+#define DEFAULT_SAVE_FILE ".Bstar" END-of-files/patch-battlestar-externs echo x - files/patch-battlestar-init sed 's/^X//' >files/patch-battlestar-init << 'END-of-files/patch-battlestar-init' X--- battlestar/init.c Mon Feb 18 00:15:14 2002 X+++ battlestar/init.c Sun Jul 13 21:37:44 2003 X@@ -50,9 +50,12 @@ X X void X initialize(startup) X- int startup; X+ const char *startup; X { X const struct objs *p; X+ char *savefile; X+ void die(); X+ char *save_file_name(); X X puts("Version 4.2, fall 1984."); X puts("First Adventure game written by His Lordship, the honorable"); X@@ -63,7 +66,7 @@ X location = dayfile; X wiz = wizard(uname); X wordinit(); X- if (startup) { X+ if (startup == NULL) { X direction = NORTH; X gtime = 0; X snooze = CYCLE * 1.5; X@@ -73,8 +76,11 @@ X torps = TORPEDOES; X for (p = dayobjs; p->room != 0; p++) X setbit(location[p->room].objects, p->obj); X- } else X- restore(); X+ } else { X+ savefile = save_file_name(startup, strlen(startup)); X+ restore(savefile); X+ free(savefile); X+ } X signal(SIGINT, die); X } X END-of-files/patch-battlestar-init echo x - files/patch-battlestar-nightfile sed 's/^X//' >files/patch-battlestar-nightfile << 'END-of-files/patch-battlestar-nightfile' X--- battlestar/nightfile.c Sat Oct 7 23:24:30 2000 X+++ battlestar/nightfile.c Sun Jul 13 20:38:06 2003 X@@ -762,7 +762,7 @@ X **+ and +.\n" }, X { "You are in a coconut palm grove.", X { 223, 121, 224, 225, 82, 0, 0, 0 }, X-"The tall palms are planted about 30 feet apart and the stary sky is clearly\n\ X+"The tall palms are planted about 30 feet apart and the starry sky is clearly\n\ X visible above. A low growing grass carpets the ground all around. The grove\n\ X continues +.***\n" }, X { "You are walking along a dirt road.", X@@ -874,7 +874,7 @@ X runs - and -.\n" }, X { "You are on a dirt path around the lagoon.", X { 170, 147, 146, 0, 74, 0, 0, 0 }, X-"The still waters reflect bending palms and a stary sky. It looks like\n\ X+"The still waters reflect bending palms and a starry sky. It looks like\n\ X the path runs into a clearing +. The path continues -.**\n" }, X { "You are drowning in the lagoon.", X { 201, 201, 147, 201, 74, 0, 0, 0 }, END-of-files/patch-battlestar-nightfile echo x - files/patch-battlestar-save sed 's/^X//' >files/patch-battlestar-save << 'END-of-files/patch-battlestar-save' X--- battlestar/save.c Sat Oct 7 23:24:30 2000 X+++ battlestar/save.c Sun Jul 13 22:54:43 2003 X@@ -48,21 +48,17 @@ X #include "externs.h" X X void X-restore() X+restore(filename) X+const char *filename; X { X- char *home; X- char home1[MAXPATHLEN]; X int n; X int tmp; X FILE *fp; X X- if ( (home = getenv("HOME")) != NULL) X- sprintf(home1, "%.*s/Bstar", MAXPATHLEN - 7, home); X- else return; X- X- if ((fp = fopen(home1, "r")) == 0) { X- perror(home1); X- return; X+ if (filename == NULL) X+ exit(1); /* Error determining save file name. */ X+ if ((fp = fopen(filename, "r")) == 0) { X+ err(1, "fopen %s", filename); X } X fread(&WEIGHT, sizeof WEIGHT, 1, fp); X fread(&CUMBER, sizeof CUMBER, 1, fp); X@@ -100,30 +96,26 @@ X fread(&power, sizeof power, 1, fp); X /* We must check the last read, to catch truncated save files. */ X if (fread(&ego, sizeof ego, 1, fp) < 1) X- errx(1, "save file %s too short", home1); X+ errx(1, "save file %s too short", filename); X fclose(fp); X } X X void X-save() X+save(filename) X+const char *filename; X { X struct stat sbuf; X- char *home; X- char home1[MAXPATHLEN]; X int n; X int tmp, fd; X FILE *fp; X X- home = getenv("HOME"); X- if (home == 0) X- return; X- sprintf(home1, "%.*s/Bstar", MAXPATHLEN - 7, home); X- X+ if (filename == NULL) X+ return; /* Error determining save file name. */ X /* Try to open the file safely. */ X- if (stat(home1, &sbuf) < 0) { X- fd = open(home1, O_WRONLY|O_CREAT|O_EXCL, 0600); X+ if (stat(filename, &sbuf) < 0) { X+ fd = open(filename, O_WRONLY|O_CREAT|O_EXCL, 0600); X if (fd < 0) { X- fprintf(stderr, "Can't create %s\n", home1); X+ fprintf(stderr, "Can't create %s\n", filename); X return; X } X } else { X@@ -132,19 +124,19 @@ X return; X } X X- fd = open(home1, O_WRONLY|O_EXCL); X+ fd = open(filename, O_WRONLY|O_EXCL); X if (fd < 0) { X- fprintf(stderr, "Can't open %s for writing\n", home1); X+ fprintf(stderr, "Can't open %s for writing\n", filename); X return; X } X } X X if ((fp = fdopen(fd, "w")) == 0) { X- perror(home1); X+ perror(filename); X return; X } X X- printf("Saved in %s.\n", home1); X+ printf("Saved in %s.\n", filename); X fwrite(&WEIGHT, sizeof WEIGHT, 1, fp); X fwrite(&CUMBER, sizeof CUMBER, 1, fp); X fwrite(&gclock, sizeof gclock, 1, fp); X@@ -180,4 +172,53 @@ X fwrite(&pleasure, sizeof pleasure, 1, fp); X fwrite(&power, sizeof power, 1, fp); X fwrite(&ego, sizeof ego, 1, fp); X+} X+ X+/* X+ * Given a save file name (possibly from fgetln, so without terminating NUL), X+ * determine the name of the file to be saved to by adding the HOME X+ * directory if the name does not contain a slash. Name will be allocated X+ * with malloc(3). X+ */ X+char * X+save_file_name(filename, len) X+ const char *filename; X+ size_t len; X+{ X+ char *home; X+ char *newname; X+ size_t tmpl; X+ X+ if (memchr(filename, '/', len)) { X+ newname = malloc(len + 1); X+ if (newname == NULL) { X+ warnx("out of memory"); X+ return NULL; X+ } X+ memcpy(newname, filename, len); X+ newname[len] = 0; X+ } else { X+ home = getenv("HOME"); X+ if (home != NULL) { X+ tmpl = strlen(home); X+ newname = malloc(tmpl + len + 2); X+ if (newname == NULL) { X+ warnx("out of memory"); X+ return NULL; X+ } X+ memcpy(newname, home, tmpl); X+ newname[tmpl] = '/'; X+ memcpy(newname + tmpl + 1, filename, len); X+ newname[tmpl + len + 1] = 0; X+ } else { X+ newname = malloc(len + 1); X+ if (newname == NULL) { X+ warnx("out of memory"); X+ return NULL; X+ } X+ memcpy(newname, filename, len); X+ newname[len] = 0; X+ } X+ } X+ return newname; X } END-of-files/patch-battlestar-save echo x - files/patch-fish sed 's/^X//' >files/patch-fish << 'END-of-files/patch-fish' X--- fish/fish.c Mon Feb 18 00:15:15 2002 X+++ fish/fish.c Sun Jul 13 20:38:39 2003 X@@ -98,6 +98,9 @@ X { X int ch, move; X X+ /* Revoke setgid privileges */ X+ setgid(getgid()); X+ X while ((ch = getopt(argc, argv, "p")) != -1) X switch(ch) { X case 'p': X@@ -444,7 +447,10 @@ X instructions() X { X int input; X- char buf[1024]; X+ pid_t pid; X+ int fd; X+ const char *pager; X+ int status; X X (void)printf("Would you like instructions (y or n)? "); X input = getchar(); X@@ -452,8 +458,28 @@ X if (input != 'y') X return; X X- (void)sprintf(buf, "%s %s", _PATH_MORE, _PATH_INSTR); X- (void)system(buf); X+ switch (pid = fork()) { X+ case 0: /* child */ X+ if (!isatty(1)) X+ pager = "cat"; X+ else { X+ if (!(pager = getenv("PAGER")) || (*pager == 0)) X+ pager = _PATH_MORE; X+ } X+ if ((fd = open(_PATH_INSTR, O_RDONLY)) == -1) X+ err(1, "open %s", _PATH_INSTR); X+ if (dup2(fd, 0) == -1) X+ err(1, "dup2"); X+ (void)execl("/bin/sh", "sh", "-c", pager, NULL); X+ err(1, "exec sh -c %s", pager); X+ /*NOTREACHED*/ X+ case -1: X+ err(1, "fork"); X+ /*NOTREACHED*/ X+ default: X+ (void)waitpid(pid, &status, 0); X+ break; X+ } X (void)printf("Hit return to continue...\n"); X while ((input = getchar()) != EOF && input != '\n'); X } END-of-files/patch-fish echo x - files/patch-hack sed 's/^X//' >files/patch-hack << 'END-of-files/patch-hack' X--- hack/hack.save.c Wed May 22 20:38:07 2002 X+++ hack/hack.save.c Sun Jul 13 21:43:58 2003 X@@ -134,7 +134,7 @@ X savelev(nfd,tmp); X (void) close(nfd); X } X- (void) lseek(fd, (off_t)0, 0); X+ (void) lseek(fd, (off_t)0, SEEK_SET); X getlev(fd, 0, 0); X (void) close(fd); X (void) unlink(SAVEF); END-of-files/patch-hack echo x - files/patch-robots sed 's/^X//' >files/patch-robots << 'END-of-files/patch-robots' X--- robots/score.c Mon Nov 29 22:49:20 1999 X+++ robots/score.c Sun Jul 13 21:46:04 2003 X@@ -133,7 +133,7 @@ X refresh(); X X if (Newscore) { X- lseek(inf, 0L, 0); X+ lseek(inf, 0L, SEEK_SET); X write(inf, &max_uid, sizeof max_uid); X write(inf, Top, sizeof Top); X } END-of-files/patch-robots echo x - files/patch-snake sed 's/^X//' >files/patch-snake << 'END-of-files/patch-snake' X--- snake/snake/snake.c Sun May 21 13:44:33 2000 X+++ snake/snake/snake.c Sun Jul 13 21:47:00 2003 X@@ -496,14 +496,14 @@ X /* Figure out what happened in the past */ X read(rawscores, &allbscore, sizeof(short)); X read(rawscores, &allbwho, sizeof(short)); X- lseek(rawscores, ((off_t)uid)*sizeof(short), 0); X+ lseek(rawscores, ((off_t)uid)*sizeof(short), SEEK_SET); X read(rawscores, &oldbest, sizeof(short)); X if (!flag) X return (score > oldbest ? 1 : 0); X X /* Update this jokers best */ X if (score > oldbest) { X- lseek(rawscores, ((off_t)uid)*sizeof(short), 0); X+ lseek(rawscores, ((off_t)uid)*sizeof(short), SEEK_SET); X write(rawscores, &score, sizeof(short)); X pr("You bettered your previous best of $%d\n", oldbest); X } else X@@ -512,7 +512,7 @@ X /* See if we have a new champ */ X p = getpwuid(allbwho); X if (p == NULL || score > allbscore) { X- lseek(rawscores, (off_t)0, 0); X+ lseek(rawscores, (off_t)0, SEEK_SET); X write(rawscores, &score, sizeof(short)); X write(rawscores, &uid, sizeof(short)); X if (allbwho) END-of-files/patch-snake echo x - files/patch-trek-computer sed 's/^X//' >files/patch-trek-computer << 'END-of-files/patch-trek-computer' X--- trek/computer.c Mon Nov 29 22:49:45 1999 X+++ trek/computer.c Sun Jul 13 20:40:23 2003 X@@ -108,7 +108,7 @@ X int i, j; X int numout; X int tqx, tqy; X- struct cvntab *r; X+ const struct cvntab *r; X int cost; X int course; X double dist, time; END-of-files/patch-trek-computer echo x - files/patch-trek-externs sed 's/^X//' >files/patch-trek-externs << 'END-of-files/patch-trek-externs' X--- trek/externs.c Mon Nov 29 22:49:47 1999 X+++ trek/externs.c Sun Jul 13 20:40:36 2003 X@@ -45,7 +45,7 @@ X ** global variable definitions X */ X X-struct device Device[NDEV] = X+const struct device Device[NDEV] = X { X "warp drive", "Scotty", X "S.R. scanners", "Scotty", X@@ -65,7 +65,7 @@ X "*ERR 15*", "Nobody" X }; X X-char *Systemname[NINHAB] = X+const char *const Systemname[NINHAB] = X { X "ERROR", X "Talos IV", END-of-files/patch-trek-externs echo x - files/patch-trek-getparc sed 's/^X//' >files/patch-trek-getparc << 'END-of-files/patch-trek-getparc' X--- trek/getpar.c Mon Nov 29 22:49:48 1999 X+++ trek/getpar.c Sun Jul 13 20:43:46 2003 X@@ -47,7 +47,7 @@ X **/ X X getintpar(s) X-char *s; X+const char *s; X { X int i; X int n; X@@ -71,7 +71,7 @@ X **/ X X double getfltpar(s) X-char *s; X+const char *s; X { X int i; X double d; X@@ -94,7 +94,7 @@ X ** get yes/no parameter X **/ X X-struct cvntab Yntab[] = X+const struct cvntab Yntab[] = X { X "y", "es", (int (*)())1, 0, X "n", "o", (int (*)())0, 0, X@@ -102,9 +102,9 @@ X }; X X getynpar(s) X-char *s; X+const char *s; X { X- struct cvntab *r; X+ const struct cvntab *r; X X r = getcodpar(s, Yntab); X return ((long) r->value); X@@ -115,14 +115,14 @@ X ** get coded parameter X **/ X X-struct cvntab *getcodpar(s, tab) X-char *s; X-struct cvntab tab[]; X+const struct cvntab *getcodpar(s, tab) X+const char *s; X+const struct cvntab tab[]; X { X char input[100]; X- struct cvntab *r; X+ const struct cvntab *r; X int flag; X- char *p, *q; X+ const char *p, *q; X int c; X int f; X X@@ -193,10 +193,10 @@ X **/ X X getstrpar(s, r, l, t) X-char *s; X+const char *s; X char *r; X int l; X-char *t; X+const char *t; X { X int i; X char format[20]; END-of-files/patch-trek-getparc echo x - files/patch-trek-getparh sed 's/^X//' >files/patch-trek-getparh << 'END-of-files/patch-trek-getparh' X--- trek/getpar.h Sun Sep 4 00:03:24 1994 X+++ trek/getpar.h Sun Jul 13 20:43:51 2003 X@@ -41,5 +41,5 @@ X int value2; X }; X X-extern double getfltpar(); X-extern struct cvntab *getcodpar(); X+extern double getfltpar(); X+extern const struct cvntab *getcodpar(); END-of-files/patch-trek-getparh echo x - files/patch-trek-help sed 's/^X//' >files/patch-trek-help << 'END-of-files/patch-trek-help' X--- trek/help.c Mon Nov 29 22:49:48 1999 X+++ trek/help.c Sun Jul 13 20:44:57 2003 X@@ -61,7 +61,7 @@ X ** to drop you. After that, it's your problem. X */ X X-char *Cntvect[3] = X+const char *const Cntvect[3] = X {"first", "second", "third"}; X X help() END-of-files/patch-trek-help echo x - files/patch-trek-kill sed 's/^X//' >files/patch-trek-kill << 'END-of-files/patch-trek-kill' X--- trek/kill.c Mon Nov 29 22:49:49 1999 X+++ trek/kill.c Sun Jul 13 20:46:39 2003 X@@ -150,8 +150,7 @@ X { X struct quad *q; X struct event *e; X- char *name; X- char *systemname(); X+ const char *name; X X if (f) X { END-of-files/patch-trek-kill echo x - files/patch-trek-lose sed 's/^X//' >files/patch-trek-lose << 'END-of-files/patch-trek-lose' X--- trek/lose.c Mon Nov 29 22:49:49 1999 X+++ trek/lose.c Sun Jul 13 20:46:49 2003 X@@ -50,7 +50,7 @@ X ** actions which need be taken are taken. X */ X X-char *Losemsg[] = X+const char *Losemsg[] = X { X "You ran out of time", X "You ran out of energy", END-of-files/patch-trek-lose echo x - files/patch-trek-out sed 's/^X//' >files/patch-trek-out << 'END-of-files/patch-trek-out' X--- trek/out.c Mon Nov 29 22:49:52 1999 X+++ trek/out.c Sun Jul 13 20:47:23 2003 X@@ -48,7 +48,7 @@ X out(dev) X int dev; X { X- struct device *d; X+ const struct device *d; X X d = &Device[dev]; X printf("%s reports %s ", d->person, d->name); END-of-files/patch-trek-out echo x - files/patch-trek-phaser sed 's/^X//' >files/patch-trek-phaser << 'END-of-files/patch-trek-phaser' X--- trek/phaser.c Mon Jul 10 01:24:02 2000 X+++ trek/phaser.c Sun Jul 13 20:48:26 2003 X@@ -105,7 +105,7 @@ X int n; X int hitreqd[NBANKS]; X struct banks bank[NBANKS]; X- struct cvntab *ptr; X+ const struct cvntab *ptr; X X if (Ship.cond == DOCKED) X return(printf("Phasers cannot fire through starbase shields\n")); END-of-files/patch-trek-phaser echo x - files/patch-trek-play sed 's/^X//' >files/patch-trek-play << 'END-of-files/patch-trek-play' X--- trek/play.c Mon Nov 29 22:49:52 1999 X+++ trek/play.c Sun Jul 13 20:48:34 2003 X@@ -58,7 +58,7 @@ X warp(), dumpgame(), rest(), srscan(), X myreset(), torped(), visual(), setwarp(), undock(), phaser(); X X-struct cvntab Comtab[] = X+const struct cvntab Comtab[] = X { X "abandon", "", abandon, 0, X "ca", "pture", capture, 0, X@@ -95,7 +95,7 @@ X X play() X { X- struct cvntab *r; X+ const struct cvntab *r; X X while (1) X { END-of-files/patch-trek-play echo x - files/patch-trek-setup sed 's/^X//' >files/patch-trek-setup << 'END-of-files/patch-trek-setup' X--- trek/setup.c Mon Nov 29 22:49:54 1999 X+++ trek/setup.c Sun Jul 13 20:49:27 2003 X@@ -54,7 +54,7 @@ X ** Game restart and tournament games are handled here. X */ X X-struct cvntab Lentab[] = X+const struct cvntab Lentab[] = X { X "s", "hort", (int (*)())1, 0, X "m", "edium", (int (*)())2, 0, X@@ -63,7 +63,7 @@ X 0 X }; X X-struct cvntab Skitab[] = X+const struct cvntab Skitab[] = X { X "n", "ovice", (int (*)())1, 0, X "f", "air", (int (*)())2, 0, X@@ -76,7 +76,7 @@ X X setup() X { X- struct cvntab *r; X+ const struct cvntab *r; X int i, j; X double f; X int d; END-of-files/patch-trek-setup echo x - files/patch-trek-shield sed 's/^X//' >files/patch-trek-shield << 'END-of-files/patch-trek-shield' X--- trek/shield.c Mon Nov 29 22:49:54 1999 X+++ trek/shield.c Sun Jul 13 20:50:24 2003 X@@ -59,7 +59,7 @@ X ** so you get partial hits. X */ X X-struct cvntab Udtab[] = X+const struct cvntab Udtab[] = X { X "u", "p", (int (*)())1, 0, X "d", "own", 0, 0, X@@ -71,9 +71,9 @@ X { X int i; X char c; X- struct cvntab *r; X+ const struct cvntab *r; X char s[100]; X- char *device, *dev2, *dev3; X+ const char *device, *dev2, *dev3; X int ind; X char *stat; X END-of-files/patch-trek-shield echo x - files/patch-trek-srscan sed 's/^X//' >files/patch-trek-srscan << 'END-of-files/patch-trek-srscan' X--- trek/srscan.c Mon Nov 29 22:49:55 1999 X+++ trek/srscan.c Sun Jul 13 20:51:20 2003 X@@ -57,7 +57,7 @@ X ** The current quadrant is filled in on the computer chart. X */ X X-char *Color[4] = X+const char *Color[4] = X { X "GREEN", X "DOCKED", X@@ -70,12 +70,12 @@ X { X int i, j; X int statinfo; X- char *s; X+ const char *s; X int percent; X struct quad *q; X extern struct cvntab Skitab[]; X extern struct cvntab Lentab[]; X- struct cvntab *p; X+ const struct cvntab *p; X X if (f >= 0 && check_out(SRSCAN)) X { END-of-files/patch-trek-srscan echo x - files/patch-trek-systemname sed 's/^X//' >files/patch-trek-systemname << 'END-of-files/patch-trek-systemname' X--- trek/systemname.c Mon Nov 29 22:49:55 1999 X+++ trek/systemname.c Sun Jul 13 20:52:02 2003 X@@ -52,10 +52,10 @@ X ** starsystems, etc. X */ X X-char *systemname(q1) X+const char *systemname(q1) X struct quad *q1; X { X- struct quad *q; X+ const struct quad *q; X int i; X X q = q1; END-of-files/patch-trek-systemname echo x - files/patch-trek-trek sed 's/^X//' >files/patch-trek-trek << 'END-of-files/patch-trek-trek' X--- trek/trek.h Tue Jun 30 15:08:19 1998 X+++ trek/trek.h Sun Jul 13 20:52:12 2003 X@@ -96,7 +96,7 @@ X */ X X /* ascii names of systems */ X-extern char *Systemname[NINHAB]; X+extern const char *const Systemname[NINHAB]; X X /* quadrant definition */ X struct quad Quad[NQUADS][NQUADS]; X@@ -138,11 +138,11 @@ X /* device names */ X struct device X { X- char *name; /* device name */ X- char *person; /* the person who fixes it */ X+ const char *name; /* device name */ X+ const char *person; /* the person who fixes it */ X }; X X-struct device Device[NDEV]; X+const struct device Device[NDEV]; X X /*************************** EVENTS ****************************/ X X@@ -247,7 +247,7 @@ X int secty; /* sector y coord */ X char cond; /* condition code */ X char sinsbad; /* Space Inertial Navigation System condition */ X- char *shipname; /* name of current starship */ X+ const char *shipname; /* name of current starship */ X char ship; /* current starship */ X int distressed; /* number of distress calls */ X } Ship; X@@ -379,4 +379,4 @@ X # define xTRACE 1 X int Trace; X X-extern char *systemname(); X+extern const char *systemname(); END-of-files/patch-trek-trek echo x - files/patch-trek-win sed 's/^X//' >files/patch-trek-win << 'END-of-files/patch-trek-win' X--- trek/win.c Mon Nov 29 22:49:56 1999 X+++ trek/win.c Sun Jul 13 20:53:08 2003 X@@ -62,7 +62,7 @@ X extern jmp_buf env; X extern long score(); X extern struct cvntab Skitab[]; X- struct cvntab *p; X+ const struct cvntab *p; X X sleep(1); X printf("\nCongratulations, you have saved the Federation\n"); END-of-files/patch-trek-win echo x - files/patch-worm sed 's/^X//' >files/patch-worm << 'END-of-files/patch-worm' X--- worm/worm.c Mon Feb 18 00:15:18 2002 X+++ worm/worm.c Sun Jul 13 21:47:37 2003 X@@ -287,7 +287,10 @@ X display(nh, HEAD); X head = nh; X if (!(slow && running)) X+ { X+ wmove(tv, head->y, head->x); X wrefresh(tv); X+ } X if (!running) X alarm(1); X } END-of-files/patch-worm exit State Changed From-To: open->closed Committed, thanks! Responsible Changed From-To: billf->markm Committed, thanks! |