Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games Use the symbolic names `SEEK_SET' and `O_RDONLY' where...



details:   https://anonhg.NetBSD.org/src/rev/31a566742f7a
branches:  trunk
changeset: 476177:31a566742f7a
user:      jsm <jsm%NetBSD.org@localhost>
date:      Wed Sep 08 21:57:16 1999 +0000

description:
Use the symbolic names `SEEK_SET' and `O_RDONLY' where appropriate in
the games.

diffstat:

 games/fortune/fortune/fortune.c |  10 +++++-----
 games/fortune/strfile/strfile.c |  12 ++++++------
 games/fortune/unstr/unstr.c     |   6 +++---
 games/hangman/getword.c         |   6 +++---
 games/mille/save.c              |   6 +++---
 games/monop/cards.c             |   6 +++---
 games/monop/initdeck.c          |   8 ++++----
 games/phantasia/fight.c         |   6 +++---
 games/phantasia/gamesupport.c   |  10 +++++-----
 games/phantasia/interplayer.c   |  24 ++++++++++++------------
 games/phantasia/main.c          |  10 +++++-----
 games/phantasia/misc.c          |  18 +++++++++---------
 games/robots/score.c            |   6 +++---
 games/sail/sync.c               |   6 +++---
 games/snake/snake/snake.c       |  10 +++++-----
 15 files changed, 72 insertions(+), 72 deletions(-)

diffs (truncated from 630 to 300 lines):

diff -r ca43056e468a -r 31a566742f7a games/fortune/fortune/fortune.c
--- a/games/fortune/fortune/fortune.c   Wed Sep 08 21:45:25 1999 +0000
+++ b/games/fortune/fortune/fortune.c   Wed Sep 08 21:57:16 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fortune.c,v 1.17 1999/09/08 21:45:27 jsm Exp $ */
+/*     $NetBSD: fortune.c,v 1.18 1999/09/08 21:57:16 jsm Exp $ */
 
 /*-
  * Copyright (c) 1986, 1993
@@ -46,7 +46,7 @@
 #if 0
 static char sccsid[] = "@(#)fortune.c  8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: fortune.c,v 1.17 1999/09/08 21:45:27 jsm Exp $");
+__RCSID("$NetBSD: fortune.c,v 1.18 1999/09/08 21:57:16 jsm Exp $");
 #endif
 #endif /* not lint */
 
@@ -260,7 +260,7 @@
        char    line[BUFSIZ];
 
        open_fp(fp);
