ANSI
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Fri, 1 Mar 1991 05:14:11 +0000 (21:14 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Fri, 1 Mar 1991 05:14:11 +0000 (21:14 -0800)
SCCS-vsn: games/cribbage/cards.c 5.5
SCCS-vsn: games/cribbage/crib.c 5.6
SCCS-vsn: games/cribbage/instr.c 5.2
SCCS-vsn: games/cribbage/io.c 5.8
SCCS-vsn: games/cribbage/support.c 5.6
SCCS-vsn: games/hangman/hangman.h 5.5
SCCS-vsn: games/hangman/main.c 5.4

usr/src/games/cribbage/cards.c
usr/src/games/cribbage/crib.c
usr/src/games/cribbage/instr.c
usr/src/games/cribbage/io.c
usr/src/games/cribbage/support.c
usr/src/games/hangman/hangman.h
usr/src/games/hangman/main.c

index 7b396bb..f62d798 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)cards.c    5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)cards.c    5.5 (Berkeley) %G%";
 #endif /* not lint */
 
 #include       <stdio.h>
 #endif /* not lint */
 
 #include       <stdio.h>
@@ -96,7 +96,7 @@ isone( a, b, n )
  * remove the card a from the deck d of n cards
  */
 
  * remove the card a from the deck d of n cards
  */
 
-remove( a, d, n )
+cremove( a, d, n )
 
     CARD               a, d[];
     int                        n;
 
     CARD               a, d[];
     int                        n;
index 4fbe06b..1de6e34 100644 (file)
@@ -12,7 +12,7 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)crib.c     5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)crib.c     5.6 (Berkeley) %G%";
 #endif /* not lint */
 
 # include      <sys/signal.h>
 #endif /* not lint */
 
 # include      <sys/signal.h>
@@ -306,12 +306,12 @@ BOOLEAN           mycrib;
        prompt = (quiet ? "Discard --> " : "Discard a card --> ");
        cdiscard(mycrib);                       /* puts best discard at end */
        crd = phand[infrom(phand, FULLHAND, prompt)];
        prompt = (quiet ? "Discard --> " : "Discard a card --> ");
        cdiscard(mycrib);                       /* puts best discard at end */
        crd = phand[infrom(phand, FULLHAND, prompt)];
-       remove(crd, phand, FULLHAND);
+       cremove(crd, phand, FULLHAND);
        prhand(phand, FULLHAND, Playwin, FALSE);
        crib[0] = crd;
 /* next four lines same as last four except for cdiscard() */
        crd = phand[infrom(phand, FULLHAND - 1, prompt)];
        prhand(phand, FULLHAND, Playwin, FALSE);
        crib[0] = crd;
 /* next four lines same as last four except for cdiscard() */
        crd = phand[infrom(phand, FULLHAND - 1, prompt)];
-       remove(crd, phand, FULLHAND - 1);
+       cremove(crd, phand, FULLHAND - 1);
        prhand(phand, FULLHAND, Playwin, FALSE);
        crib[1] = crd;
        crib[2] = chand[4];
        prhand(phand, FULLHAND, Playwin, FALSE);
        crib[1] = crd;
        crib[2] = chand[4];
@@ -453,7 +453,7 @@ BOOLEAN             mycrib;
                    if (j < 0)                          /* if nothing scores */
                        j = cchose(ch, cnum, sum);
                    crd = ch[j];
                    if (j < 0)                          /* if nothing scores */
                        j = cchose(ch, cnum, sum);
                    crd = ch[j];
-                   remove(crd, ch, cnum--);
+                   cremove(crd, ch, cnum--);
                    sum += VAL(crd.rank);
                    Table[Tcnt++] = crd;
                    if (k > 0) {
                    sum += VAL(crd.rank);
                    Table[Tcnt++] = crd;
                    if (k > 0) {
@@ -501,7 +501,7 @@ BOOLEAN             mycrib;
                                msg("Total > 31 -- try again");
                        }
                    makeknown(&crd, 1);
                                msg("Total > 31 -- try again");
                        }
                    makeknown(&crd, 1);
-                   remove(crd, ph, pnum--);
+                   cremove(crd, ph, pnum--);
                    i = pegscore(crd, Table, Tcnt, sum);
                    sum += VAL(crd.rank);
                    Table[Tcnt++] = crd;
                    i = pegscore(crd, Table, Tcnt, sum);
                    sum += VAL(crd.rank);
                    Table[Tcnt++] = crd;
index 9893b78..e38807c 100644 (file)
@@ -6,15 +6,17 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)instr.c    5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)instr.c    5.2 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <sys/errno.h>
 #include <sys/stat.h>
 #endif /* not lint */
 
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <sys/errno.h>
 #include <sys/stat.h>
-#include <sys/file.h>
+#include <unistd.h>
 #include <stdio.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include "pathnames.h"
 
 instructions()
 #include "pathnames.h"
 
 instructions()
@@ -22,8 +24,8 @@ instructions()
        extern int errno;
        struct stat sb;
        union wait pstat;
        extern int errno;
        struct stat sb;
        union wait pstat;
