home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.misc
- From: ross@teserv.den.mmc.com (Perry R. Ross)
- Subject: v39i047: ldb - Play backgammon by e-mail, version 1.3, Patch01
- Message-ID: <1993Aug23.040954.27618@sparky.sterling.com>
- X-Md4-Signature: e23418b04681aa242f5c2bfc82828903
- Sender: kent@sparky.sterling.com (Kent Landfield)
- Organization: Sterling Software
- Date: Mon, 23 Aug 1993 04:09:54 GMT
- Approved: kent@sparky.sterling.com
-
- Submitted-by: ross@teserv.den.mmc.com (Perry R. Ross)
- Posting-number: Volume 39, Issue 47
- Archive-name: ldb/patch01
- Environment: UNIX, C, VMS, VAXC, CURSES, 32BIT
- Patch-To: ldb: Volume 36, Issue 98-109
-
- Long Distance Backgammon
-
- This is a program that lets two people easily play backgammon
- by e-mail. It currently runs only on character-oriented terminals
- (or emulators thereof) under the curses package. It runs on most
- flavors of UNIX, as well as VMS version 5.0 and above.
-
- This is patch 1 to version 1.3 of ldb. Most changes are minor bug
- fixes. Some non-portable usage of signed char has been eliminated,
- allowing ldb to compile on AT&T machines. My e-mail address for
- ldb-related questions has also changed; you should use the one listed
- by ldb -help, not the one from this posting.
-
- Thanks once again to Earle Ake for finding & fixing loads-o-bugs.
-
- *** 130src/Makefile Mon Aug 2 13:04:59 1993
- --- Makefile Tue Aug 3 12:18:56 1993
- ***************
- *** 76,82 ****
- CFLAGS=-O $(OLDCURSES) $(NEED_READDIR)
- LIBS=-lcurses -ltermcap
-
- ! # use these 2 lines for SCO XENIX (also SCO UNIX?)
- #CFLAGS= -O -Mle -LARGE -Zi -DM_TERMCAP $(OLDCURSES)
- #LIBS=-lx -ltcap -ltermlib
- LINTFLAGS=
- --- 76,82 ----
- CFLAGS=-O $(OLDCURSES) $(NEED_READDIR)
- LIBS=-lcurses -ltermcap
-
- ! # use these 2 lines for SCO XENIX (not SCO UNIX!)
- #CFLAGS= -O -Mle -LARGE -Zi -DM_TERMCAP $(OLDCURSES)
- #LIBS=-lx -ltcap -ltermlib
- LINTFLAGS=
- ***************
- *** 109,114 ****
- --- 109,117 ----
- $(LDB): $(OFILES)
- $(CC) $(CFLAGS) -s -o $(LDB) $(OFILES) $(LIBS)
-
- + ldb.h: patchlevel.h
- + touch ldb.h
- +
- all: $(LDB) ldb.doc
-
- ldb.doc: ldb.man
- ***************
- *** 146,148 ****
- --- 149,186 ----
- mv .tags tags
-
- .XXX:
- +
- + depend:
- + rm -f make.tmp
- + sed '/^# DO NOT DELETE/,$$d' < Makefile > make.tmp
- + echo '# DO NOT DELETE THIS LINE -- make depend uses it' >>make.tmp
- + egrep '^#.*include.*\"' $(HFILES) $(CFILES) \
- + | sed -e 's/.c:/.o:/' -e 's/:/: /' -e 's/"//g' \
- + | awk '{print $$1 " " $$3;}' >>make.tmp
- + mv Makefile Makefile.old
- + mv make.tmp Makefile
- +
- + # DO NOT DELETE THIS LINE -- make depend uses it
- + ldb.h: patchlevel.h
- + board.o: ldb.h
- + game.o: ldb.h
- + main.o: ldb.h
- + misc.o: ldb.h
- + move.o: ldb.h
- + process.o: ldb.h
- + rcvop.o: ldb.h
- + control.o: ldb.h
- + check.o: ldb.h
- + readmail.o: ldb.h
- + save.o: ldb.h
- + vars.o: ldb.h
- + fe_curses.o: ldb.h
- + t_email.o: ldb.h
- + r_xrand.o: ldb.h
- + dohelp.o: ldb.h
- + dostats.o: ldb.h
- + rename.o: ldb.h
- + flist_unix.o: ldb.h
- + flist_vms.o: ldb.h
- + flist_none.o: ldb.h
- + lock.o: ldb.h
- *** 130src/TODO Mon Aug 2 13:05:02 1993
- --- TODO Fri Jul 23 10:37:42 1993
- ***************
- *** 1,3 ****
- --- 1,23 ----
- + flist_unix does not work on SCO UNIX.
- +
- + From Dick King (king@ukulele.reasoning.com):
- + 1. Proposition support. Need more info.
- + 2. Dice server to support secure games. For games that need
- + to be secure, moves would either go from player 1 to dice server
- + to player 2 (if player 2 can't double or says he doesn't want to),
- + or from player 1 to player 2 to dice server back to player 2.
- + Each time you request a roll from the server, you send your opponent's
- + last roll for verification.
- +
- + Patch to FeFinishSession for Linux: add nl() after refresh().
- + Maybe add nocbreak() and echo() too just to be safe?
- + Found by Stephan G. Dasia (stephand@solist.htsa.aha.nl)
- +
- + Include earle's modified makefile, etc.
- +
- + way of showing all opponent pieces that you could hit.
- + way of showing all points you could make.
- +
- delete redundant fields from game structure (opaddr, myaddr, etc)
-
- delmail option should work on system mail file.
- *** 130src/control.c Mon Aug 2 13:05:16 1993
- --- control.c Tue Aug 3 13:51:34 1993
- ***************
- *** 180,187 ****
- char *file;
- {
- FILE *fp;
- ! char c;
- ! int i, j;
- struct mv m;
- struct game *g;
- struct people *p;
- --- 180,187 ----
- char *file;
- {
- FILE *fp;
- ! int c;
- ! int i, j, line;
- struct mv m;
- struct game *g;
- struct people *p;
- ***************
- *** 193,201 ****
- ldbexit(STAT_ABORT);
- }
- g = addgame(); /* get a game structure */
- while ( (c = getc(fp)) != EOF) {
- ungetc(c,fp); /* put char back */
- ! nvscan(fp,nv_gfile,g);
- if (strcmp(g->opaddr,rc.myaddr)) /* this game wasn't with me */
- continue;
- if ( (g->state == ST_OPSTART) || (g->state == ST_GAMEOVER) )
- --- 193,206 ----
- ldbexit(STAT_ABORT);
- }
- g = addgame(); /* get a game structure */
- + line = 0;
- while ( (c = getc(fp)) != EOF) {
- ungetc(c,fp); /* put char back */
- ! if (nvscan(fp,nv_gfile,g,&line) < 0) {
- ! fprintf(stderr,"ERROR: bad line %d in %s -- aborting.\n",
- ! line, file);
- ! ldbexit(STAT_ABORT);
- ! }
- if (strcmp(g->opaddr,rc.myaddr)) /* this game wasn't with me */
- continue;
- if ( (g->state == ST_OPSTART) || (g->state == ST_GAMEOVER) )
- *** 130src/ldb.h Mon Aug 2 13:05:47 1993
- --- ldb.h Tue Aug 3 13:56:56 1993
- ***************
- *** 171,177 ****
- #define F_CRDONE 1024 /* The crawford rule game has been played */
-
- /* field types for reading name/value files */
- ! #define FT_CHAR 1 /* store a single character */
- #define FT_INT 2 /* store a single integer */
- #define FT_STRING 3 /* store a char * (use save()) */
- #define FT_MOVE 4 /* a struct mv */
- --- 171,177 ----
- #define F_CRDONE 1024 /* The crawford rule game has been played */
-
- /* field types for reading name/value files */
- ! #define FT_CHAR 1 /* store a single char (may not be signed!) */
- #define FT_INT 2 /* store a single integer */
- #define FT_STRING 3 /* store a char * (use save()) */
- #define FT_MOVE 4 /* a struct mv */
- ***************
- *** 316,323 ****
- };
-
- struct mv {
- ! char roll; /* # on 1 die, 0 = DOUBLE, -1=empty */
- ! char pt; /* point move is from, -1=UNUSED */
- };
-
- struct point {
- --- 316,323 ----
- };
-
- struct mv {
- ! int roll; /* # on 1 die, 0 = DOUBLE, -1=empty */
- ! int pt; /* point move is from, -1=UNUSED */
- };
-
- struct point {
- ***************
- *** 334,341 ****
- char *myaddr; /* my address for this user */
- char mycolor; /* char to represent my pieces */
- char opcolor; /* opponent's pieces */
- ! char mydir; /* 1/-1 direction I am moving */
- ! char opdir; /* 1/-1 direction opponent is moving */
- int gameval; /* current value of game */
- int adcnt; /* current number of autodoubles */
- int admax; /* max autodoubles allowed */
- --- 334,341 ----
- char *myaddr; /* my address for this user */
- char mycolor; /* char to represent my pieces */
- char opcolor; /* opponent's pieces */
- ! int mydir; /* 1/-1 direction I am moving */
- ! int opdir; /* 1/-1 direction opponent is moving */
- int gameval; /* current value of game */
- int adcnt; /* current number of autodoubles */
- int admax; /* max autodoubles allowed */
- ***************
- *** 429,439 ****
- extern char *rejlcl[]; /* error messages for local player */
- extern char *rejmsg[]; /* error messages for received moves */
- extern char *opcodes[];
- extern char blk76[]; /* 76 blanks */
- extern struct packet P; /* last packet read */
- extern char cr_mycolor; /* my color when game is created */
- extern char cr_opcolor; /* opponent's color for new games */
- ! extern char cr_mydir; /* my direction for new games */
- extern char *notify; /* address to notify when game ends */
- extern char *states[]; /* description of the states */
-
- --- 429,440 ----
- extern char *rejlcl[]; /* error messages for local player */
- extern char *rejmsg[]; /* error messages for received moves */
- extern char *opcodes[];
- + extern char nvbuf[128]; /* buffer for nvscan/nvwrite */
- extern char blk76[]; /* 76 blanks */
- extern struct packet P; /* last packet read */
- extern char cr_mycolor; /* my color when game is created */
- extern char cr_opcolor; /* opponent's color for new games */
- ! extern int cr_mydir; /* my direction for new games */
- extern char *notify; /* address to notify when game ends */
- extern char *states[]; /* description of the states */
-
- ***************
- *** 449,455 ****
-
- char *tgetstr();
- char *save(), *makeid(), *calloc();
- ! char *nvscan(), *strchr(), *boardstr();
- char *strchr(), *strrchr();
- struct game *startgame(), *addgame(), *findgame();
-
- --- 450,456 ----
-
- char *tgetstr();
- char *save(), *makeid(), *calloc();
- ! char *strchr(), *boardstr();
- char *strchr(), *strrchr();
- struct game *startgame(), *addgame(), *findgame();
-
- *** 130src/main.c Mon Aug 2 13:06:06 1993
- --- main.c Wed Aug 4 09:41:44 1993
- ***************
- *** 385,396 ****
- * one -remotestart may be used per run of ldb. Suggested by Earle Ake.
- * 19. findppl now detects infinite loops in equiv records. Should never
- * happen, but ...
- ! *** Version 01 Rev 2 Patch 0
- * 1. A warning is printed if the crawford rule is used with a pre-1.3
- * version of ldb. The Crawford rule was fixed during 1.2, but many
- * beta versions were distributed before this fix was included.
- * 2. The -newaddr option was added. I was going to wait on this, but
- * my employment situation is such that I may need to use it soon. :-(
- *============================================================================
- */
-
- --- 385,402 ----
- * one -remotestart may be used per run of ldb. Suggested by Earle Ake.
- * 19. findppl now detects infinite loops in equiv records. Should never
- * happen, but ...
- ! *** Version 01 Rev 3 Patch 0
- * 1. A warning is printed if the crawford rule is used with a pre-1.3
- * version of ldb. The Crawford rule was fixed during 1.2, but many
- * beta versions were distributed before this fix was included.
- * 2. The -newaddr option was added. I was going to wait on this, but
- * my employment situation is such that I may need to use it soon. :-(
- + *** Version 01 Rev 3 Patch 1
- + * 1. The game file was not checkpointed when our double is accepted.
- + * 2. Some non-portable uses of chars as signed chars were changed to int's.
- + * 3. The Makefile was changed to do a full recompile if ldb.h is changed.
- + * This was done by adding a homebrew "make depend", which should be run
- + * before each release is packed so the users don't have to.
- *============================================================================
- */
-
- ***************
- *** 681,687 ****
- i++; /* keep count */
- }
- }
- ! message("newaddr: %d opponents to notify.\n",i);
- }
-
- i = 0;
- --- 687,693 ----
- i++; /* keep count */
- }
- }
- ! message("newaddr: %d opponent%s to notify.\n",i,(i==1) ? "" : "s");
- }
-
- i = 0;
- ***************
- *** 752,758 ****
- VERSION,REVISION);
- #else
- printf(
- ! "\nLdb version %d.%d (patch %d) by Perry R. Ross. Mail\ncomments",
- VERSION,REVISION,PATCHLEVEL);
- #endif
- printf("or suggestions to \"%s\".\n",AUTHOR_EMAIL);
- --- 758,764 ----
- VERSION,REVISION);
- #else
- printf(
- ! "\nLdb version %d.%d (patch %d) by Perry R. Ross. Mail\ncomments ",
- VERSION,REVISION,PATCHLEVEL);
- #endif
- printf("or suggestions to \"%s\".\n",AUTHOR_EMAIL);
- *** 130src/makefile.vms Mon Aug 2 13:05:09 1993
- --- makefile.vms Thu Jun 10 10:56:14 1993
- ***************
- *** 79,85 ****
-
- *.obj : *.c
- write sys$output "Compiling $*"
- ! cc $(CFLAGS) $*
- purge/nolog $*.obj
- rename $*.obj *.*;1
-
- --- 79,85 ----
-
- *.obj : *.c
- write sys$output "Compiling $*"
- ! cc $(CFLAGS) $*.c
- purge/nolog $*.obj
- rename $*.obj *.*;1
-
- ***************
- *** 96,102 ****
- # Include all the sources necessary to build under VMS or unix
- #
-
- ! SHARFILES=readme.,todo.,ldb.doc,ldb.man,ldb.ps,makefile.*,ldb.opt,makeldb.com,*.c,*.h,ldbstarter.csh,ldb-man.tex,ldb-man.ps1,ldb-man.ps2,ldb-man.ps3
-
- $(LDB) : $(ldb_objs)
- write sys$output "Linking $(LDB)"
- --- 96,102 ----
- # Include all the sources necessary to build under VMS or unix
- #
-
- ! SHARFILES=readme.,todo.,ldb.doc,ldb.man,ldb.ps,makefile.*,ldb.opt,makeldb.com,*.c,*.h,ldbstarter.csh,ldb.tex
-
- $(LDB) : $(ldb_objs)
- write sys$output "Linking $(LDB)"
- *** 130src/makeldb.com Mon Aug 2 13:05:10 1993
- --- makeldb.com Thu Jun 10 10:56:14 1993
- ***************
- *** 1,28 ****
- $ set verify
- $ assign "sys$library" vaxc$include
- ! $ cc/nolist board
- ! $ cc/nolist check
- ! $ cc/nolist control
- ! $ cc/nolist dohelp
- ! $ cc/nolist dostats
- ! $ cc/nolist fe_curses
- ! $ cc/nolist flist_vms
- ! $ cc/nolist game
- ! $ cc/nolist lock
- ! $ cc/nolist main
- ! $ cc/nolist misc
- ! $ cc/nolist move
- ! $ cc/nolist process
- ! $ cc/nolist r_xrand
- ! $ cc/nolist rcvop
- ! $ cc/nolist readmail
- ! $ cc/nolist save
- ! $ cc/nolist t_email
- ! $ cc/nolist vars
- ! $ link/exe=ldb sys$input/opt
- ! board,check,control,dohelp,dostats,fe_curses,flist_vms,game,lock,main
- ! misc,move,process,r_xrand,rcvop,readmail,save,t_email,vars
- ! sys$share:vaxccurse.olb/library
- ! ldb.opt/options
- $ set noverify
- $ exit
- --- 1,30 ----
- + $ ccopts := "/nodebug"
- $ set verify
- $ assign "sys$library" vaxc$include
- ! $ cc/nolist'ccopts' board.c
- ! $ cc/nolist'ccopts' check.c
- ! $ cc/nolist'ccopts' control.c
- ! $ cc/nolist'ccopts' dohelp.c
- ! $ cc/nolist'ccopts' dostats.c
- ! $ cc/nolist'ccopts' fe_curses.c
- ! $ cc/nolist'ccopts' flist_vms.c
- ! $ cc/nolist'ccopts' game.c
- ! $ cc/nolist'ccopts' lock.c
- ! $ cc/nolist'ccopts' main.c
- ! $ cc/nolist'ccopts' misc.c
- ! $ cc/nolist'ccopts' move.c
- ! $ cc/nolist'ccopts' process.c
- ! $ cc/nolist'ccopts' r_xrand.c
- ! $ cc/nolist'ccopts' rcvop.c
- ! $ cc/nolist'ccopts' readmail.c
- ! $ cc/nolist'ccopts' save.c
- ! $ cc/nolist'ccopts' t_email.c
- ! $ cc/nolist'ccopts' vars.c
- ! $ link/exe=ldb/nodebug/notrace -
- ! board.obj,check.obj,control.obj,dohelp.obj,dostats.obj,fe_curses.obj,-
- ! flist_vms.obj,game.obj,lock.obj,main.obj,misc.obj,move.obj,process.obj,-
- ! r_xrand.obj,rcvop.obj,readmail.obj,save.obj,t_email.obj,vars.obj,-
- ! sys$share:vaxccurse.olb/library,-
- ! sys$disk:[]ldb.opt/option
- $ set noverify
- $ exit
- *** 130src/patchlevel.h Mon Aug 2 13:05:11 1993
- --- patchlevel.h Fri Aug 20 18:34:33 1993
- ***************
- *** 36,40 ****
-
- #define VERSION 1
- #define REVISION 3 /* no more than 9 */
- ! #define PATCHLEVEL 0 /* no more than 9 */
- ! #define AUTHOR_EMAIL "ross@emf780.den.mmc.com"
- --- 36,40 ----
-
- #define VERSION 1
- #define REVISION 3 /* no more than 9 */
- ! #define PATCHLEVEL 1 /* no more than 9 */
- ! #define AUTHOR_EMAIL "perry@aap.com"
- *** 130src/rcvop.c Mon Aug 2 13:05:35 1993
- --- rcvop.c Thu Jun 10 10:13:53 1993
- ***************
- *** 407,412 ****
- --- 407,416 ----
- clearmvs(g->mvs); /* erase our previous move */
- rolldice(g); /* go ahead and roll, I can't double */
- g->dispmsg = save("Opponent has accepted your double.");/* notify user */
- + if (*rc.chkpt == 'y') { /* checkpoint games */
- + writegames(rc.gfile,rc.gbackup,rc.pfile);
- + rc.gbackup = NULL; /* only backup old file once */
- + }
- }
-
-
- *** 130src/readmail.c Mon Aug 2 13:05:38 1993
- --- readmail.c Tue Aug 3 13:40:37 1993
- ***************
- *** 232,238 ****
- clearmvs(P.mvs);
- P.gameptr = NULL;
- P.notify = NULL;
- ! nvscan(fp,nv_packet,&P); /* scan the packet into P */
- if (P.gameid == NULL) { /* didn't get a gameid */
- message("ERROR: missing gameid in packet -- ignored\n");
- continue;
- --- 232,241 ----
- clearmvs(P.mvs);
- P.gameptr = NULL;
- P.notify = NULL;
- ! if (nvscan(fp,nv_packet,&P,NULL) < 0) { /* scan the packet into P */
- ! message("ERROR: bad line in packet -- ignored.\n");
- ! continue;
- ! }
- if (P.gameid == NULL) { /* didn't get a gameid */
- message("ERROR: missing gameid in packet -- ignored\n");
- continue;
- *** 130src/save.c Mon Aug 2 13:05:59 1993
- --- save.c Tue Aug 3 13:56:35 1993
- ***************
- *** 58,64 ****
- readldbrc()
- {
- FILE *fp;
- ! char *s, *n, *getenv();
- char buf[80];
-
- if ( (s = getenv("HOME")) != NULL) /* if we have a home */
- --- 58,65 ----
- readldbrc()
- {
- FILE *fp;
- ! int line;
- ! char *s, *getenv();
- char buf[80];
-
- if ( (s = getenv("HOME")) != NULL) /* if we have a home */
- ***************
- *** 168,175 ****
- rc.acctime = 7; /* access timeout in 7 days by default */
- rc.keepold = 7; /* keep dead games 7 days by default */
- rc.debug = 0; /* default to no debug */
- ! if ( (n = nvscan(fp,nv_rcfile,&rc)) != NULL) {
- ! fprintf(stderr,"Invalid line in .ldbrc: %s\n",n);
- ldbexit(STAT_ABORT);
- }
- fclose(fp);
- --- 169,177 ----
- rc.acctime = 7; /* access timeout in 7 days by default */
- rc.keepold = 7; /* keep dead games 7 days by default */
- rc.debug = 0; /* default to no debug */
- ! line = 0;
- ! if (nvscan(fp,nv_rcfile,&rc,&line) < 0) {
- ! fprintf(stderr,"ERROR: invalid line %d in %s: %s\n",line,s,nvbuf);
- ldbexit(STAT_ABORT);
- }
- fclose(fp);
- ***************
- *** 222,228 ****
- readgames()
- {
- FILE *fp;
- ! char c, *s;
- struct game *g;
- long old;
-
- --- 224,231 ----
- readgames()
- {
- FILE *fp;
- ! int c, line;
- ! char *s;
- struct game *g;
- long old;
-
- ***************
- *** 232,237 ****
- --- 235,241 ----
- old = time( (long *) 0);
- if (rc.keepold > 0) /* if keeping old games is enabled */
- old -= (rc.keepold * 86400); /* how old is too old? */
- + line = 0;
- while ( (c = getc(fp)) != EOF) {
- ungetc(c,fp); /* put char back */
- g = addgame(); /* insert a new game */
- ***************
- *** 249,258 ****
- g->starttime = 0L;
- clearmvs(g->opmvs);
- clearmvs(g->mvs);
- ! if ( (s = nvscan(fp,nv_gfile,g)) != NULL) { /* read game */
- FeFinishSession(); /* close down front-end */
- TFinishSession(); /* close down transport */
- ! fprintf(stderr,"ERROR: invalid line in %s: %s\n", rc.gfile, s);
- ldbexit(STAT_ABORT);
- }
- if (g->gameid == NULL) { /* empty game (prob. EOF) */
- --- 253,263 ----
- g->starttime = 0L;
- clearmvs(g->opmvs);
- clearmvs(g->mvs);
- ! if (nvscan(fp,nv_gfile,g,&line) < 0) { /* read game */
- FeFinishSession(); /* close down front-end */
- TFinishSession(); /* close down transport */
- ! fprintf(stderr,"ERROR: invalid line %d in %s: %s\n",
- ! line, rc.gfile, nvbuf);
- ldbexit(STAT_ABORT);
- }
- if (g->gameid == NULL) { /* empty game (prob. EOF) */
- ***************
- *** 351,361 ****
- readpeople()
- {
- FILE *fp;
- ! char c, *s;
- struct people *p;
-
- if ( (fp = fopen(rc.pfile,"r")) == NULL)
- return; /* no people file */
- while ( (c = getc(fp)) != EOF) {
- ungetc(c,fp); /* put char back */
- p = addppl(); /* insert a new record */
- --- 356,368 ----
- readpeople()
- {
- FILE *fp;
- ! int c, line;
- ! char *s;
- struct people *p;
-
- if ( (fp = fopen(rc.pfile,"r")) == NULL)
- return; /* no people file */
- + line = 0;
- while ( (c = getc(fp)) != EOF) {
- ungetc(c,fp); /* put char back */
- p = addppl(); /* insert a new record */
- ***************
- *** 365,374 ****
- p->myaddr = NULL;
- p->equiv = NULL;
- p->fence = 0L;
- ! if ( (s = nvscan(fp,nv_pfile,p)) != NULL) { /* read record */
- FeFinishSession(); /* close down front-end */
- TFinishSession(); /* close down transport */
- ! fprintf(stderr,"ERROR: invalid line in %s: %s\n", rc.pfile, s);
- ldbexit(STAT_ABORT);
- }
- if (p->equiv != NULL) /* an equiv record */
- --- 372,382 ----
- p->myaddr = NULL;
- p->equiv = NULL;
- p->fence = 0L;
- ! if (nvscan(fp,nv_pfile,p,&line) < 0) { /* read record */
- FeFinishSession(); /* close down front-end */
- TFinishSession(); /* close down transport */
- ! fprintf(stderr,"ERROR: invalid line %d in %s: %s\n",
- ! c, rc.pfile, nvbuf);
- ldbexit(STAT_ABORT);
- }
- if (p->equiv != NULL) /* an equiv record */
- ***************
- *** 477,506 ****
- * expected to be in the form "name=value\n", with no spaces before
- * or after name, and with any spaces after the = or before the
- * newline being part of the value string. Comments are indicated by
- ! * a # in column 1, which comments to the end of the line.
- *----------------------------------------------------------------------
- */
-
- ! char *nvscan(fp,t,st)
- FILE *fp; /* file to scan */
- struct namevalue *t; /* table of name/value pairs */
- char *st; /* really a pointer to a structure */
- {
- - static char buf[128];
- char *s, **p;
- int i, j;
- union nvtypes u;
- long atol();
-
- ! while (fgets(buf,sizeof(buf),fp) != NULL) {
- ! if (*buf == '#') /* comment character */
- continue;
- ! buf[strlen(buf)-1] = '\0'; /* clobber the newline */
- ! if ( (s = strchr(buf,'=')) == NULL)
- ! return(buf); /* bad line, return it */
- *s++ = '\0';
- for (i = 0; t[i].name != NULL; i++)
- ! if (strcmp(t[i].name,buf) == 0)
- break;
- if (t[i].name == NULL) /* got a name we don't recognize */
- continue; /* ignore it */
- --- 485,518 ----
- * expected to be in the form "name=value\n", with no spaces before
- * or after name, and with any spaces after the = or before the
- * newline being part of the value string. Comments are indicated by
- ! * a # in column 1, which comments to the end of the line. If lp is
- ! * not NULL, it is incremented for each line read. 0 is returned for
- ! * success, -1 for failure.
- *----------------------------------------------------------------------
- */
-
- ! nvscan(fp,t,st,lp)
- FILE *fp; /* file to scan */
- struct namevalue *t; /* table of name/value pairs */
- char *st; /* really a pointer to a structure */
- + int *lp;
- {
- char *s, **p;
- int i, j;
- union nvtypes u;
- long atol();
-
- ! while (fgets(nvbuf,sizeof(nvbuf),fp) != NULL) {
- ! if (lp != NULL)
- ! (*lp)++;
- ! if (*nvbuf == '#') /* comment character */
- continue;
- ! nvbuf[strlen(nvbuf)-1] = '\0'; /* clobber the newline */
- ! if ( (s = strchr(nvbuf,'=')) == NULL)
- ! return(-1); /* bad line, return failure */
- *s++ = '\0';
- for (i = 0; t[i].name != NULL; i++)
- ! if (strcmp(t[i].name,nvbuf) == 0)
- break;
- if (t[i].name == NULL) /* got a name we don't recognize */
- continue; /* ignore it */
- ***************
- *** 552,564 ****
- }
- break;
- case FT_END: /* we hit the end marker */
- ! return(NULL); /* return success */
- default: /* we have a bad nv table */
- *--s = '='; /* restore the buffer */
- ! return(buf); /* return bad line */
- }
- }
- ! return(NULL);
- }
-
-
- --- 564,576 ----
- }
- break;
- case FT_END: /* we hit the end marker */
- ! return(0); /* return success */
- default: /* we have a bad nv table */
- *--s = '='; /* restore the buffer */
- ! return(-1); /* return failure */
- }
- }
- ! return(0);
- }
-
-
- ***************
- *** 582,588 ****
- char *st; /* really a pointer to a structure */
- {
- struct namevalue *n;
- - static char buf[128];
- int nstr;
- union nvtypes u;
- char c, **stbl;
- --- 594,599 ----
- ***************
- *** 603,610 ****
- break;
- case FT_MOVE: /* store a struct mv */
- if (u.nvmove->roll > 0) {
- ! mv2str(u.nvmove,buf);
- ! fprintf(fp,"%s=%s\n",n->name,buf);
- }
- break;
- case FT_BOARD: /* store an entire board */
- --- 614,621 ----
- break;
- case FT_MOVE: /* store a struct mv */
- if (u.nvmove->roll > 0) {
- ! mv2str(u.nvmove,nvbuf);
- ! fprintf(fp,"%s=%s\n",n->name,nvbuf);
- }
- break;
- case FT_BOARD: /* store an entire board */
- *** 130src/vars.c Mon Aug 2 13:05:27 1993
- --- vars.c Tue Aug 3 13:42:05 1993
- ***************
- *** 31,38 ****
- struct packet P; /* last packet read */
- char cr_mycolor; /* my color when game is created */
- char cr_opcolor; /* opponent's color for new games */
- ! char cr_mydir; /* my direction for new games */
- char *notify; /* address to notify when game ends */
- char blk76[] = /* 76 blanks */
- " ";
-
- --- 31,39 ----
- struct packet P; /* last packet read */
- char cr_mycolor; /* my color when game is created */
- char cr_opcolor; /* opponent's color for new games */
- ! int cr_mydir; /* my direction for new games */
- char *notify; /* address to notify when game ends */
- + char nvbuf[128]; /* buffer for nvscan/nvwrite */
- char blk76[] = /* 76 blanks */
- " ";
-
- ***************
- *** 137,144 ****
- "myaddr", FT_STRING, Offset(struct game *,myaddr), NULL,
- "mycolor", FT_CHAR, Offset(struct game *,mycolor), 0,
- "opcolor", FT_CHAR, Offset(struct game *,opcolor), 0,
- ! "mydir", FT_CHAR, Offset(struct game *,mydir), 0,
- ! "opdir", FT_CHAR, Offset(struct game *,opdir), 0,
- "gameval", FT_INT, Offset(struct game *,gameval), 0,
- "flags", FT_INT, Offset(struct game *,flags), 0,
- "opversion", FT_INT, Offset(struct game *,opver), 0,
- --- 138,145 ----
- "myaddr", FT_STRING, Offset(struct game *,myaddr), NULL,
- "mycolor", FT_CHAR, Offset(struct game *,mycolor), 0,
- "opcolor", FT_CHAR, Offset(struct game *,opcolor), 0,
- ! "mydir", FT_INT, Offset(struct game *,mydir), 0,
- ! "opdir", FT_INT, Offset(struct game *,opdir), 0,
- "gameval", FT_INT, Offset(struct game *,gameval), 0,
- "flags", FT_INT, Offset(struct game *,flags), 0,
- "opversion", FT_INT, Offset(struct game *,opver), 0,
-
- exit 0 # Just in case...
-