-       (void) fseek(fp->inf, (long)Seekpts[0], 0);
+       (void) fseek(fp->inf, (long)Seekpts[0], SEEK_SET);
        for (Fort_len = 0; fgets(line, sizeof line, fp->inf) != NULL &&
            !STR_ENDSTRING(line, fp->tbl); Fort_len++) {
                if (fp->tbl.str_flags & STR_ROTATED) {
@@ -289,7 +289,7 @@
                nchar = (Seekpts[1] - Seekpts[0] <= SLEN);
        else {
                open_fp(Fortfile);
-               (void) fseek(Fortfile->inf, (long)Seekpts[0], 0);
+               (void) fseek(Fortfile->inf, (long)Seekpts[0], SEEK_SET);
                nchar = 0;
                while (fgets(line, sizeof line, Fortfile->inf) != NULL &&
                       !STR_ENDSTRING(line, Fortfile->tbl))
@@ -990,7 +990,7 @@
        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);
        BE64TOH(Seekpts[0]);
        BE64TOH(Seekpts[1]);
diff -r ca43056e468a -r 31a566742f7a games/fortune/strfile/strfile.c
--- a/games/fortune/strfile/strfile.c   Wed Sep 08 21:45:25 1999 +0000
+++ b/games/fortune/strfile/strfile.c   Wed Sep 08 21:57:16 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: strfile.c,v 1.10 1999/09/08 21:17:49 jsm Exp $ */
+/*     $NetBSD: strfile.c,v 1.11 1999/09/08 21:57:17 jsm Exp $ */
 
 /*-
  * Copyright (c) 1989, 1993
@@ -46,7 +46,7 @@
 #if 0
 static char sccsid[] = "@(#)strfile.c  8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: strfile.c,v 1.10 1999/09/08 21:17:49 jsm Exp $");
+__RCSID("$NetBSD: strfile.c,v 1.11 1999/09/08 21:57:17 jsm Exp $");
 #endif
 #endif /* not lint */
 
@@ -175,7 +175,7 @@
        if ((outf = fopen(Outfile, "w")) == NULL)
                err(1, "open `%s'", Outfile);
        if (!STORING_PTRS)
-               (void) fseek(outf, sizeof Tbl, 0);
+               (void) fseek(outf, sizeof Tbl, SEEK_SET);
 
        /*
         * Write the strings onto the file
@@ -243,7 +243,7 @@
                       Tbl.str_shortlen == 1 ? "" : "s");
        }
 
-       (void) fseek(outf, (off_t) 0, 0);
+       (void) fseek(outf, (off_t) 0, SEEK_SET);
        HTOBE32(Tbl.str_version);
        Tbl.str_numstr = htobe32(Num_pts - 1);
        HTOBE32(Tbl.str_longlen);
@@ -411,8 +411,8 @@
        if (c1 != c2)
                return c1 - c2;
 
-       (void) fseek(Sort_1, p1->pos, 0);
-       (void) fseek(Sort_2, p2->pos, 0);
+       (void) fseek(Sort_1, p1->pos, SEEK_SET);
+       (void) fseek(Sort_2, p2->pos, SEEK_SET);
 
        n1 = FALSE;
        n2 = FALSE;
diff -r ca43056e468a -r 31a566742f7a games/fortune/unstr/unstr.c
--- a/games/fortune/unstr/unstr.c       Wed Sep 08 21:45:25 1999 +0000
+++ b/games/fortune/unstr/unstr.c       Wed Sep 08 21:57:16 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: unstr.c,v 1.5 1999/08/21 07:02:46 simonb Exp $ */
+/*     $NetBSD: unstr.c,v 1.6 1999/09/08 21:57:17 jsm Exp $    */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -46,7 +46,7 @@
 #if 0
 static char sccsid[] = "@(#)unstr.c    8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: unstr.c,v 1.5 1999/08/21 07:02:46 simonb Exp $");
+__RCSID("$NetBSD: unstr.c,v 1.6 1999/09/08 21:57:17 jsm Exp $");
 #endif
 #endif /* not lint */
 
@@ -140,7 +140,7 @@
 
        for (i = 0; i < tbl->str_numstr; i++) {
                (void) fread((char *) &pos, 1, sizeof pos, Dataf);
-               (void) fseek(Inf, be64toh(pos), 0);
+               (void) fseek(Inf, be64toh(pos), SEEK_SET);
                if (i != 0)
                        (void) printf("%c\n", Delimch);
                for (;;) {
diff -r ca43056e468a -r 31a566742f7a games/hangman/getword.c
--- a/games/hangman/getword.c   Wed Sep 08 21:45:25 1999 +0000
+++ b/games/hangman/getword.c   Wed Sep 08 21:57:16 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getword.c,v 1.5 1997/10/11 01:16:30 lukem Exp $        */
+/*     $NetBSD: getword.c,v 1.6 1999/09/08 21:57:17 jsm Exp $  */
 
 /*
  * Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)getword.c  8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: getword.c,v 1.5 1997/10/11 01:16:30 lukem Exp $");
+__RCSID("$NetBSD: getword.c,v 1.6 1999/09/08 21:57:17 jsm Exp $");
 #endif
 #endif /* not lint */
 
@@ -58,7 +58,7 @@
        inf = Dict;
        for (;;) {
                pos = (double) rand() / (RAND_MAX + 1.0) * (double) Dict_size;
-               fseek(inf, pos, 0);
+               fseek(inf, pos, SEEK_SET);
                if (fgets(Word, BUFSIZ, inf) == NULL)
                        continue;
                if (fgets(Word, BUFSIZ, inf) == NULL)
diff -r ca43056e468a -r 31a566742f7a games/mille/save.c
--- a/games/mille/save.c        Wed Sep 08 21:45:25 1999 +0000
+++ b/games/mille/save.c        Wed Sep 08 21:57:16 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: save.c,v 1.8 1999/09/08 21:17:51 jsm Exp $     */
+/*     $NetBSD: save.c,v 1.9 1999/09/08 21:57:18 jsm Exp $     */
 
 /*
  * Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)save.c     8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: save.c,v 1.8 1999/09/08 21:17:51 jsm Exp $");
+__RCSID("$NetBSD: save.c,v 1.9 1999/09/08 21:57:18 jsm Exp $");
 #endif
 #endif /* not lint */
 
@@ -152,7 +152,7 @@
        char    buf[80];
        STAT    sbuf;
 
-       if ((inf = open(file, 0)) < 0) {
+       if ((inf = open(file, O_RDONLY)) < 0) {
                warn("%s", file);
                exit(1);
        }
diff -r ca43056e468a -r 31a566742f7a games/monop/cards.c
--- a/games/monop/cards.c       Wed Sep 08 21:45:25 1999 +0000
+++ b/games/monop/cards.c       Wed Sep 08 21:57:16 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cards.c,v 1.8 1999/09/08 21:17:51 jsm Exp $    */
+/*     $NetBSD: cards.c,v 1.9 1999/09/08 21:57:18 jsm Exp $    */
 
 /*
  * Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)cards.c    8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: cards.c,v 1.8 1999/09/08 21:17:51 jsm Exp $");
+__RCSID("$NetBSD: cards.c,v 1.9 1999/09/08 21:57:18 jsm Exp $");
 #endif
 #endif /* not lint */
 
@@ -136,7 +136,7 @@
        OWN *op;
 
        do {
-               fseek(deckf, dp->offsets[dp->last_card], 0);
+               fseek(deckf, dp->offsets[dp->last_card], SEEK_SET);
                dp->last_card = ++(dp->last_card) % dp->num_cards;
                type_maj = getc(deckf);
        } while (dp->gojf_used && type_maj == GOJF);
diff -r ca43056e468a -r 31a566742f7a games/monop/initdeck.c
--- a/games/monop/initdeck.c    Wed Sep 08 21:45:25 1999 +0000
+++ b/games/monop/initdeck.c    Wed Sep 08 21:57:16 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: initdeck.c,v 1.8 1999/09/08 21:17:52 jsm Exp $ */
+/*     $NetBSD: initdeck.c,v 1.9 1999/09/08 21:57:18 jsm Exp $ */
 
 /*
  * Copyright (c) 1980, 1993
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)initdeck.c 8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: initdeck.c,v 1.8 1999/09/08 21:17:52 jsm Exp $");
+__RCSID("$NetBSD: initdeck.c,v 1.9 1999/09/08 21:57:18 jsm Exp $");
 #endif
 #endif /* not lint */
 
@@ -101,7 +101,7 @@
         */
        CC_D.offsets = (off_t *)calloc(CC_D.num_cards + 1, sizeof (off_t));
        CH_D.offsets = (off_t *)calloc(CH_D.num_cards + 1, sizeof (off_t));
-       fseek(inf, 0L, 0);
+       fseek(inf, 0L, SEEK_SET);
        if ((outf = fopen(outfile, "w")) == NULL) {
                perror(outfile);
                exit(0);
@@ -122,7 +122,7 @@
        putem();
 
        fclose(inf);
-       fseek(outf, 0, 0L);
+       fseek(outf, 0, SEEK_SET);
 
        /* number of community chest cards first... */
        nc = htobe32(CC_D.num_cards);
diff -r ca43056e468a -r 31a566742f7a games/phantasia/fight.c
--- a/games/phantasia/fight.c   Wed Sep 08 21:45:25 1999 +0000
+++ b/games/phantasia/fight.c   Wed Sep 08 21:57:16 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fight.c,v 1.4 1998/08/30 09:19:39 veego Exp $  */
+/*     $NetBSD: fight.c,v 1.5 1999/09/08 21:57:18 jsm Exp $    */
 
 /*
  * fight.c   Phantasia monster fighting routines
@@ -844,7 +844,7 @@
        which = MIN(which, 99); /* make sure within range */
 
        /* fill structure */
-       fseek(Monstfp, (long) which * (long) SZ_MONSTERSTRUCT, 0);
+       fseek(Monstfp, (long) which * (long) SZ_MONSTERSTRUCT, SEEK_SET);
        fread((char *) &Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp);
 
        /* handle some special monsters */
@@ -879,7 +879,7 @@
                        /* pick another name */
                {
                        which = (int) ROLL(0.0, 100.0);
-                       fseek(Monstfp, (long) which * (long) SZ_MONSTERSTRUCT, 0);
+                       fseek(Monstfp, (long) which * (long) SZ_MONSTERSTRUCT, SEEK_SET);
                        fread(&Othermonster, SZ_MONSTERSTRUCT, 1, Monstfp);
                        strcpy(Curmonster.m_name, Othermonster.m_name);
                }
diff -r ca43056e468a -r 31a566742f7a games/phantasia/gamesupport.c
--- a/games/phantasia/gamesupport.c     Wed Sep 08 21:45:25 1999 +0000
+++ b/games/phantasia/gamesupport.c     Wed Sep 08 21:57:16 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gamesupport.c,v 1.5 1999/09/08 21:17:53 jsm Exp $      */
+/*     $NetBSD: gamesupport.c,v 1.6 1999/09/08 21:57:19 jsm Exp $      */
 
 /*
  * gamesupport.c - auxiliary routines for support of Phantasia
@@ -443,7 +443,7 @@
        int     count = 0;      /* count in file */
 
        puts(" #)  Name                 Str  Brain  Quick  Energy  Exper  Treas  Type  Flock%\n");
-       fseek(Monstfp, 0L, 0);
+       fseek(Monstfp, 0L, SEEK_SET);
        while (fread((char *) &Curmonster, SZ_MONSTERSTRUCT, 1, Monstfp) == 1)
                printf("%2d)  %-20.20s%4.0f   %4.0f     %2.0f   %5.0f  %5.0f     %2d    %2d     %3.0f\n", count++,
                    Curmonster.m_name, Curmonster.m_strength, Curmonster.m_brains,
@@ -468,7 +468,7 @@
 void
 activelist()
 {
-       fseek(Playersfp, 0L, 0);
+       fseek(Playersfp, 0L, SEEK_SET);
        printf("Current characters on file are:\n\n");
 
        while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
@@ -492,7 +492,7 @@
        today = localtime(&ltime)->tm_yday;
 
        for (;;) {
-               fseek(Playersfp, loc, 0);
+               fseek(Playersfp, loc, SEEK_SET);
                if (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) != 1)
                        break;
 
@@ -543,7 +543,7 @@



Home | Main Index | Thread Index | Old Index