]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - phantasia/main.c
Use only one of -literal and -unfilled with Bd.
[bsdgames-darwin.git] / phantasia / main.c
index efa49e052bd5980f2332c8e0bc7d1a7ea79a32f4..871ff678335686c87263038d3999b99e02ea7fbb 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.7 1999/09/08 21:17:54 jsm Exp $     */
+/*     $NetBSD: main.c,v 1.11 2003/05/08 13:03:49 wiz Exp $    */
 
 /*
  * Phantasia 3.3.2 -- Interterminal fantasy game
@@ -57,7 +57,7 @@
 
 #include "include.h"
 
-int    main __P((int, char **));
+int    main(int, char **);
 
 int
 main(argc, argv)
@@ -287,6 +287,8 @@ initialstate()
        if ((Playersfp = fopen(_PATH_PEOPLE, "r+")) == NULL)
                error(_PATH_PEOPLE);
        /* NOTREACHED */
+       if (fileno(Playersfp) < 3)
+               exit(1);
 
        if ((Monstfp = fopen(_PATH_MONST, "r+")) == NULL)
                error(_PATH_MONST);
@@ -626,7 +628,7 @@ titlelist()
                fclose(fp);
        }
        /* search for king */
-       fseek(Playersfp, 0L, 0);
+       fseek(Playersfp, 0L, SEEK_SET);
        while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
                if (Other.p_specialtype == SC_KING &&
                    Other.p_status != S_NOTUSED)
@@ -642,7 +644,7 @@ titlelist()
                mvaddstr(4, 24, "There is no ruler at this time.");
 
        /* search for valar */
-       fseek(Playersfp, 0L, 0);
+       fseek(Playersfp, 0L, SEEK_SET);
        while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
                if (Other.p_specialtype == SC_VALAR && Other.p_status != S_NOTUSED)
                        /* found the valar */
@@ -652,7 +654,7 @@ titlelist()
                        break;
                }
        /* search for council of the wise */
-       fseek(Playersfp, 0L, 0);
+       fseek(Playersfp, 0L, SEEK_SET);
        Lines = 10;
        while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
                if (Other.p_specialtype == SC_COUNCIL && Other.p_status != S_NOTUSED)
@@ -671,7 +673,7 @@ titlelist()
        hiexp = 0.0;
        nxtlvl = hilvl = 0;
 
-       fseek(Playersfp, 0L, 0);
+       fseek(Playersfp, 0L, SEEK_SET);
        while (fread((char *) &Other, SZ_PLAYERSTRUCT, 1, Playersfp) == 1)
                if (Other.p_experience > hiexp && Other.p_specialtype <= SC_KING && Other.p_status != S_NOTUSED)
                        /* highest found so far */
@@ -979,7 +981,7 @@ playinit()
 
        initscr();              /* turn on curses */
        noecho();               /* do not echo input */
-       crmode();               /* do not process erase, kill */
+       cbreak();               /* do not process erase, kill */
        clear();
        refresh();
        Windows = TRUE;         /* mark the state */
@@ -992,7 +994,7 @@ cleanup(doexit)
        if (Windows) {
                move(LINES - 2, 0);
                refresh();
-               nocrmode();
+               nocbreak();
                endwin();
        }
        fclose(Playersfp);