-       pid_t pid, waitpid();
-       char *pager, *path, *getenv(), *rindex(), *strerror();
+       pid_t pid;
+       char *pager, *path;
 
        if (stat(_PATH_INSTR, &sb)) {
                (void)fprintf(stderr, "cribbage: %s: %s.\n", _PATH_INSTR,
 
        if (stat(_PATH_INSTR, &sb)) {
                (void)fprintf(stderr, "cribbage: %s: %s.\n", _PATH_INSTR,
@@ -45,7 +47,7 @@ instructions()
                _exit(1);
        default:
                do {
                _exit(1);
        default:
                do {
-                       pid = waitpid(pid, &pstat, 0);
+                       pid = waitpid(pid, (int *)&pstat, 0);
                } while (pid == -1 && errno == EINTR);
                if (pid == -1 || pstat.w_status)
                        exit(1);
                } while (pid == -1 && errno == EINTR);
                if (pid == -1 || pstat.w_status)
                        exit(1);
index c838da8..b418e1d 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)io.c       5.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)io.c       5.8 (Berkeley) %G%";
 #endif /* not lint */
 
 # include      <curses.h>
 #endif /* not lint */
 
 # include      <curses.h>
@@ -354,7 +354,7 @@ msg(fmt)
        va_list ap;
 
        va_start(ap, fmt);
        va_list ap;
 
        va_start(ap, fmt);
-       (void)vsprintf(Msgbuf[Newpos], fmt, ap);
+       (void)vsprintf(&Msgbuf[Newpos], fmt, ap);
        va_end(ap);
        endmsg();
 }
        va_end(ap);
        endmsg();
 }
@@ -370,7 +370,7 @@ addmsg(fmt)
        va_list ap;
 
        va_start(ap, fmt);
        va_list ap;
 
        va_start(ap, fmt);
-       (void)vsprintf(Msgbuf[Newpos], fmt, ap);
+       (void)vsprintf(&Msgbuf[Newpos], fmt, ap);
        va_end(ap);
 }
 
        va_end(ap);
 }
 
index cebf195..c593724 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)support.c  5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)support.c  5.6 (Berkeley) %G%";
 #endif /* not lint */
 
 #include       <curses.h>
 #endif /* not lint */
 
 #include       <curses.h>
@@ -218,7 +218,7 @@ cdiscard( mycrib )
        makedeck( d );
        nc = CARDS;
        for( i = 0; i < knownum; i++ )  {       /* get all other cards */
        makedeck( d );
        nc = CARDS;
        for( i = 0; i < knownum; i++ )  {       /* get all other cards */
-           remove( known[i], d, nc-- );
+           cremove( known[i], d, nc-- );
        }
        for( i = 0; i < 15; i++ )  sums[i] = 0L;
        ns = 0;
        }
        for( i = 0; i < 15; i++ )  sums[i] = 0L;
        ns = 0;
@@ -227,8 +227,8 @@ cdiscard( mycrib )
            for( j = i + 1; j < FULLHAND; j++ )  {
                cb[1] = chand[j];
                for( k = 0; k < FULLHAND; k++ )  h[k] = chand[k];
            for( j = i + 1; j < FULLHAND; j++ )  {
                cb[1] = chand[j];
                for( k = 0; k < FULLHAND; k++ )  h[k] = chand[k];
-               remove( chand[i], h, FULLHAND );
-               remove( chand[j], h, FULLHAND - 1 );
+               cremove( chand[i], h, FULLHAND );
+               cremove( chand[j], h, FULLHAND - 1 );
                for( k = 0; k < nc; k++ )  {
                    sums[ns] += scorehand( h, d[k], CINHAND, TRUE, FALSE );
                    if( mycrib )  sums[ns] += adjust( cb, d[k] );
                for( k = 0; k < nc; k++ )  {
                    sums[ns] += scorehand( h, d[k], CINHAND, TRUE, FALSE );
                    if( mycrib )  sums[ns] += adjust( cb, d[k] );
@@ -240,8 +240,8 @@ cdiscard( mycrib )
        j = 0;
        for( i = 1; i < 15; i++ )  if(  sums[i] > sums[j]  )  j = i;
        for( k = 0; k < FULLHAND; k++ )  h[k] = chand[k];
        j = 0;
        for( i = 1; i < 15; i++ )  if(  sums[i] > sums[j]  )  j = i;
        for( k = 0; k < FULLHAND; k++ )  h[k] = chand[k];
-       remove( h[ undo1[j] ], chand, FULLHAND );
-       remove( h[ undo2[j] ], chand, FULLHAND - 1 );
+       cremove( h[ undo1[j] ], chand, FULLHAND );
+       cremove( h[ undo2[j] ], chand, FULLHAND - 1 );
        chand[4] = h[ undo1[j] ];
        chand[5] = h[ undo2[j] ];
 }
        chand[4] = h[ undo1[j] ];
        chand[5] = h[ undo2[j] ];
 }
index ce05758..f3aab4e 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)hangman.h   5.4 (Berkeley) %G%
+ *     @(#)hangman.h   5.5 (Berkeley) %G%
  */
 
 # include      <curses.h>
  */
 
 # include      <curses.h>
@@ -50,6 +50,6 @@ extern FILE   *Dict;
 
 extern off_t   Dict_size;
 
 
 extern off_t   Dict_size;
 
-int    die();
+void   die();
 
 off_t  abs();
 
 off_t  abs();
index 972d3ee..75d0073 100644 (file)
@@ -12,7 +12,7 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)main.c     5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c     5.4 (Berkeley) %G%";
 #endif /* not lint */
 
 # include      "hangman.h"
 #endif /* not lint */
 
 # include      "hangman.h"
@@ -22,6 +22,8 @@ static char sccsid[] = "@(#)main.c    5.3 (Berkeley) %G%";
  */
 main()
 {
  */
 main()
 {
+       void die();
+
        initscr();
        signal(SIGINT, die);
        setup();
        initscr();
        signal(SIGINT, die);
        setup();
@@ -37,6 +39,7 @@ main()
  * die:
  *     Die properly.
  */
  * die:
  *     Die properly.
  */
+void
 die()
 {
        mvcur(0, COLS - 1, LINES - 1, 0);
 die()
 {
        mvcur(0, COLS - 1, LINES - 1, 0);