mirror of
https://github.com/vattam/BSDGames.git
synced 2025-12-21 03:14:50 +00:00
copy in from cvs; cvs2svn fucked up big time
git-svn-id: file:///srv/svn/joey/trunk/src/packages/bsdgames@9775 a4a2c43b-8ac3-0310-8836-e0e880c912e2
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.7 1998/08/01 23:02:35 hubertf Exp $
|
||||
# $NetBSD: Makefile,v 1.9 2002/03/05 21:28:12 thorpej Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/12/93
|
||||
|
||||
PROG= adventure
|
||||
@@ -8,9 +8,9 @@ HIDEGAME=hidegame
|
||||
CLEANFILES+=setup data.c
|
||||
|
||||
data.c: glorkz setup
|
||||
${.OBJDIR}/setup ${.CURDIR}/glorkz > data.c
|
||||
./setup ${.CURDIR}/glorkz > data.c
|
||||
|
||||
setup: setup.c hdr.h
|
||||
${HOST_CC} -o setup ${.CURDIR}/setup.c
|
||||
${HOST_LINK.c} -o setup ${.CURDIR}/setup.c
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
@@ -1,4 +1,30 @@
|
||||
# Makefrag - makefile fragment for adventure
|
||||
#
|
||||
# Copyright (c) 1997, 1998 Joseph Samuel Myers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
adventure_CLEANFILES := data.c
|
||||
adventure_DIRS := $(GAMESDIR) $(MAN6DIR)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: crc.c,v 1.6 1998/09/13 00:07:24 hubertf Exp $ */
|
||||
/* $NetBSD: crc.c,v 1.7 1999/02/10 00:29:21 hubertf Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@@ -42,7 +42,7 @@
|
||||
static char sccsid[] = "@(#)crc.c 8.1 (Berkeley) 5/31/93";
|
||||
static char ORIGINAL_sccsid[] = "@(#)crc.c 5.2 (Berkeley) 4/4/91";
|
||||
#else
|
||||
__RCSID("$NetBSD: crc.c,v 1.6 1998/09/13 00:07:24 hubertf Exp $");
|
||||
__RCSID("$NetBSD: crc.c,v 1.7 1999/02/10 00:29:21 hubertf Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: done.c,v 1.6 1998/09/13 15:21:36 hubertf Exp $ */
|
||||
/* $NetBSD: done.c,v 1.7 2000/07/03 03:57:39 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@@ -43,13 +43,14 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)done.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: done.c,v 1.6 1998/09/13 15:21:36 hubertf Exp $");
|
||||
__RCSID("$NetBSD: done.c,v 1.7 2000/07/03 03:57:39 matt Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
/* Re-coding of advent in C: termination routines */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "hdr.h"
|
||||
#include "extern.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: hdr.h,v 1.5 1998/08/29 20:19:56 hubertf Exp $ */
|
||||
/* $NetBSD: hdr.h,v 1.9 2001/02/05 00:20:05 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@@ -51,15 +51,18 @@
|
||||
*
|
||||
* The data file distributed with the fortran source is assumed to be called
|
||||
* "glorkz" in the directory where the program is first run.
|
||||
*
|
||||
* The original FORTRAN version can be found at
|
||||
* <URL:ftp://ftp.gmd.de/if-archive/games/source/advent-original.tar.gz>.
|
||||
*/
|
||||
|
||||
/* hdr.h: included by c advent files */
|
||||
|
||||
#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
|
||||
@@ -67,81 +70,77 @@ extern char data_file[]; /* Virtual data file */
|
||||
#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 saved, 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];
|
||||
#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], links[201];
|
||||
int abb[LOCSIZ];
|
||||
extern int place[101], prop[101], links[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,
|
||||
@@ -150,15 +149,15 @@ struct text
|
||||
null, entrnc, dprssn, 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 and
|
||||
extern int tk[21], stick, dtotal, attack;
|
||||
extern 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;
|
||||
extern int demo, limit;
|
||||
|
||||
#define DECR(a,b,c,d,e) decr(a+'+',b+'-',c+'#',d+'&',e+'%')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: init.c,v 1.10 1998/08/29 20:19:56 hubertf Exp $ */
|
||||
/* $NetBSD: init.c,v 1.13 2001/02/05 00:20:05 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@@ -43,7 +43,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 6/2/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: init.c,v 1.10 1998/08/29 20:19:56 hubertf Exp $");
|
||||
__RCSID("$NetBSD: init.c,v 1.13 2001/02/05 00:20:05 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -64,6 +64,70 @@ int blklin = TRUE;
|
||||
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], links[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, limit;
|
||||
|
||||
void
|
||||
init() /* everything for 1st time run */
|
||||
@@ -217,7 +281,7 @@ linkdata()
|
||||
|
||||
void
|
||||
trapdel(n) /* come here if he hits a del */
|
||||
int n __attribute__((unused));
|
||||
int n __attribute__((__unused__));
|
||||
{
|
||||
delhit = 1; /* main checks, treats as QUIT */
|
||||
signal(SIGINT, trapdel);/* catch subsequent DELs */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: io.c,v 1.10 1998/09/14 09:29:08 hubertf Exp $ */
|
||||
/* $NetBSD: io.c,v 1.12 2000/01/09 17:17:19 jsm Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@@ -43,7 +43,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: io.c,v 1.10 1998/09/14 09:29:08 hubertf Exp $");
|
||||
__RCSID("$NetBSD: io.c,v 1.12 2000/01/09 17:17:19 jsm Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -361,7 +361,7 @@ rtrav()
|
||||
if (locc != oldloc) { /* getting a new entry */
|
||||
t = travel[locc] = (struct travlist *) malloc(sizeof(struct travlist));
|
||||
if ( t == NULL)
|
||||
errx(1, "Out of memory!");
|
||||
err(1, NULL);
|
||||
/* printf("New travel list for %d\n",locc); */
|
||||
entries = 0;
|
||||
oldloc = locc;
|
||||
@@ -384,7 +384,7 @@ rtrav()
|
||||
if (entries++) {
|
||||
t = t->next = (struct travlist *) malloc(sizeof(struct travlist));
|
||||
if (t == NULL)
|
||||
errx(1, "Out of memory!");
|
||||
err(1, NULL);
|
||||
}
|
||||
t->tverb = rnum(); /* get verb from the file */
|
||||
t->tloc = n; /* table entry mod 1000 */
|
||||
@@ -559,7 +559,7 @@ pspeak(m, skip) /* read, decrypt an print a ptext message */
|
||||
|
||||
msg = &ptext[m];
|
||||
if ((tbuf = (char *) malloc(msg->txtlen + 1)) == NULL)
|
||||
errx(1, "Out of memory!");
|
||||
err(1, NULL);
|
||||
memcpy(tbuf, msg->seekadr, msg->txtlen + 1); /* Room to null */
|
||||
s = tbuf;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: main.c,v 1.12 1998/09/14 09:29:08 hubertf Exp $ */
|
||||
/* $NetBSD: main.c,v 1.16 2000/07/03 03:57:39 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@@ -48,7 +48,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/2/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: main.c,v 1.12 1998/09/14 09:29:08 hubertf Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.16 2000/07/03 03:57:39 matt Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -58,6 +58,7 @@ __RCSID("$NetBSD: main.c,v 1.12 1998/09/14 09:29:08 hubertf Exp $");
|
||||
#include <err.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "hdr.h"
|
||||
#include "extern.h"
|
||||
@@ -73,7 +74,7 @@ main(argc, argv)
|
||||
int rval, ll;
|
||||
struct text *kk;
|
||||
|
||||
/* revoke setgid privileges */
|
||||
/* revoke setgid privileges from dm */
|
||||
setregid(getgid(), getgid());
|
||||
|
||||
init(); /* Initialize everything */
|
||||
@@ -451,7 +452,7 @@ l4080:
|
||||
printf(" %d minutes before continuing.", latncy);
|
||||
if (!yes(200, 54, 54))
|
||||
goto l2012;
|
||||
datime(&saved, &savet);
|
||||
datime(&saveday, &savet);
|
||||
ciao(); /* Do we quit? */
|
||||
continue; /* Maybe not */
|
||||
case 31: /* hours=8310 */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: save.c,v 1.5 1998/09/13 00:07:24 hubertf Exp $ */
|
||||
/* $NetBSD: save.c,v 1.7 1999/07/17 20:02:48 hubertf Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@@ -43,10 +43,11 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: save.c,v 1.5 1998/09/13 00:07:24 hubertf Exp $");
|
||||
__RCSID("$NetBSD: save.c,v 1.7 1999/07/17 20:02:48 hubertf Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "hdr.h"
|
||||
@@ -95,7 +96,7 @@ struct savestruct save_array[] =
|
||||
{&oldlc2, sizeof(oldlc2)},
|
||||
{&oldloc, sizeof(oldloc)},
|
||||
{&panic, sizeof(panic)},
|
||||
{&saved, sizeof(saved)},
|
||||
{&saveday, sizeof(saveday)},
|
||||
{&savet, sizeof(savet)},
|
||||
{&scorng, sizeof(scorng)},
|
||||
{&spk, sizeof(spk)},
|
||||
@@ -152,7 +153,10 @@ save(outfile) /* Two passes on data: first to get checksum,
|
||||
*s = (*s ^ random()) & 0xFF; /* Lightly encrypt */
|
||||
fwrite(p->address, p->width, 1, out);
|
||||
}
|
||||
fclose(out);
|
||||
if (fclose(out) != 0) {
|
||||
warn("writing %s", outfile);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: setup.c,v 1.5 1998/09/13 15:23:40 hubertf Exp $ */
|
||||
/* $NetBSD: setup.c,v 1.9 2001/08/29 18:22:56 jsm Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@@ -36,17 +36,14 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n");
|
||||
#endif /* not lint */
|
||||
static const char copyright[] __attribute__((__unused__)) = "@(#) Copyright (c) 1991, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)setup.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: setup.c,v 1.5 1998/09/13 15:23:40 hubertf Exp $");
|
||||
static const char rcsid[] __attribute__((__unused__)) = "$NetBSD: setup.c,v 1.9 2001/08/29 18:22:56 jsm Exp $";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -64,18 +61,19 @@ __RCSID("$NetBSD: setup.c,v 1.5 1998/09/13 15:23:40 hubertf Exp $");
|
||||
#define SIG2 " * Sterday, 6 Thrimidge S.R. 1993, 15:24"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <err.h>
|
||||
#include "hdr.h" /* SEED lives in there; keep them coordinated. */
|
||||
|
||||
#define USAGE "Usage: setup file > data.c (file is typically glorkz)"
|
||||
#define USAGE "Usage: setup file > data.c (file is typically glorkz)\n"
|
||||
|
||||
#define YES 1
|
||||
#define NO 0
|
||||
|
||||
#define LINE 10 /* How many values do we get on a line? */
|
||||
|
||||
int main __P((int, char *[]));
|
||||
int main(int, char *[]);
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
@@ -85,11 +83,16 @@ main(argc, argv)
|
||||
FILE *infile;
|
||||
int c, count, linestart;
|
||||
|
||||
if (argc != 2)
|
||||
errx(1, USAGE);
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, USAGE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((infile = fopen(argv[1], "r")) == NULL)
|
||||
err(1, "Can't read file %s", argv[1]);
|
||||
if ((infile = fopen(argv[1], "r")) == NULL) {
|
||||
fprintf(stderr, "Can't read file %s: %s\n", argv[1],
|
||||
strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
puts("/*\n * data.c: created by setup from the ascii data file.");
|
||||
puts(SIG1);
|
||||
puts(SIG2);
|
||||
@@ -121,5 +124,10 @@ main(argc, argv)
|
||||
}
|
||||
puts("\n\t0\n};");
|
||||
fclose(infile);
|
||||
fflush(stdout);
|
||||
if (ferror(stdout)) {
|
||||
perror("error writing standard output");
|
||||
exit(1);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: subr.c,v 1.8 1998/09/14 09:29:08 hubertf Exp $ */
|
||||
/* $NetBSD: subr.c,v 1.9 2000/07/03 03:57:39 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@@ -43,13 +43,14 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)subr.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: subr.c,v 1.8 1998/09/14 09:29:08 hubertf Exp $");
|
||||
__RCSID("$NetBSD: subr.c,v 1.9 2000/07/03 03:57:39 matt Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
/* Re-coding of advent in C: subroutines from main */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "hdr.h"
|
||||
#include "extern.h"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vocab.c,v 1.9 1998/09/14 09:29:09 hubertf Exp $ */
|
||||
/* $NetBSD: vocab.c,v 1.10 2000/01/09 17:17:19 jsm Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@@ -43,7 +43,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)vocab.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: vocab.c,v 1.9 1998/09/14 09:29:09 hubertf Exp $");
|
||||
__RCSID("$NetBSD: vocab.c,v 1.10 2000/01/09 17:17:19 jsm Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -165,7 +165,7 @@ vocab(word, type, value) /* look up or store a word */
|
||||
h->val = value;
|
||||
h->atab = malloc(length(word));
|
||||
if (h->atab == NULL)
|
||||
errx(1, "Out of memory!");
|
||||
err(1, NULL);
|
||||
for (s = word, t = h->atab; *s;)
|
||||
*t++ = *s++ ^ '=';
|
||||
*t = 0 ^ '=';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wizard.c,v 1.8 1998/08/24 22:07:37 hubertf Exp $ */
|
||||
/* $NetBSD: wizard.c,v 1.10 1999/07/16 01:38:20 hubertf Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@@ -43,7 +43,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)wizard.c 8.1 (Berkeley) 6/2/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: wizard.c,v 1.8 1998/08/24 22:07:37 hubertf Exp $");
|
||||
__RCSID("$NetBSD: wizard.c,v 1.10 1999/07/16 01:38:20 hubertf Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -91,7 +91,7 @@ Start()
|
||||
int d, t, delay;
|
||||
|
||||
datime(&d, &t);
|
||||
delay = (d - saved) * 1440 + (t - savet); /* good for about a
|
||||
delay = (d - saveday) * 1440 + (t - savet); /* good for about a
|
||||
* month */
|
||||
|
||||
if (delay >= latncy) {
|
||||
@@ -137,7 +137,7 @@ ciao()
|
||||
|
||||
printf("What would you like to call the saved version?\n");
|
||||
/* XXX - should use fgetln to avoid arbitrary limit */
|
||||
for (c = fname;; c++) {
|
||||
for (c = fname; c < fname + sizeof fname - 1; c++) {
|
||||
int ch;
|
||||
ch = getchar();
|
||||
if (ch == '\n' || ch == EOF)
|
||||
|
||||
@@ -1,4 +1,30 @@
|
||||
# Makefrag - makefile fragment for arithmetic
|
||||
#
|
||||
# Copyright (c) 1997, 1998 Joseph Samuel Myers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
arithmetic_DIRS := $(GAMESDIR) $(MAN6DIR)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: arithmetic.6,v 1.6 1998/04/28 07:19:28 fair Exp $
|
||||
.\" $NetBSD: arithmetic.6,v 1.9 2002/09/26 18:31:58 wiz Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1989, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@@ -38,7 +38,7 @@
|
||||
.\"
|
||||
.Dd May 31, 1993
|
||||
.Dt ARITHMETIC 6
|
||||
.Os BSD 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm arithmetic
|
||||
.Nd quiz on simple arithmetic
|
||||
@@ -81,7 +81,8 @@ divide by or subtract will be between 0 and
|
||||
.Ar range .
|
||||
(Of course,
|
||||
.Nm
|
||||
will not ask you to divide by 0.) The default
|
||||
will not ask you to divide by 0.)
|
||||
The default
|
||||
.I range
|
||||
is 10.
|
||||
.El
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: arithmetic.c,v 1.12 1998/09/14 09:13:46 hubertf Exp $ */
|
||||
/* $NetBSD: arithmetic.c,v 1.18 2002/03/31 04:07:22 hubertf Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)arithmetic.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: arithmetic.c,v 1.12 1998/09/14 09:13:46 hubertf Exp $");
|
||||
__RCSID("$NetBSD: arithmetic.c,v 1.18 2002/03/31 04:07:22 hubertf Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -94,7 +94,7 @@ int main __P((int, char *[]));
|
||||
int opnum __P((int));
|
||||
void penalise __P((int, int, int));
|
||||
int problem __P((void));
|
||||
void showstats __P((void));
|
||||
void showstats __P((int));
|
||||
void usage __P((void)) __attribute__((__noreturn__));
|
||||
|
||||
const char keylist[] = "+-x/";
|
||||
@@ -106,6 +106,8 @@ int nright, nwrong;
|
||||
time_t qtime;
|
||||
#define NQUESTS 20
|
||||
|
||||
extern char *__progname; /* from crt0.o */
|
||||
|
||||
/*
|
||||
* Select keys from +-x/ to be asked addition, subtraction, multiplication,
|
||||
* and division problems. More than one key may be given. The default is
|
||||
@@ -118,8 +120,6 @@ main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
int ch, cnt;
|
||||
|
||||
/* Revoke setgid privileges */
|
||||
@@ -157,7 +157,7 @@ main(argc, argv)
|
||||
for (cnt = NQUESTS; cnt--;)
|
||||
if (problem() == EOF)
|
||||
exit(0);
|
||||
showstats();
|
||||
showstats(0);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
||||
@@ -165,15 +165,16 @@ main(argc, argv)
|
||||
/* Handle interrupt character. Print score and exit. */
|
||||
void
|
||||
intr(dummy)
|
||||
int dummy __attribute__((unused));
|
||||
int dummy __attribute__((__unused__));
|
||||
{
|
||||
showstats();
|
||||
showstats(1);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/* Print score. Original `arithmetic' had a delay after printing it. */
|
||||
void
|
||||
showstats()
|
||||
showstats(bool_sigint)
|
||||
int bool_sigint;
|
||||
{
|
||||
if (nright + nwrong > 0) {
|
||||
(void)printf("\n\nRights %d; Wrongs %d; Score %d%%",
|
||||
@@ -182,6 +183,10 @@ showstats()
|
||||
(void)printf("\nTotal time %ld seconds; %.1f seconds per problem\n\n",
|
||||
(long)qtime, (float)qtime / nright);
|
||||
}
|
||||
if(!bool_sigint) {
|
||||
(void)printf("Press RETURN to continue...\n");
|
||||
while(!getchar()) ;
|
||||
}
|
||||
(void)printf("\n");
|
||||
}
|
||||
|
||||
@@ -388,9 +393,7 @@ opnum(op)
|
||||
void
|
||||
usage()
|
||||
{
|
||||
extern char *__progname; /* from crt0.o */
|
||||
|
||||
(void)fprintf(stderr, "usage: %s [-o +-x/] [-r range]\n",
|
||||
(void)fprintf(stderr, "Usage: %s [-o +-x/] [-r range]\n",
|
||||
__progname);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
# $NetBSD: Makefile,v 1.5 1997/10/16 05:24:23 lukem Exp $
|
||||
# $NetBSD: Makefile,v 1.6 2001/01/09 03:13:39 lukem Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 5/31/93
|
||||
|
||||
SUBDIR= common_source backgammon teachgammon
|
||||
|
||||
all-backgammon all-teachgammon: all-common_source
|
||||
SUBDIR= common_source .WAIT backgammon teachgammon
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# $NetBSD: Makefile.inc,v 1.5 1998/02/02 14:14:55 christos Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.6 2000/12/30 17:51:26 sommerfeld Exp $
|
||||
|
||||
LIBCOMMON != cd ${.CURDIR}/../common_source;\
|
||||
printf "xxx: .MAKE\n\t@echo \$${.OBJDIR}\n" | ${MAKE} -s -f-
|
||||
.include <bsd.own.mk>
|
||||
|
||||
LIBCOMMON != cd ${.CURDIR}/../common_source; ${PRINTOBJDIR}
|
||||
CPPFLAGS+=-DV7 -I${.CURDIR}/../common_source
|
||||
DPADD+= ${LIBCOMMON}/libcommon.a ${LIBTERMCAP}
|
||||
LDADD+= -L${LIBCOMMON} -lcommon -ltermcap
|
||||
|
||||
@@ -1,4 +1,30 @@
|
||||
# Makefrag - makefile fragment for backgammon
|
||||
#
|
||||
# Copyright (c) 1998 Joseph Samuel Myers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
backgammon_all:
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
# $NetBSD: Makefile,v 1.3 1997/10/11 20:24:06 mycroft Exp $
|
||||
# $NetBSD: Makefile,v 1.7 2002/09/18 06:16:39 lukem Exp $
|
||||
|
||||
NOLINKLIB= # defined
|
||||
NOLINT= # defined
|
||||
NOPIC= # defined
|
||||
NOPROFILE= # defined
|
||||
|
||||
LIB= common
|
||||
SRCS= allow.c board.c check.c fancy.c init.c odds.c one.c save.c subs.c \
|
||||
table.c
|
||||
|
||||
NOPROFILE= noprofile
|
||||
NOPIC= nopic
|
||||
|
||||
# only needed during build
|
||||
libinstall::
|
||||
SRCS= allow.c board.c check.c fancy.c init.c odds.c \
|
||||
one.c save.c subs.c table.c
|
||||
|
||||
.include <bsd.lib.mk>
|
||||
|
||||
@@ -1,4 +1,30 @@
|
||||
# Makefrag - makefile fragment for backgammon/common_source
|
||||
#
|
||||
# Copyright (c) 1997, 1998 Joseph Samuel Myers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
backgammon_common_source_EXEC_PATH := $(GAMESDIR)/backgammon
|
||||
backgammon_common_source_TEACH_PATH := $(GAMESDIR)/teachgammon
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: back.h,v 1.9 1998/09/13 15:31:07 hubertf Exp $ */
|
||||
/* $NetBSD: back.h,v 1.12 1999/10/04 23:26:59 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@@ -146,7 +146,7 @@ void cline __P((void));
|
||||
int count __P((void));
|
||||
void curmove __P((int, int));
|
||||
int dotable __P((char, int));
|
||||
void errexit __P((const char *));
|
||||
void errexit __P((const char *)) __attribute__((__noreturn__));
|
||||
void fancyc __P((int));
|
||||
void fboard __P((void));
|
||||
void fixcol __P((int, int, int, int, int));
|
||||
@@ -168,7 +168,7 @@ int movokay __P((int));
|
||||
void newline __P((void));
|
||||
void newpos __P((void));
|
||||
void nexturn __P((void));
|
||||
void norec __P((const char *));
|
||||
void norec __P((const char *)) __attribute__((__noreturn__));
|
||||
void odds __P((int, int, int));
|
||||
void proll __P((void));
|
||||
int quit __P((void));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: board.c,v 1.5 1997/10/10 08:59:43 lukem Exp $ */
|
||||
/* $NetBSD: board.c,v 1.6 1999/02/10 12:29:47 hubertf Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)board.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: board.c,v 1.5 1997/10/10 08:59:43 lukem Exp $");
|
||||
__RCSID("$NetBSD: board.c,v 1.6 1999/02/10 12:29:47 hubertf Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fancy.c,v 1.7 1998/09/13 15:19:35 hubertf Exp $ */
|
||||
/* $NetBSD: fancy.c,v 1.10 1999/07/26 18:39:06 hubertf Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@@ -38,14 +38,14 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)fancy.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: fancy.c,v 1.7 1998/09/13 15:19:35 hubertf Exp $");
|
||||
__RCSID("$NetBSD: fancy.c,v 1.10 1999/07/26 18:39:06 hubertf Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
#include "back.h"
|
||||
|
||||
char PC; /* padding character */
|
||||
char *BC; /* backspace sequence */
|
||||
extern char PC; /* padding character */
|
||||
extern char *BC; /* backspace sequence */
|
||||
char *CD; /* clear to end of screen sequence */
|
||||
char *CE; /* clear to end of line sequence */
|
||||
char *CL; /* clear screen sequence */
|
||||
@@ -54,7 +54,7 @@ char *HO; /* home cursor sequence */
|
||||
char *MC; /* column cursor movement map */
|
||||
char *ML; /* row cursor movement map */
|
||||
char *ND; /* forward cursor sequence */
|
||||
char *UP; /* up cursor sequence */
|
||||
extern char *UP; /* up cursor sequence */
|
||||
|
||||
int lHO; /* length of HO */
|
||||
int lBC; /* length of BC */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: init.c,v 1.6 1997/10/14 00:53:31 lukem Exp $ */
|
||||
/* $NetBSD: init.c,v 1.7 1999/02/10 12:29:48 hubertf Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: init.c,v 1.6 1997/10/14 00:53:31 lukem Exp $");
|
||||
__RCSID("$NetBSD: init.c,v 1.7 1999/02/10 12:29:48 hubertf Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: save.c,v 1.7 1998/09/13 15:41:34 hubertf Exp $ */
|
||||
/* $NetBSD: save.c,v 1.9 1999/07/28 02:07:39 hubertf Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 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.7 1998/09/13 15:41:34 hubertf Exp $");
|
||||
__RCSID("$NetBSD: save.c,v 1.9 1999/07/28 02:07:39 hubertf Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -111,7 +111,7 @@ save(n)
|
||||
close(fdesc);
|
||||
if (yorn(0)) {
|
||||
unlink(fname);
|
||||
fdesc = creat(fname, 0700);
|
||||
fdesc = creat(fname, 0600);
|
||||
break;
|
||||
} else {
|
||||
cflag = 1;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: subs.c,v 1.8 1998/09/13 15:19:35 hubertf Exp $ */
|
||||
/* $NetBSD: subs.c,v 1.13 1999/10/04 23:26:59 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)subs.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: subs.c,v 1.8 1998/09/13 15:19:35 hubertf Exp $");
|
||||
__RCSID("$NetBSD: subs.c,v 1.13 1999/10/04 23:26:59 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -84,7 +84,7 @@ addbuf(c)
|
||||
buffnum = 0;
|
||||
}
|
||||
outbuff[buffnum] = c;
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -325,7 +325,7 @@ getarg(arg)
|
||||
* the game is being recovered */
|
||||
|
||||
s = *arg;
|
||||
while (s[0] != NULL && s[0][0] == '-') {
|
||||
while (*s && s[0][0] == '-') {
|
||||
switch (s[0][1]) {
|
||||
|
||||
/* don't ask if rules or instructions needed */
|
||||
@@ -447,7 +447,7 @@ fixtty(t)
|
||||
|
||||
void
|
||||
getout(dummy)
|
||||
int dummy __attribute__((unused));
|
||||
int dummy __attribute__((__unused__));
|
||||
{
|
||||
/* go to bottom of screen */
|
||||
if (tflag) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: table.c,v 1.5 1997/10/10 08:59:49 lukem Exp $ */
|
||||
/* $NetBSD: table.c,v 1.6 1999/02/10 12:29:48 hubertf Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)table.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: table.c,v 1.5 1997/10/10 08:59:49 lukem Exp $");
|
||||
__RCSID("$NetBSD: table.c,v 1.6 1999/02/10 12:29:48 hubertf Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# $NetBSD: Makefile,v 1.8 1997/10/10 08:59:50 lukem Exp $
|
||||
# $NetBSD: Makefile,v 1.11 2002/09/18 06:16:39 lukem Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 5/31/93
|
||||
|
||||
NOMAN= # defined
|
||||
|
||||
PROG= teachgammon
|
||||
SRCS= data.c teach.c ttext1.c ttext2.c tutor.c
|
||||
NOMAN= noman
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
@@ -1,4 +1,30 @@
|
||||
# Makefrag - makefile fragment for backgammon/teachgammon
|
||||
#
|
||||
# Copyright (c) 1997, 1998 Joseph Samuel Myers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
backgammon_teachgammon_DEFS := -DV7
|
||||
backgammon_teachgammon_DIRS := $(GAMESDIR) $(MAN6DIR)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: data.c,v 1.4 1997/10/10 08:59:51 lukem Exp $ */
|
||||
/* $NetBSD: data.c,v 1.5 1999/02/10 12:29:48 hubertf Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)data.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: data.c,v 1.4 1997/10/10 08:59:51 lukem Exp $");
|
||||
__RCSID("$NetBSD: data.c,v 1.5 1999/02/10 12:29:48 hubertf Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: teach.c,v 1.6 1998/08/29 22:53:04 hubertf Exp $ */
|
||||
/* $NetBSD: teach.c,v 1.13 2001/04/06 11:13:52 wiz Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@@ -43,17 +43,13 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)teach.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: teach.c,v 1.6 1998/08/29 22:53:04 hubertf Exp $");
|
||||
__RCSID("$NetBSD: teach.c,v 1.13 2001/04/06 11:13:52 wiz Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
#include "back.h"
|
||||
#include "tutor.h"
|
||||
|
||||
#ifndef NCURSES_VERSION
|
||||
extern speed_t ospeed; /* tty output speed for termlib */
|
||||
#endif
|
||||
|
||||
const char *const helpm[] = {
|
||||
"\nEnter a space or newline to roll, or",
|
||||
" b to display the board",
|
||||
@@ -69,7 +65,7 @@ const char *const contin[] = {
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc __attribute__((unused));
|
||||
int argc __attribute__((__unused__));
|
||||
char *argv[];
|
||||
{
|
||||
int i;
|
||||
@@ -160,7 +156,7 @@ leave()
|
||||
else
|
||||
writec('\n');
|
||||
fixtty(&old);
|
||||
execl(EXEC, "backgammon", args, "-n", 0);
|
||||
execl(EXEC, "backgammon", "-n", args[1]?args:0, 0);
|
||||
writel("Help! Backgammon program is missing\007!!\n");
|
||||
exit(-1);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ttext1.c,v 1.4 1997/10/10 08:59:53 lukem Exp $ */
|
||||
/* $NetBSD: ttext1.c,v 1.6 1999/07/25 00:06:13 hubertf Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@@ -38,15 +38,15 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)ttext1.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: ttext1.c,v 1.4 1997/10/10 08:59:53 lukem Exp $");
|
||||
__RCSID("$NetBSD: ttext1.c,v 1.6 1999/07/25 00:06:13 hubertf Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
#include "back.h"
|
||||
#include "tutor.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",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ttext2.c,v 1.5 1997/10/10 08:59:53 lukem Exp $ */
|
||||
/* $NetBSD: ttext2.c,v 1.6 1999/02/10 12:29:48 hubertf Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)ttext2.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: ttext2.c,v 1.5 1997/10/10 08:59:53 lukem Exp $");
|
||||
__RCSID("$NetBSD: ttext2.c,v 1.6 1999/02/10 12:29:48 hubertf Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tutor.c,v 1.4 1997/10/10 08:59:54 lukem Exp $ */
|
||||
/* $NetBSD: tutor.c,v 1.5 1999/02/10 12:29:48 hubertf Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)tutor.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: tutor.c,v 1.4 1997/10/10 08:59:54 lukem Exp $");
|
||||
__RCSID("$NetBSD: tutor.c,v 1.5 1999/02/10 12:29:48 hubertf Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tutor.h,v 1.5 1998/09/13 15:27:26 hubertf Exp $ */
|
||||
/* $NetBSD: tutor.h,v 1.6 1999/02/10 12:29:48 hubertf Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@@ -58,9 +58,9 @@ extern const char *const lastch[];
|
||||
extern const char *const list[];
|
||||
extern int maxmoves;
|
||||
extern const char *const moves[];
|
||||
extern const char *opts;
|
||||
extern const char *const opts;
|
||||
extern const char *const prog[];
|
||||
extern const char *prompt;
|
||||
extern const char *const prompt;
|
||||
extern const char *const removepiece[];
|
||||
extern const char *const stragy[];
|
||||
extern const struct situatn test[];
|
||||
|
||||
@@ -1,4 +1,30 @@
|
||||
# Makefrag - makefile fragment for banner
|
||||
#
|
||||
# Copyright (c) 1997, 1998 Joseph Samuel Myers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
banner_DIRS := $(GAMESDIR) $(MAN6DIR)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: banner.6,v 1.9 1997/10/10 09:48:47 lukem Exp $
|
||||
.\" $NetBSD: banner.6,v 1.12 2002/09/26 18:31:59 wiz Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1980, 1993, 1995
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@@ -57,8 +57,8 @@ suitable for a narrow terminal.
|
||||
The output should be printed on paper of the appropriate width,
|
||||
with no breaks between the pages.
|
||||
.Sh BUGS
|
||||
Several ASCII characters are not defined, notably <, >, [, ], \\,
|
||||
^, _, {, }, |, and ~. Also, the characters ", ', and & are funny
|
||||
Several ASCII characters are not defined, notably \*[Lt], \*[Gt], [, ], \\,
|
||||
^, _, {, }, |, and ~. Also, the characters ", ', and \*[Am] are funny
|
||||
looking (but in a useful way.)
|
||||
.Pp
|
||||
The
|
||||
@@ -67,4 +67,4 @@ option is implemented by skipping some rows and columns.
|
||||
The smaller it gets, the grainier the output.
|
||||
Sometimes it runs letters together.
|
||||
.Sh AUTHOR
|
||||
Mark Horton
|
||||
.An Mark Horton
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: banner.c,v 1.8 1998/09/14 09:30:57 hubertf Exp $ */
|
||||
/* $NetBSD: banner.c,v 1.10 1999/07/19 19:07:17 hubertf Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993, 1994
|
||||
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993, 1994\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)banner.c 8.4 (Berkeley) 4/29/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: banner.c,v 1.8 1998/09/14 09:30:57 hubertf Exp $");
|
||||
__RCSID("$NetBSD: banner.c,v 1.10 1999/07/19 19:07:17 hubertf Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# $NetBSD: Makefile,v 1.8 1998/02/18 22:37:30 jtc Exp $
|
||||
# $NetBSD: Makefile,v 1.9 2001/10/19 03:06:09 tv Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 5/31/93
|
||||
|
||||
PROG= battlestar
|
||||
SRCS= battlestar.c com1.c com2.c com3.c com4.c com5.c com6.c com7.c \
|
||||
SRCS= battlestar.c command1.c command2.c command3.c command4.c \
|
||||
command5.c command6.c command7.c \
|
||||
init.c cypher.c getcom.c parse.c room.c save.c fly.c misc.c \
|
||||
globals.c dayfile.c nightfile.c dayobjs.c nightobjs.c words.c
|
||||
MAN= battlestar.6
|
||||
|
||||
@@ -1,5 +1,32 @@
|
||||
# Makefrag - makefile fragment for battlestar
|
||||
#
|
||||
# Copyright (c) 1997, 1998, 1999 Joseph Samuel Myers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
battlestar_DEFS := $(FGETLN_DEFS)
|
||||
battlestar_DIRS := $(GAMESDIR) $(MAN6DIR)
|
||||
|
||||
battlestar_all: battlestar/battlestar battlestar/battlestar.6
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: battlestar.6,v 1.6 1998/09/10 21:50:35 frueauf Exp $
|
||||
.\" $NetBSD: battlestar.6,v 1.12 2002/09/26 18:31:59 wiz Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1983, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@@ -33,7 +33,7 @@
|
||||
.\"
|
||||
.\" @(#)battlestar.6 8.1 (Berkeley) 5/31/93
|
||||
.\"
|
||||
.Dd May 31, 1993
|
||||
.Dd September 7, 2000
|
||||
.Dt BATTLESTAR 6
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -42,17 +42,15 @@
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl r
|
||||
.Op saved-file
|
||||
.Op Ar saved-file
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
is an adventure game in the classic style. However, it's slightly less
|
||||
of a
|
||||
puzzle and more a game of exploration. There are a few magical words
|
||||
in the game, but on the whole, simple English
|
||||
is an adventure game in the classic style.
|
||||
However, it's slightly less of a puzzle and more a game of exploration.
|
||||
There are a few magical words in the game, but on the whole, simple English
|
||||
should suffice to make one's desires understandable to the parser.
|
||||
.Sh THE SETTING
|
||||
In the days before the darkness came, when battlestars ruled the
|
||||
heavens...
|
||||
In the days before the darkness came, when battlestars ruled the heavens...
|
||||
.Bd -literal -offset indent
|
||||
Three He made and gave them to His daughters,
|
||||
Beautiful nymphs, the goddesses of the waters.
|
||||
@@ -61,19 +59,18 @@ Two to wash the lands and churn the waves asunder,
|
||||
Three to rule the world and purge the skies with thunder.
|
||||
.Ed
|
||||
.Pp
|
||||
In those times great wizards were known and their powers were beyond
|
||||
belief. They could take any object from thin air, and, uttering the
|
||||
word
|
||||
In those times great wizards were known and their powers were beyond belief.
|
||||
They could take any object from thin air, and, uttering the word
|
||||
.Sq su
|
||||
could disappear.
|
||||
.Pp
|
||||
In those times men were known for their lust of gold and desire to
|
||||
wear fine weapons. Swords and coats of mail were fashioned that could
|
||||
withstand a laser blast.
|
||||
wear fine weapons.
|
||||
Swords and coats of mail were fashioned that could withstand a laser blast.
|
||||
.Pp
|
||||
But when the darkness fell, the rightful reigns were toppled. Swords
|
||||
and helms and heads of state went rolling across the grass. The entire
|
||||
fleet of battlestars was reduced to a single ship.
|
||||
But when the darkness fell, the rightful reigns were toppled.
|
||||
Swords and helms and heads of state went rolling across the grass.
|
||||
The entire fleet of battlestars was reduced to a single ship.
|
||||
.Sh SAMPLE COMMANDS
|
||||
.Bd -literal -offset indent
|
||||
take --- take an object
|
||||
@@ -85,19 +82,19 @@ draw --- carry an object you are wearing
|
||||
puton --- take an object and wear it
|
||||
take off -- draw an object and drop it
|
||||
|
||||
throw <object> <direction>
|
||||
throw \*[Lt]object\*[Gt] \*[Lt]direction\*[Gt]
|
||||
|
||||
! <shell esc>
|
||||
! \*[Lt]shell esc\*[Gt]
|
||||
.Ed
|
||||
.Sh IMPLIED OBJECTS
|
||||
.Bd -literal -offset indent
|
||||
>-: take watermelon
|
||||
\*[Gt]-: take watermelon
|
||||
watermelon:
|
||||
Taken.
|
||||
>-: eat
|
||||
\*[Gt]-: eat
|
||||
watermelon:
|
||||
Eaten.
|
||||
>-: take knife and sword and apple, drop all
|
||||
\*[Gt]-: take knife and sword and apple, drop all
|
||||
knife:
|
||||
Taken.
|
||||
broadsword:
|
||||
@@ -110,31 +107,49 @@ broadsword:
|
||||
Dropped.
|
||||
apple:
|
||||
Dropped.
|
||||
>-: get
|
||||
\*[Gt]-: get
|
||||
knife:
|
||||
Taken.
|
||||
.Ed
|
||||
.Pp
|
||||
Notice that the "shadow" of the next word stays around if you
|
||||
want to take advantage of it. That is, saying "take knife" and then
|
||||
"drop"
|
||||
want to take advantage of it.
|
||||
That is, saying "take knife" and then "drop"
|
||||
will drop the knife you just took.
|
||||
.Sh SCORE & INVEN
|
||||
The two commands "score" and "inven" will print out your current status
|
||||
in the game.
|
||||
.Sh SCORE \*[Am] INVEN
|
||||
The two commands
|
||||
.Dq score
|
||||
and
|
||||
.Dq inven
|
||||
will print out your current status in the game.
|
||||
.Sh SAVING A 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
|
||||
The command
|
||||
.Dq save
|
||||
will save your game in a file called
|
||||
.Pa .Bstar
|
||||
in your home directory by default.
|
||||
You can recover a saved game by using the
|
||||
.Fl r
|
||||
option when you start up the
|
||||
game, or by giving the name of the saved file as an argument.
|
||||
Save files will be saved to and restored from your home directory unless a
|
||||
path is specified - i.e.,
|
||||
.Dq Li battlestar -r savedgame
|
||||
will look for
|
||||
.Pa savedgame
|
||||
in your home directory, but
|
||||
.Dq Li battlestar -r ./savedgame
|
||||
will look in the current directory.
|
||||
.Dq Li battlestar -r
|
||||
will look for the default file,
|
||||
.Pa .Bstar
|
||||
in your home directory.
|
||||
.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
|
||||
stand for Right, Left, Ahead, and Back.
|
||||
Directions printed in room descriptions are
|
||||
always printed in R, L, A, & B relative directions.
|
||||
always printed in R, L, A, and B relative directions.
|
||||
.Sh HISTORY
|
||||
I wrote Battlestar in 1979 in order to experiment with the niceties of
|
||||
the C Language.
|
||||
@@ -142,8 +157,8 @@ Most interesting things that happen in the game are hardwired into the
|
||||
code, so don't send me any hate mail about it!
|
||||
Instead, enjoy art for art's sake!
|
||||
.Sh AUTHOR
|
||||
David Riggle
|
||||
.Sh INSPIRATION & ASSISTANCE
|
||||
.An David Riggle
|
||||
.Sh INSPIRATION \*[Am] ASSISTANCE
|
||||
.Bl -item -compact
|
||||
.It
|
||||
Chris Guthrie
|
||||
@@ -154,7 +169,7 @@ Kevin Brown
|
||||
.It
|
||||
Edward Wang
|
||||
.It
|
||||
Ken Arnold & Company
|
||||
Ken Arnold \*[Am] Company
|
||||
.El
|
||||
.Sh BUGS
|
||||
Countless.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: battlestar.c,v 1.6 1997/10/11 02:06:55 lukem Exp $ */
|
||||
/* $NetBSD: battlestar.c,v 1.12 2000/09/21 17:44:34 jsm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)battlestar.c 8.2 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: battlestar.c,v 1.6 1997/10/11 02:06:55 lukem Exp $");
|
||||
__RCSID("$NetBSD: battlestar.c,v 1.12 2000/09/21 17:44:34 jsm Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -70,11 +70,15 @@ main(argc, argv)
|
||||
open_score_file();
|
||||
setregid(getgid(), getgid());
|
||||
|
||||
initialize((argc < 2) ? NULL : (strcmp(argv[1], "-r") ? argv[1]
|
||||
: (argv[2] ? argv[2]
|
||||
: DEFAULT_SAVE_FILE)));
|
||||
if (argc < 2)
|
||||
initialize(NULL);
|
||||
else if (strcmp(argv[1], "-r") == 0)
|
||||
initialize((argc > 2) ? argv[2] : DEFAULT_SAVE_FILE);
|
||||
else
|
||||
initialize(argv[1]);
|
||||
start:
|
||||
news();
|
||||
if (beenthere[position] <= ROOMDESC)
|
||||
beenthere[position]++;
|
||||
if (notes[LAUNCHED])
|
||||
crash(); /* decrements fuel & crash */
|
||||
@@ -92,7 +96,7 @@ start:
|
||||
run:
|
||||
next = getcom(mainbuf, sizeof mainbuf, ">-: ",
|
||||
"Please type in something.");
|
||||
for (wordcount = 0; next && wordcount < 20; wordcount++)
|
||||
for (wordcount = 0; next && wordcount < NWORD - 1; wordcount++)
|
||||
next = getword(next, words[wordcount], -1);
|
||||
parse();
|
||||
switch (cypher()) {
|
||||
@@ -101,6 +105,6 @@ run:
|
||||
case 0:
|
||||
goto start;
|
||||
default:
|
||||
exit(1); /* Shouldn't happen */
|
||||
errx(1, "bad return from cypher(): please submit a bug report");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cypher.c,v 1.7 1998/08/24 00:25:32 hubertf Exp $ */
|
||||
/* $NetBSD: cypher.c,v 1.21 2000/09/25 19:37:58 jsm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)cypher.c 8.2 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: cypher.c,v 1.7 1998/08/24 00:25:32 hubertf Exp $");
|
||||
__RCSID("$NetBSD: cypher.c,v 1.21 2000/09/25 19:37:58 jsm Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -51,64 +51,82 @@ cypher()
|
||||
int junk;
|
||||
int lflag = -1;
|
||||
char buffer[10];
|
||||
char *filename;
|
||||
char *filename, *rfilename;
|
||||
size_t filename_len;
|
||||
|
||||
while (wordtype[wordnumber] == ADJS)
|
||||
wordnumber++;
|
||||
while (wordnumber <= wordcount) {
|
||||
if (wordtype[wordnumber] != VERB &&
|
||||
!(wordtype[wordnumber] == OBJECT && wordvalue[wordnumber] == KNIFE)) {
|
||||
printf("%s: How's that?\n",
|
||||
(wordnumber == wordcount) ? words[0] : words[wordnumber]);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
switch (wordvalue[wordnumber]) {
|
||||
|
||||
case AUXVERB:
|
||||
/*
|
||||
* Take the following word as the verb (e.g.
|
||||
* "make love", "climb up").
|
||||
*/
|
||||
wordnumber++;
|
||||
continue;
|
||||
|
||||
case UP:
|
||||
if (location[position].access || wiz || tempwiz) {
|
||||
if (!location[position].access)
|
||||
puts("Zap! A gust of wind lifts you up.");
|
||||
if (!move(location[position].up, AHEAD))
|
||||
if (!moveplayer(location[position].up, AHEAD))
|
||||
return (-1);
|
||||
} else {
|
||||
puts("There is no way up");
|
||||
puts("There is no way up.");
|
||||
return (-1);
|
||||
}
|
||||
lflag = 0;
|
||||
break;
|
||||
|
||||
case DOWN:
|
||||
if (!move(location[position].down, AHEAD))
|
||||
if (!moveplayer(location[position].down, AHEAD))
|
||||
return (-1);
|
||||
lflag = 0;
|
||||
break;
|
||||
|
||||
case LEFT:
|
||||
if (!move(left, LEFT))
|
||||
if (!moveplayer(left, LEFT))
|
||||
return (-1);
|
||||
lflag = 0;
|
||||
break;
|
||||
|
||||
case RIGHT:
|
||||
if (!move(right, RIGHT))
|
||||
if (!moveplayer(right, RIGHT))
|
||||
return (-1);
|
||||
lflag = 0;
|
||||
break;
|
||||
|
||||
case AHEAD:
|
||||
if (!move(ahead, AHEAD))
|
||||
if (!moveplayer(ahead, AHEAD))
|
||||
return (-1);
|
||||
lflag = 0;
|
||||
break;
|
||||
|
||||
case BACK:
|
||||
if (!move(back, BACK))
|
||||
if (!moveplayer(back, BACK))
|
||||
return (-1);
|
||||
lflag = 0;
|
||||
break;
|
||||
|
||||
case SHOOT:
|
||||
if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
|
||||
int things;
|
||||
things = 0;
|
||||
for (n = 0; n < NUMOFOBJECTS; n++)
|
||||
if (testbit(location[position].objects, n) && objsht[n]) {
|
||||
things++;
|
||||
wordvalue[wordnumber + 1] = n;
|
||||
wordnumber = shoot();
|
||||
}
|
||||
if (!things)
|
||||
puts("Nothing to shoot at!");
|
||||
wordnumber++;
|
||||
wordnumber++;
|
||||
} else
|
||||
@@ -117,8 +135,11 @@ cypher()
|
||||
|
||||
case TAKE:
|
||||
if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
|
||||
int things;
|
||||
things = 0;
|
||||
for (n = 0; n < NUMOFOBJECTS; n++)
|
||||
if (testbit(location[position].objects, n) && objsht[n]) {
|
||||
things++;
|
||||
wordvalue[wordnumber + 1] = n;
|
||||
/* Some objects (type NOUNS)
|
||||
* have special treatment in
|
||||
@@ -138,6 +159,7 @@ cypher()
|
||||
switch(n) {
|
||||
case BATHGOD:
|
||||
wordvalue[wordnumber + 1] = NORMGOD;
|
||||
/* FALLTHROUGH */
|
||||
case NORMGOD:
|
||||
case AMULET:
|
||||
case MEDALION:
|
||||
@@ -154,120 +176,160 @@ cypher()
|
||||
}
|
||||
wordnumber++;
|
||||
wordnumber++;
|
||||
if (!things)
|
||||
puts("Nothing to take!");
|
||||
} else
|
||||
take(location[position].objects);
|
||||
break;
|
||||
|
||||
case DROP:
|
||||
|
||||
if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
|
||||
int things;
|
||||
things = 0;
|
||||
for (n = 0; n < NUMOFOBJECTS; n++)
|
||||
if (testbit(inven, n)) {
|
||||
things++;
|
||||
wordvalue[wordnumber + 1] = n;
|
||||
wordnumber = drop("Dropped");
|
||||
}
|
||||
wordnumber++;
|
||||
wordnumber++;
|
||||
if (!things)
|
||||
puts("Nothing to drop!");
|
||||
} else
|
||||
drop("Dropped");
|
||||
break;
|
||||
|
||||
|
||||
case KICK:
|
||||
case THROW:
|
||||
if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
|
||||
int things, wv;
|
||||
things = 0;
|
||||
wv = wordvalue[wordnumber];
|
||||
for (n = 0; n < NUMOFOBJECTS; n++)
|
||||
if (testbit(inven, n) ||
|
||||
(testbit(location[position].objects, n) && objsht[n])) {
|
||||
things++;
|
||||
wordvalue[wordnumber + 1] = n;
|
||||
wordnumber = throw(wordvalue[wordnumber] == KICK ? "Kicked" : "Thrown");
|
||||
}
|
||||
wordnumber += 2;
|
||||
if (!things)
|
||||
printf("Nothing to %s!\n", wv == KICK ? "kick" : "throw");
|
||||
} else
|
||||
throw(wordvalue[wordnumber] == KICK ? "Kicked" : "Thrown");
|
||||
break;
|
||||
|
||||
case TAKEOFF:
|
||||
if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
|
||||
int things;
|
||||
things = 0;
|
||||
for (n = 0; n < NUMOFOBJECTS; n++)
|
||||
if (testbit(wear, n)) {
|
||||
things++;
|
||||
wordvalue[wordnumber + 1] = n;
|
||||
wordnumber = takeoff();
|
||||
}
|
||||
wordnumber += 2;
|
||||
if (!things)
|
||||
puts("Nothing to take off!");
|
||||
} else
|
||||
takeoff();
|
||||
break;
|
||||
|
||||
|
||||
case DRAW:
|
||||
|
||||
if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
|
||||
int things;
|
||||
things = 0;
|
||||
for (n = 0; n < NUMOFOBJECTS; n++)
|
||||
if (testbit(wear, n)) {
|
||||
things++;
|
||||
wordvalue[wordnumber + 1] = n;
|
||||
wordnumber = draw();
|
||||
}
|
||||
wordnumber += 2;
|
||||
if (!things)
|
||||
puts("Nothing to draw!");
|
||||
} else
|
||||
draw();
|
||||
break;
|
||||
|
||||
|
||||
case PUTON:
|
||||
|
||||
if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
|
||||
int things;
|
||||
things = 0;
|
||||
for (n = 0; n < NUMOFOBJECTS; n++)
|
||||
if (testbit(location[position].objects, n) && objsht[n]) {
|
||||
things++;
|
||||
wordvalue[wordnumber + 1] = n;
|
||||
wordnumber = puton();
|
||||
}
|
||||
wordnumber += 2;
|
||||
if (!things)
|
||||
puts("Nothing to put on!");
|
||||
} else
|
||||
puton();
|
||||
break;
|
||||
|
||||
case WEARIT:
|
||||
|
||||
if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
|
||||
int things;
|
||||
things = 0;
|
||||
for (n = 0; n < NUMOFOBJECTS; n++)
|
||||
if (testbit(inven, n)) {
|
||||
things++;
|
||||
wordvalue[wordnumber + 1] = n;
|
||||
wordnumber = wearit();
|
||||
}
|
||||
wordnumber += 2;
|
||||
if (!things)
|
||||
puts("Nothing to wear!");
|
||||
} else
|
||||
wearit();
|
||||
break;
|
||||
|
||||
|
||||
case EAT:
|
||||
|
||||
if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
|
||||
int things;
|
||||
things = 0;
|
||||
for (n = 0; n < NUMOFOBJECTS; n++)
|
||||
if (testbit(inven, n)) {
|
||||
things++;
|
||||
wordvalue[wordnumber + 1] = n;
|
||||
wordnumber = eat();
|
||||
}
|
||||
wordnumber += 2;
|
||||
if (!things)
|
||||
puts("Nothing to eat!");
|
||||
} else
|
||||
eat();
|
||||
break;
|
||||
|
||||
|
||||
case PUT:
|
||||
put();
|
||||
break;
|
||||
|
||||
|
||||
case INVEN:
|
||||
if (ucard(inven)) {
|
||||
puts("You are holding:\n");
|
||||
for (n = 0; n < NUMOFOBJECTS; n++)
|
||||
if (testbit(inven, n))
|
||||
printf("\t%s\n", objsht[n]);
|
||||
printf("\n= %d kilogram%s (%d%%)\n", carrying, (carrying == 1 ? "." : "s."), (WEIGHT ? carrying * 100 / WEIGHT : -1));
|
||||
printf("Your arms are %d%% full.\n", encumber * 100 / CUMBER);
|
||||
if (WEIGHT == 0)
|
||||
printf("\n= %d kilogram%s (can't lift any weight%s)\n",
|
||||
carrying,
|
||||
(carrying == 1 ? "." : "s."),
|
||||
(carrying ? " or move with what you have" : ""));
|
||||
else
|
||||
printf("\n= %d kilogram%s (%d%%)\n",
|
||||
carrying,
|
||||
(carrying == 1 ? "." : "s."),
|
||||
carrying * 100 / WEIGHT);
|
||||
if (CUMBER == 0)
|
||||
printf("Your arms can't pick anything up.\n");
|
||||
else
|
||||
printf("Your arms are %d%% full.\n",
|
||||
encumber * 100 / CUMBER);
|
||||
} else
|
||||
puts("You aren't carrying anything.");
|
||||
|
||||
@@ -286,12 +348,30 @@ cypher()
|
||||
printf("\nYou can still carry up to %d kilogram%s\n", WEIGHT, (WEIGHT == 1 ? "." : "s."));
|
||||
} else
|
||||
puts("\nYou are in perfect health.");
|
||||
wordnumber++;
|
||||
break;
|
||||
|
||||
case USE:
|
||||
lflag = use();
|
||||
break;
|
||||
|
||||
case OPEN:
|
||||
if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
|
||||
int things;
|
||||
things = 0;
|
||||
for (n = 0; n < NUMOFOBJECTS; n++)
|
||||
if (testbit(inven, n)) {
|
||||
things++;
|
||||
wordvalue[wordnumber + 1] = n;
|
||||
dooropen();
|
||||
}
|
||||
wordnumber += 2;
|
||||
if (!things)
|
||||
puts("Nothing to open!");
|
||||
} else
|
||||
dooropen();
|
||||
break;
|
||||
|
||||
case LOOK:
|
||||
if (!notes[CANTSEE] || testbit(inven, LAMPON) ||
|
||||
testbit(location[position].objects, LAMPON)
|
||||
@@ -369,18 +449,31 @@ cypher()
|
||||
break;
|
||||
|
||||
case SAVE:
|
||||
printf("\nSave file name (default %s) ",
|
||||
printf("\nSave file name (default %s): ",
|
||||
DEFAULT_SAVE_FILE);
|
||||
filename = fgetln(stdin, &filename_len);
|
||||
if (filename_len == 0
|
||||
|| (filename_len == 1 && filename[0] == '\n'))
|
||||
save(DEFAULT_SAVE_FILE,
|
||||
rfilename = save_file_name(DEFAULT_SAVE_FILE,
|
||||
strlen(DEFAULT_SAVE_FILE));
|
||||
else {
|
||||
if (filename[filename_len - 1] == '\n')
|
||||
filename_len--;
|
||||
save(filename, filename_len);
|
||||
rfilename = save_file_name(filename,
|
||||
filename_len);
|
||||
}
|
||||
save(rfilename);
|
||||
free(rfilename);
|
||||
break;
|
||||
|
||||
case VERBOSE:
|
||||
verbose = 1;
|
||||
printf("[Maximum verbosity]\n");
|
||||
break;
|
||||
|
||||
case BRIEF:
|
||||
verbose = 0;
|
||||
printf("[Standard verbosity]\n");
|
||||
break;
|
||||
|
||||
case FOLLOW:
|
||||
@@ -461,7 +554,6 @@ cypher()
|
||||
return (-1);
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
if (wordnumber < wordcount && *words[wordnumber++] == ',')
|
||||
continue;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dayobjs.c,v 1.6 1997/10/11 02:07:16 lukem Exp $ */
|
||||
/* $NetBSD: dayobjs.c,v 1.8 1999/09/18 16:42:29 jsm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)dayobjs.c 8.2 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: dayobjs.c,v 1.6 1997/10/11 02:07:16 lukem Exp $");
|
||||
__RCSID("$NetBSD: dayobjs.c,v 1.8 1999/09/18 16:42:29 jsm Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: extern.h,v 1.9 1998/09/13 15:27:26 hubertf Exp $ */
|
||||
/* $NetBSD: extern.h,v 1.28 2000/09/25 19:37:59 jsm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@@ -35,8 +35,6 @@
|
||||
* @(#)externs.h 8.1 (Berkeley) 5/31/93
|
||||
*/
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
#include <pwd.h>
|
||||
@@ -44,6 +42,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define BITS (8 * sizeof (int))
|
||||
@@ -188,6 +187,10 @@
|
||||
#define BURY 1050
|
||||
#define JUMP 1051
|
||||
#define KICK 1052
|
||||
#define OPEN 1053
|
||||
#define VERBOSE 1054
|
||||
#define BRIEF 1055
|
||||
#define AUXVERB 1056
|
||||
|
||||
/* injuries */
|
||||
#define ARM 6 /* broken arm */
|
||||
@@ -207,6 +210,9 @@
|
||||
#define DUG 5
|
||||
#define NUMOFNOTES 6
|
||||
|
||||
/* Number of times room description shown. */
|
||||
#define ROOMDESC 3
|
||||
|
||||
/* fundamental constants */
|
||||
#define NUMOFROOMS 275
|
||||
#define NUMOFWORDS ((NUMOFOBJECTS + BITS - 1) / BITS)
|
||||
@@ -222,6 +228,19 @@
|
||||
#define MAXWEIGHT 60
|
||||
#define MAXCUMBER 10
|
||||
|
||||
/*
|
||||
* These are flags for objects in the objflags array. OBJ_PLURAL means
|
||||
* that the object short name is plural; OBJ_AN that it begins with a
|
||||
* vowel sound so should be preceded by "an" instead of "a"; OBJ_PERSON
|
||||
* that it is a living person; OBJ_NONOBJ that it is not an object (to
|
||||
* which any game action can be applied) at all (e.g. footsteps, asteroids).
|
||||
* Any individual object has at most one of OBJ_PERSON and OBJ_NONOBJ.
|
||||
*/
|
||||
#define OBJ_PLURAL 1
|
||||
#define OBJ_AN 2
|
||||
#define OBJ_PERSON 4
|
||||
#define OBJ_NONOBJ 8
|
||||
|
||||
struct room {
|
||||
const char *name;
|
||||
int link[8];
|
||||
@@ -238,7 +257,7 @@ struct room {
|
||||
};
|
||||
extern struct room dayfile[];
|
||||
extern struct room nightfile[];
|
||||
struct room *location;
|
||||
extern struct room *location;
|
||||
|
||||
/* object characteristics */
|
||||
extern const char *const objdes[NUMOFOBJECTS];
|
||||
@@ -246,55 +265,62 @@ extern const char *const objsht[NUMOFOBJECTS];
|
||||
extern const char *const ouch[NUMOFINJURIES];
|
||||
extern const int objwt[NUMOFOBJECTS];
|
||||
extern const int objcumber[NUMOFOBJECTS];
|
||||
extern const int objflags[NUMOFOBJECTS];
|
||||
#define is_plural_object(n) (objflags[(n)] & OBJ_PLURAL)
|
||||
/*
|
||||
* These macros yield words to use with objects (followed but not preceded
|
||||
* by spaces, or with no spaces if the expansion is the empty string).
|
||||
*/
|
||||
#define A_OR_AN(n) (objflags[(n)] & OBJ_AN ? "an " : "a ")
|
||||
#define A_OR_AN_OR_THE(n) (is_plural_object((n)) ? "the " : A_OR_AN((n)))
|
||||
#define A_OR_AN_OR_BLANK(n) (is_plural_object((n)) ? "" : A_OR_AN((n)))
|
||||
#define IS_OR_ARE(n) (is_plural_object((n)) ? "are " : "is ")
|
||||
|
||||
/* current input line */
|
||||
#define WORDLEN 15
|
||||
#define NWORD 20 /* words per line */
|
||||
char words[NWORD][15];
|
||||
int wordvalue[NWORD];
|
||||
int wordtype[NWORD];
|
||||
int wordcount, wordnumber;
|
||||
extern char words[NWORD][WORDLEN];
|
||||
extern int wordvalue[NWORD];
|
||||
extern int wordtype[NWORD];
|
||||
extern int wordcount, wordnumber;
|
||||
|
||||
/* state of the game */
|
||||
int ourtime;
|
||||
int position;
|
||||
int direction;
|
||||
int left, right, ahead, back;
|
||||
int ourclock, fuel, torps;
|
||||
int carrying, encumber;
|
||||
int rythmn;
|
||||
extern int ourtime;
|
||||
extern int position;
|
||||
extern int direction;
|
||||
extern int left, right, ahead, back;
|
||||
extern int ourclock, fuel, torps;
|
||||
extern int carrying, encumber;
|
||||
extern int rythmn;
|
||||
extern int followfight;
|
||||
int ate;
|
||||
int snooze;
|
||||
int meetgirl;
|
||||
extern int ate;
|
||||
extern int snooze;
|
||||
extern int meetgirl;
|
||||
extern int followgod;
|
||||
int godready;
|
||||
extern int godready;
|
||||
extern int win;
|
||||
int wintime;
|
||||
int wiz;
|
||||
int tempwiz;
|
||||
int matchlight;
|
||||
extern int matchcount;
|
||||
int loved;
|
||||
int pleasure, power, ego;
|
||||
extern int wintime;
|
||||
extern int wiz;
|
||||
extern int tempwiz;
|
||||
extern int matchlight, matchcount;
|
||||
extern int loved;
|
||||
extern int pleasure, power, ego;
|
||||
extern int WEIGHT;
|
||||
extern int CUMBER;
|
||||
int notes[NUMOFNOTES];
|
||||
unsigned int inven[NUMOFWORDS];
|
||||
unsigned int wear[NUMOFWORDS];
|
||||
char beenthere[NUMOFROOMS + 1];
|
||||
char injuries[NUMOFINJURIES];
|
||||
extern int notes[NUMOFNOTES];
|
||||
extern unsigned int inven[NUMOFWORDS];
|
||||
extern unsigned int wear[NUMOFWORDS];
|
||||
extern char beenthere[NUMOFROOMS + 1];
|
||||
extern char injuries[NUMOFINJURIES];
|
||||
extern int verbose;
|
||||
|
||||
char username[9];
|
||||
extern const char *username;
|
||||
|
||||
struct wlist {
|
||||
const char *string;
|
||||
int value, article;
|
||||
struct wlist *next;
|
||||
};
|
||||
#define HASHSIZE 256
|
||||
#define HASHMUL 81
|
||||
#define HASHMASK (HASHSIZE - 1)
|
||||
struct wlist *hashtab[HASHSIZE];
|
||||
extern struct wlist wlist[];
|
||||
|
||||
struct objs {
|
||||
@@ -306,10 +332,8 @@ extern const struct objs nightobjs[];
|
||||
|
||||
#define DEFAULT_SAVE_FILE ".Bstar"
|
||||
|
||||
void blast __P((void));
|
||||
void bury __P((void));
|
||||
int card __P((const char *, int));
|
||||
int checkout __P((const char *));
|
||||
void chime __P((void));
|
||||
void convert __P((int));
|
||||
void crash __P((void));
|
||||
@@ -317,19 +341,18 @@ int cypher __P((void));
|
||||
void die __P((void)) __attribute__((__noreturn__));
|
||||
void diesig __P((int)) __attribute__((__noreturn__));
|
||||
void dig __P((void));
|
||||
void dooropen __P((void));
|
||||
int draw __P((void));
|
||||
void drink __P((void));
|
||||
int drive __P((void));
|
||||
int drop __P((const char *));
|
||||
int eat __P((void));
|
||||
void endfly __P((void));
|
||||
int fight __P((int, int));
|
||||
int follow __P((void));
|
||||
void getutmp __P((char *));
|
||||
char *getcom __P((char *, int, const char *, const char *));
|
||||
char *getword __P((char *, char *, int));
|
||||
int give __P((void));
|
||||
int hash __P((const char *));
|
||||
void initialize __P((const char *));
|
||||
void install __P((struct wlist *));
|
||||
int jump __P((void));
|
||||
void kiss __P((void));
|
||||
int land __P((void));
|
||||
@@ -337,40 +360,32 @@ int launch __P((void));
|
||||
void light __P((void));
|
||||
void live __P((void)) __attribute__((__noreturn__));
|
||||
void love __P((void));
|
||||
int move __P((int, int));
|
||||
void moveenemy __P((int));
|
||||
int moveplayer __P((int, int));
|
||||
void murder __P((void));
|
||||
void news __P((void));
|
||||
void newway __P((int));
|
||||
void notarget __P((void));
|
||||
void open_score_file __P((void));
|
||||
void parse __P((void));
|
||||
void post __P((char));
|
||||
void printobjs __P((void));
|
||||
int put __P((void));
|
||||
int puton __P((void));
|
||||
const char *rate __P((void));
|
||||
void ravage __P((void));
|
||||
void restore __P((const char *, size_t));
|
||||
void restore __P((const char *));
|
||||
int ride __P((void));
|
||||
void save __P((const char *, size_t));
|
||||
void screen __P((void));
|
||||
void save __P((const char *));
|
||||
char *save_file_name __P((const char *, size_t));
|
||||
int shoot __P((void));
|
||||
void succumb __P((int));
|
||||
int take __P((unsigned int[]));
|
||||
int takeoff __P((void));
|
||||
void target __P((void));
|
||||
int throw __P((const char *));
|
||||
const char *truedirec __P((int, char));
|
||||
int ucard __P((const unsigned int *));
|
||||
int use __P((void));
|
||||
int visual __P((void));
|
||||
int wearit __P((void));
|
||||
void whichway __P((struct room));
|
||||
int wizard __P((const char *));
|
||||
void wordinit __P((void));
|
||||
void writedes __P((void));
|
||||
int zzz __P((void));
|
||||
char *getcom __P((char *, int, const char *, const char *));
|
||||
char *getword __P((char *, char *, int));
|
||||
const char *rate __P((void));
|
||||
const char *truedirec __P((int, char));
|
||||
struct wlist *lookup __P((const char *));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fly.c,v 1.6 1997/10/11 02:07:20 lukem Exp $ */
|
||||
/* $NetBSD: fly.c,v 1.10 2001/12/04 13:00:24 blymn Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)fly.c 8.2 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: fly.c,v 1.6 1997/10/11 02:07:20 lukem Exp $");
|
||||
__RCSID("$NetBSD: fly.c,v 1.10 2001/12/04 13:00:24 blymn Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -46,20 +46,27 @@ __RCSID("$NetBSD: fly.c,v 1.6 1997/10/11 02:07:20 lukem Exp $");
|
||||
#undef UP
|
||||
#include <curses.h>
|
||||
|
||||
#define abs(a) ((a) < 0 ? -(a) : (a))
|
||||
#define MIDR (LINES/2 - 1)
|
||||
#define MIDC (COLS/2 - 1)
|
||||
|
||||
int row, column;
|
||||
int dr = 0, dc = 0;
|
||||
char destroyed;
|
||||
static int row, column;
|
||||
static int dr = 0, dc = 0;
|
||||
static char destroyed;
|
||||
int ourclock = 120; /* time for all the flights in the game */
|
||||
char cross = 0;
|
||||
sig_t oldsig;
|
||||
static char cross = 0;
|
||||
static sig_t oldsig;
|
||||
|
||||
void
|
||||
static void blast __P((void));
|
||||
static void endfly __P((void));
|
||||
static void moveenemy __P((int));
|
||||
static void notarget __P((void));
|
||||
static void screen __P((void));
|
||||
static void succumb __P((int));
|
||||
static void target __P((void));
|
||||
|
||||
static void
|
||||
succumb(dummy)
|
||||
int dummy __attribute__((unused));
|
||||
int dummy __attribute__((__unused__));
|
||||
{
|
||||
if (oldsig == SIG_DFL) {
|
||||
endfly();
|
||||
@@ -80,7 +87,7 @@ visual()
|
||||
return (0);
|
||||
}
|
||||
oldsig = signal(SIGINT, succumb);
|
||||
crmode();
|
||||
cbreak();
|
||||
noecho();
|
||||
screen();
|
||||
row = rnd(LINES - 3) + 1;
|
||||
@@ -178,7 +185,7 @@ visual()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
screen()
|
||||
{
|
||||
int r, c, n;
|
||||
@@ -195,7 +202,7 @@ screen()
|
||||
refresh();
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
target()
|
||||
{
|
||||
int n;
|
||||
@@ -208,7 +215,7 @@ target()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
notarget()
|
||||
{
|
||||
int n;
|
||||
@@ -221,7 +228,7 @@ notarget()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
blast()
|
||||
{
|
||||
int n;
|
||||
@@ -243,9 +250,9 @@ blast()
|
||||
alarm(1);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
moveenemy(dummy)
|
||||
int dummy __attribute__((unused));
|
||||
int dummy __attribute__((__unused__));
|
||||
{
|
||||
double d;
|
||||
int oldr, oldc;
|
||||
@@ -283,7 +290,7 @@ moveenemy(dummy)
|
||||
alarm(1);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
endfly()
|
||||
{
|
||||
alarm(0);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: getcom.c,v 1.5 1997/10/11 02:07:21 lukem Exp $ */
|
||||
/* $NetBSD: getcom.c,v 1.10 2000/09/24 15:51:40 jsm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)getcom.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: getcom.c,v 1.5 1997/10/11 02:07:21 lukem Exp $");
|
||||
__RCSID("$NetBSD: getcom.c,v 1.10 2000/09/24 15:51:40 jsm Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -53,6 +53,8 @@ getcom(buf, size, prompt, error)
|
||||
for (;;) {
|
||||
fputs(prompt, stdout);
|
||||
if (fgets(buf, size, stdin) == 0) {
|
||||
if (feof(stdin))
|
||||
die();
|
||||
clearerr(stdin);
|
||||
continue;
|
||||
}
|
||||
@@ -63,6 +65,12 @@ getcom(buf, size, prompt, error)
|
||||
if (error)
|
||||
puts(error);
|
||||
}
|
||||
/* If we didn't get to the end of the line, don't read it in next time. */
|
||||
if (buf[strlen(buf) - 1] != '\n') {
|
||||
int i;
|
||||
while ((i = getchar()) != '\n' && i != EOF)
|
||||
continue;
|
||||
}
|
||||
return (buf);
|
||||
}
|
||||
|
||||
@@ -76,6 +84,9 @@ getword(buf1, buf2, flag)
|
||||
char *buf1, *buf2;
|
||||
int flag;
|
||||
{
|
||||
int cnt;
|
||||
|
||||
cnt = 1;
|
||||
while (isspace(*buf1))
|
||||
buf1++;
|
||||
if (*buf1 != ',') {
|
||||
@@ -83,24 +94,34 @@ getword(buf1, buf2, flag)
|
||||
*buf2 = 0;
|
||||
return (0);
|
||||
}
|
||||
while (*buf1 && !isspace(*buf1) && *buf1 != ',')
|
||||
if (flag < 0)
|
||||
if (isupper(*buf1))
|
||||
while (cnt < WORDLEN && *buf1 && !isspace(*buf1) && *buf1 != ',')
|
||||
if (flag < 0) {
|
||||
if (isupper(*buf1)) {
|
||||
*buf2++ = tolower(*buf1++);
|
||||
else
|
||||
cnt++;
|
||||
} else {
|
||||
*buf2++ = *buf1++;
|
||||
else
|
||||
if (flag > 0)
|
||||
if (islower(*buf1))
|
||||
cnt++;
|
||||
}
|
||||
} else if (flag > 0) {
|
||||
if (islower(*buf1)) {
|
||||
*buf2++ = toupper(*buf1++);
|
||||
else
|
||||
cnt++;
|
||||
} else {
|
||||
*buf2++ = *buf1++;
|
||||
else
|
||||
cnt++;
|
||||
}
|
||||
} else {
|
||||
*buf2++ = *buf1++;
|
||||
cnt++;
|
||||
}
|
||||
if (cnt == WORDLEN)
|
||||
while (*buf1 && !isspace(*buf1))
|
||||
buf1++;
|
||||
} else
|
||||
*buf2++ = *buf1++;
|
||||
*buf2 = 0;
|
||||
*buf2 = '\0';
|
||||
while (isspace(*buf1))
|
||||
buf1++;
|
||||
return (*buf1 ? buf1 : 0);
|
||||
return (*buf1 ? buf1 : NULL);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: globals.c,v 1.6 1997/10/11 02:07:23 lukem Exp $ */
|
||||
/* $NetBSD: globals.c,v 1.18 2000/09/25 14:45:01 jsm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)globals.c 8.2 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: globals.c,v 1.6 1997/10/11 02:07:23 lukem Exp $");
|
||||
__RCSID("$NetBSD: globals.c,v 1.18 2000/09/25 14:45:01 jsm Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -48,11 +48,11 @@ int WEIGHT = MAXWEIGHT;
|
||||
int CUMBER = MAXCUMBER;
|
||||
|
||||
const char *const objdes[NUMOFOBJECTS] = {
|
||||
"There is a knife here",
|
||||
"There is an exquisitely crafted sword and scabbard here.",
|
||||
0, /* can land from here */
|
||||
"There is a knife here.",
|
||||
"There are an exquisitely crafted sword and scabbard here.",
|
||||
NULL, /* Can land from here. */
|
||||
"There is a fierce woodsman here brandishing a heavy mallet.",
|
||||
"There is an unweildly two-handed sword here.",
|
||||
"There is an unwieldy two-handed sword here.",
|
||||
"There is a bloody meat cleaver here.",
|
||||
"A rusty broadsword is lying here.",
|
||||
"There is an ancient coat of finely woven mail here.",
|
||||
@@ -62,7 +62,7 @@ const char *const objdes[NUMOFOBJECTS] = {
|
||||
"There is a Viper ready for launch here.",
|
||||
"A kerosene lantern is burning luridly here.",
|
||||
"An old pair of shoes has been discarded here.",
|
||||
0, /* cylon */
|
||||
NULL, /* Cylon. */
|
||||
"There is a pair of pajamas here.",
|
||||
"A kingly robe of royal purple and spun gold is draped here.",
|
||||
"There is a strange golden amulet on the floor here.",
|
||||
@@ -73,14 +73,14 @@ const char *const objdes[NUMOFOBJECTS] = {
|
||||
"There is a laser pistol here.",
|
||||
"A flower-like young goddess is bathing in the hot mineral pools. She is \nwatching you, but continues to steep and sing softly.",
|
||||
"The goddess is reclining on a bed of ferns and studying you intently.",
|
||||
"There is a grenade here",
|
||||
"There is a grenade here.",
|
||||
"There is a length of heavy chain here.",
|
||||
"There is a stout rope here.",
|
||||
"There is a pair of Levi's here.",
|
||||
"A bloody mace is lying on the ground here.",
|
||||
"There is a shovel here.",
|
||||
"A long, sharp halberd is propped up here.",
|
||||
"There is a compass here",
|
||||
"There is a compass here.",
|
||||
"Wreckage and smoldering debris from a crash litter the ground here.",
|
||||
"A woodland Elf armed with a shield and deadly halberd lunges toward you!",
|
||||
"I think I hear footsteps behind us.",
|
||||
@@ -96,15 +96,15 @@ const char *const objdes[NUMOFOBJECTS] = {
|
||||
"There is a colorful pink potion in a small crystal vial here.",
|
||||
"A gold bracelet is on the ground here.",
|
||||
"A swarthy woman with stern features pulls you aside from the crowd,\n'I must talk to you -- but not here. Meet me at midnight in the gardens.'",
|
||||
"The swarthy woman has been awaiting you anxiousy. 'I must warn you that the\nIsland has anticipated your Quest. You will not be welcomed. The Darkness is\nstrong where you must search. Seek not the shadows save only at night, for\nthen are they the weakest. In the mountains far from here a canyon winds\nwith ferns and streams and forgotten vines. There you must go. Take this\nrope.'",
|
||||
"The swarthy woman has been awaiting you anxiously. 'I must warn you that the\nIsland has anticipated your Quest. You will not be welcomed. The Darkness is\nstrong where you must search. Seek not the shadows save only at night, for\nthen are they the weakest. In the mountains far from here a canyon winds\nwith ferns and streams and forgotten vines. There you must go. Take this\nrope.'",
|
||||
"Out from the shadows a figure leaps! His black cape swirls around, and he\nholds a laser sword at your chest. 'So, you have come to fulfill the Quest.\nHa! Your weapons are no match for me!'",
|
||||
"An old timer with one eye missing and no money for a drink sits at the bar.",
|
||||
"An old-timer with one eye missing and no money for a drink sits at the bar.",
|
||||
"You are flying through an asteroid field!",
|
||||
"A planet is nearby.",
|
||||
"The ground is charred here.",
|
||||
"There is a thermonuclear warhead here.",
|
||||
"The fragile, beautiful young goddess lies here. You murdered her horribly.",
|
||||
"The old timer is lying here. He is dead.",
|
||||
"The old-timer is lying here. He is dead.",
|
||||
"The native girl's body is lying here.",
|
||||
"A native girl is sitting here.",
|
||||
"A gorgeous white stallion is standing here.",
|
||||
@@ -118,7 +118,7 @@ const char *const objdes[NUMOFOBJECTS] = {
|
||||
const char *const objsht[NUMOFOBJECTS] = {
|
||||
"knife",
|
||||
"fine sword",
|
||||
0,
|
||||
NULL, /* Can land from here. */
|
||||
"Woodsman",
|
||||
"two-handed sword",
|
||||
"meat cleaver",
|
||||
@@ -130,7 +130,7 @@ const char *const objsht[NUMOFOBJECTS] = {
|
||||
"viper",
|
||||
"lantern",
|
||||
"shoes",
|
||||
0,
|
||||
NULL, /* Cylon. */
|
||||
"pajamas",
|
||||
"robe",
|
||||
"amulet",
|
||||
@@ -139,8 +139,8 @@ const char *const objsht[NUMOFOBJECTS] = {
|
||||
"woodsman's body",
|
||||
"wooden mallet",
|
||||
"laser",
|
||||
0,
|
||||
0,
|
||||
NULL, /* Bathing goddess. */
|
||||
NULL, /* Goddess. */
|
||||
"grenade",
|
||||
"chain",
|
||||
"rope",
|
||||
@@ -149,12 +149,12 @@ const char *const objsht[NUMOFOBJECTS] = {
|
||||
"shovel",
|
||||
"halberd",
|
||||
"compass",
|
||||
0,
|
||||
NULL, /* Crash debris. */
|
||||
"Elf",
|
||||
0,
|
||||
NULL, /* Footsteps. */
|
||||
"coins",
|
||||
"match book",
|
||||
0,
|
||||
NULL, /* Man and dwarf. */
|
||||
"papayas",
|
||||
"pineapple",
|
||||
"kiwi",
|
||||
@@ -163,18 +163,18 @@ const char *const objsht[NUMOFOBJECTS] = {
|
||||
"ring",
|
||||
"potion",
|
||||
"bracelet",
|
||||
0,
|
||||
0,
|
||||
NULL, /* Swarthy woman. */
|
||||
NULL, /* Swarthy woman (with message). */
|
||||
"Dark Lord",
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
NULL, /* Old-timer. */
|
||||
NULL, /* Asteroid field. */
|
||||
NULL, /* Planet nearby. */
|
||||
NULL, /* Charred ground. */
|
||||
"warhead",
|
||||
"goddess's body",
|
||||
"old timer's body",
|
||||
"old-timer's body",
|
||||
"girl's body",
|
||||
0,
|
||||
NULL, /* Native girl. */
|
||||
"stallion",
|
||||
"car",
|
||||
"pot of jewels",
|
||||
@@ -220,7 +220,61 @@ const int objcumber[NUMOFOBJECTS] = {
|
||||
10, 8, 8, 10, 10, 3, 1, 2
|
||||
};
|
||||
|
||||
const int objflags[NUMOFOBJECTS] = {
|
||||
0, 0, OBJ_NONOBJ, OBJ_PERSON,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
0, OBJ_PLURAL, OBJ_NONOBJ, OBJ_PLURAL,
|
||||
0, OBJ_AN, 0, 0,
|
||||
0, 0, 0, OBJ_PERSON,
|
||||
OBJ_PERSON, 0, 0, 0,
|
||||
OBJ_PLURAL, 0, 0, 0,
|
||||
0, 0, OBJ_AN|OBJ_PERSON, OBJ_NONOBJ,
|
||||
OBJ_PLURAL, 0, OBJ_PERSON, OBJ_PLURAL,
|
||||
0, 0, OBJ_PLURAL, 0,
|
||||
0, 0, 0, OBJ_PERSON,
|
||||
OBJ_PERSON, OBJ_PERSON, OBJ_PERSON, OBJ_NONOBJ,
|
||||
OBJ_NONOBJ, OBJ_NONOBJ, 0, 0,
|
||||
OBJ_AN, 0, OBJ_PERSON, 0,
|
||||
0, 0, 0, 0
|
||||
};
|
||||
|
||||
int win = 1;
|
||||
int matchcount = 20;
|
||||
int followgod = -1;
|
||||
int followfight = -1;
|
||||
|
||||
struct room *location;
|
||||
|
||||
/* current input line */
|
||||
char words[NWORD][WORDLEN];
|
||||
int wordvalue[NWORD];
|
||||
int wordtype[NWORD];
|
||||
int wordcount, wordnumber;
|
||||
|
||||
/* state of the game */
|
||||
int ourtime;
|
||||
int position;
|
||||
int direction;
|
||||
int left, right, ahead, back;
|
||||
int fuel, torps;
|
||||
int carrying, encumber;
|
||||
int rythmn;
|
||||
int ate;
|
||||
int snooze;
|
||||
int meetgirl;
|
||||
int godready;
|
||||
int wintime;
|
||||
int wiz;
|
||||
int tempwiz;
|
||||
int matchlight;
|
||||
int loved;
|
||||
int pleasure, power, ego;
|
||||
int notes[NUMOFNOTES];
|
||||
unsigned int inven[NUMOFWORDS];
|
||||
unsigned int wear[NUMOFWORDS];
|
||||
char beenthere[NUMOFROOMS + 1];
|
||||
char injuries[NUMOFINJURIES];
|
||||
int verbose = 0;
|
||||
|
||||
const char *username;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: init.c,v 1.7 1997/10/11 02:07:25 lukem Exp $ */
|
||||
/* $NetBSD: init.c,v 1.12 2000/09/09 09:37:58 jsm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@@ -38,26 +38,31 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)init.c 8.4 (Berkeley) 4/30/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: init.c,v 1.7 1997/10/11 02:07:25 lukem Exp $");
|
||||
__RCSID("$NetBSD: init.c,v 1.12 2000/09/09 09:37:58 jsm Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
#include "extern.h"
|
||||
|
||||
static int checkout __P((const char *));
|
||||
static const char *getutmp __P((void));
|
||||
static int wizard __P((const char *));
|
||||
|
||||
void
|
||||
initialize(startup)
|
||||
const char *startup;
|
||||
initialize(filename)
|
||||
const char *filename;
|
||||
{
|
||||
const struct objs *p;
|
||||
char *savefile;
|
||||
|
||||
puts("Version 4.2, fall 1984.");
|
||||
puts("First Adventure game written by His Lordship, the honorable");
|
||||
puts("Admiral D.W. Riggle\n");
|
||||
location = dayfile;
|
||||
srand(getpid());
|
||||
getutmp(username);
|
||||
username = getutmp();
|
||||
wordinit();
|
||||
if (startup == NULL) {
|
||||
if (filename == NULL) {
|
||||
direction = NORTH;
|
||||
ourtime = 0;
|
||||
snooze = CYCLE * 1.5;
|
||||
@@ -67,23 +72,29 @@ initialize(startup)
|
||||
torps = TORPEDOES;
|
||||
for (p = dayobjs; p->room != 0; p++)
|
||||
setbit(location[p->room].objects, p->obj);
|
||||
} else
|
||||
restore(startup, strlen(startup));
|
||||
} else {
|
||||
savefile = save_file_name(filename, strlen(filename));
|
||||
restore(savefile);
|
||||
free(savefile);
|
||||
}
|
||||
wiz = wizard(username);
|
||||
signal(SIGINT, diesig);
|
||||
}
|
||||
|
||||
void
|
||||
getutmp(uname)
|
||||
char *uname;
|
||||
static const char *
|
||||
getutmp()
|
||||
{
|
||||
struct passwd *ptr;
|
||||
|
||||
ptr = getpwuid(getuid());
|
||||
strncpy(uname, ptr ? ptr->pw_name : "", 8);
|
||||
if (ptr == NULL)
|
||||
return "";
|
||||
else
|
||||
return strdup(ptr->pw_name);
|
||||
}
|
||||
|
||||
const char *const list[] = { /* hereditary wizards */
|
||||
/* Hereditary wizards. A configuration file might make more sense. */
|
||||
static const char *const list[] = {
|
||||
"riggle",
|
||||
"chris",
|
||||
"edward",
|
||||
@@ -94,14 +105,14 @@ const char *const list[] = { /* hereditary wizards */
|
||||
0
|
||||
};
|
||||
|
||||
const char *const badguys[] = {
|
||||
static const char *const badguys[] = {
|
||||
"wnj",
|
||||
"root",
|
||||
"ted",
|
||||
0
|
||||
};
|
||||
|
||||
int
|
||||
static int
|
||||
wizard(uname)
|
||||
const char *uname;
|
||||
{
|
||||
@@ -112,7 +123,7 @@ wizard(uname)
|
||||
return flag;
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
checkout(uname)
|
||||
const char *uname;
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: misc.c,v 1.6 1997/10/11 02:07:27 lukem Exp $ */
|
||||
/* $NetBSD: misc.c,v 1.7 1999/02/10 01:36:50 hubertf Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)misc.c 8.2 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: misc.c,v 1.6 1997/10/11 02:07:27 lukem Exp $");
|
||||
__RCSID("$NetBSD: misc.c,v 1.7 1999/02/10 01:36:50 hubertf Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nightobjs.c,v 1.6 1997/10/11 02:07:31 lukem Exp $ */
|
||||
/* $NetBSD: nightobjs.c,v 1.8 1999/09/18 16:42:29 jsm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)nightobjs.c 8.2 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: nightobjs.c,v 1.6 1997/10/11 02:07:31 lukem Exp $");
|
||||
__RCSID("$NetBSD: nightobjs.c,v 1.8 1999/09/18 16:42:29 jsm Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: parse.c,v 1.6 1997/10/11 02:07:33 lukem Exp $ */
|
||||
/* $NetBSD: parse.c,v 1.12 2001/06/19 13:42:09 wiz Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@@ -38,12 +38,22 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)parse.c 8.2 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: parse.c,v 1.6 1997/10/11 02:07:33 lukem Exp $");
|
||||
__RCSID("$NetBSD: parse.c,v 1.12 2001/06/19 13:42:09 wiz Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
#include "extern.h"
|
||||
|
||||
#define HASHSIZE 256
|
||||
#define HASHMUL 81
|
||||
#define HASHMASK (HASHSIZE - 1)
|
||||
|
||||
static int hash __P((const char *));
|
||||
static void install __P((struct wlist *));
|
||||
static struct wlist *lookup __P((const char *));
|
||||
|
||||
static struct wlist *hashtab[HASHSIZE];
|
||||
|
||||
void
|
||||
wordinit()
|
||||
{
|
||||
@@ -53,7 +63,7 @@ wordinit()
|
||||
install(w);
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
hash(s)
|
||||
const char *s;
|
||||
{
|
||||
@@ -67,7 +77,7 @@ hash(s)
|
||||
return hashval;
|
||||
}
|
||||
|
||||
struct wlist *
|
||||
static struct wlist *
|
||||
lookup(s)
|
||||
const char *s;
|
||||
{
|
||||
@@ -79,7 +89,7 @@ lookup(s)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
install(wp)
|
||||
struct wlist *wp;
|
||||
{
|
||||
@@ -98,6 +108,7 @@ parse()
|
||||
{
|
||||
struct wlist *wp;
|
||||
int n;
|
||||
int flag;
|
||||
|
||||
wordnumber = 0; /* for cypher */
|
||||
for (n = 0; n <= wordcount; n++) {
|
||||
@@ -109,4 +120,72 @@ parse()
|
||||
wordtype[n] = wp->article;
|
||||
}
|
||||
}
|
||||
/* We never use adjectives for anything, so yank them all. */
|
||||
for (n = 1; n < wordcount; n++)
|
||||
if (wordtype[n] == ADJS) {
|
||||
int i;
|
||||
for (i = n + 1; i < wordcount; i++) {
|
||||
wordtype[i - 1] = wordtype[i];
|
||||
wordvalue[i - 1] = wordvalue[i];
|
||||
strcpy(words[i - 1], words[i]);
|
||||
}
|
||||
wordcount--;
|
||||
}
|
||||
/* Don't let a comma mean AND if followed by a verb. */
|
||||
for (n = 0; n < wordcount; n++)
|
||||
if (wordvalue[n] == AND && words[n][0] == ','
|
||||
&& wordtype[n + 1] == VERB) {
|
||||
wordvalue[n] = -1;
|
||||
wordtype[n] = -1;
|
||||
}
|
||||
/* Trim "AND AND" which can happen naturally at the end of a
|
||||
* comma-delimited list.
|
||||
*/
|
||||
for (n = 1; n < wordcount; n++)
|
||||
if (wordvalue[n - 1] == AND && wordvalue[n] == AND) {
|
||||
int i;
|
||||
for (i = n + 1; i < wordcount; i++) {
|
||||
wordtype[i - 1] = wordtype[i];
|
||||
wordvalue[i - 1] = wordvalue[i];
|
||||
strcpy(words[i - 1], words[i]);
|
||||
}
|
||||
wordcount--;
|
||||
}
|
||||
|
||||
/* If there is a sequence (NOUN | OBJECT) AND EVERYTHING
|
||||
* then move all the EVERYTHINGs to the beginning, since that's where
|
||||
* they're expected. We can't get rid of the NOUNs and OBJECTs in
|
||||
* case they aren't in EVERYTHING (i.e. not here or nonexistent).
|
||||
*/
|
||||
flag = 1;
|
||||
while (flag) {
|
||||
flag = 0;
|
||||
for (n = 1; n < wordcount; n++)
|
||||
if ((wordtype[n - 1] == NOUNS || wordtype[n - 1] == OBJECT) &&
|
||||
wordvalue[n] == AND && wordvalue[n + 1] == EVERYTHING) {
|
||||
char tmpword[WORDLEN];
|
||||
wordvalue[n + 1] = wordvalue[n - 1];
|
||||
wordvalue[n - 1] = EVERYTHING;
|
||||
wordtype[n + 1] = wordtype[n - 1];
|
||||
wordtype[n - 1] = OBJECT;
|
||||
strcpy(tmpword, words[n - 1]);
|
||||
strcpy(words[n - 1], words[n + 1]);
|
||||
strcpy(words[n + 1], tmpword);
|
||||
flag = 1;
|
||||
}
|
||||
/* And trim EVERYTHING AND EVERYTHING. */
|
||||
for (n = 1; n < wordcount; n++)
|
||||
if (wordvalue[n - 1] == EVERYTHING &&
|
||||
wordvalue[n] == AND && wordvalue[n + 1] == EVERYTHING) {
|
||||
int i;
|
||||
for (i = n + 1; i < wordcount; i++) {
|
||||
wordtype[i - 1] = wordtype[i + 1];
|
||||
wordvalue[i - 1] = wordvalue[i + 1];
|
||||
strcpy(words[i - 1], words[i + 1]);
|
||||
}
|
||||
wordcount--;
|
||||
wordcount--;
|
||||
flag = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: room.c,v 1.6 1997/10/11 02:07:35 lukem Exp $ */
|
||||
/* $NetBSD: room.c,v 1.10 2000/09/17 23:03:43 jsm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)room.c 8.2 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: room.c,v 1.6 1997/10/11 02:07:35 lukem Exp $");
|
||||
__RCSID("$NetBSD: room.c,v 1.10 2000/09/17 23:03:43 jsm Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -52,12 +52,15 @@ writedes()
|
||||
int c;
|
||||
|
||||
printf("\n\t%s\n", location[position].name);
|
||||
if (beenthere[position] < 3) {
|
||||
if (beenthere[position] < ROOMDESC || verbose) {
|
||||
compass = NORTH;
|
||||
for (p = location[position].desc; (c = *p++) != 0;)
|
||||
if (c != '-' && c != '*' && c != '+')
|
||||
if (c != '-' && c != '*' && c != '+') {
|
||||
if (c == '=')
|
||||
putchar('-');
|
||||
else
|
||||
putchar(c);
|
||||
else {
|
||||
} else {
|
||||
if (c != '*')
|
||||
printf(truedirec(compass, c));
|
||||
compass++;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: save.c,v 1.8 1998/09/13 15:24:41 hubertf Exp $ */
|
||||
/* $NetBSD: save.c,v 1.10 2000/01/09 17:17:20 jsm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@@ -38,51 +38,24 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)save.c 8.2 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: save.c,v 1.8 1998/09/13 15:24:41 hubertf Exp $");
|
||||
__RCSID("$NetBSD: save.c,v 1.10 2000/01/09 17:17:20 jsm Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
#include "extern.h"
|
||||
|
||||
void
|
||||
restore(filename, len)
|
||||
restore(filename)
|
||||
const char *filename;
|
||||
size_t len;
|
||||
{
|
||||
char *home;
|
||||
char *home1;
|
||||
int n;
|
||||
int tmp;
|
||||
size_t tmpl;
|
||||
FILE *fp;
|
||||
|
||||
if (memchr(filename, '/', len)) {
|
||||
home1 = malloc(len + 1);
|
||||
if (home1 == NULL)
|
||||
errx(1, "out of memory");
|
||||
memcpy(home1, filename, len);
|
||||
home1[len] = 0;
|
||||
} else {
|
||||
home = getenv("HOME");
|
||||
if (home != NULL) {
|
||||
tmpl = strlen(home);
|
||||
home1 = malloc(tmpl + len + 2);
|
||||
if (home1 == NULL)
|
||||
errx(1, "out of memory");
|
||||
memcpy(home1, home, tmpl);
|
||||
home1[tmpl] = '/';
|
||||
memcpy(home1 + tmpl + 1, filename, len);
|
||||
home1[tmpl + len + 1] = 0;
|
||||
} else {
|
||||
home1 = malloc(len + 1);
|
||||
if (home1 == NULL)
|
||||
errx(1, "out of memory");
|
||||
memcpy(home1, filename, len);
|
||||
home1[len] = 0;
|
||||
}
|
||||
}
|
||||
if ((fp = fopen(home1, "r")) == 0) {
|
||||
err(1, "fopen %s", home1);
|
||||
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);
|
||||
@@ -120,54 +93,25 @@ restore(filename, len)
|
||||
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);
|
||||
free(home1);
|
||||
}
|
||||
|
||||
void
|
||||
save(filename, len)
|
||||
save(filename)
|
||||
const char *filename;
|
||||
size_t len;
|
||||
{
|
||||
char *home;
|
||||
char *home1;
|
||||
int n;
|
||||
int tmp;
|
||||
size_t tmpl;
|
||||
FILE *fp;
|
||||
|
||||
if (memchr(filename, '/', len)) {
|
||||
home1 = malloc(len + 1);
|
||||
if (home1 == NULL)
|
||||
errx(1, "out of memory");
|
||||
memcpy(home1, filename, len);
|
||||
home1[len] = 0;
|
||||
} else {
|
||||
home = getenv("HOME");
|
||||
if (home != NULL) {
|
||||
tmpl = strlen(home);
|
||||
home1 = malloc(tmpl + len + 2);
|
||||
if (home1 == NULL)
|
||||
errx(1, "out of memory");
|
||||
memcpy(home1, home, tmpl);
|
||||
home1[tmpl] = '/';
|
||||
memcpy(home1 + tmpl + 1, filename, len);
|
||||
home1[tmpl + len + 1] = 0;
|
||||
} else {
|
||||
home1 = malloc(len + 1);
|
||||
if (home1 == NULL)
|
||||
errx(1, "out of memory");
|
||||
memcpy(home1, filename, len);
|
||||
home1[len] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ((fp = fopen(home1, "w")) == NULL) {
|
||||
warn("fopen %s", home1);
|
||||
if (filename == NULL)
|
||||
return; /* Error determining save file name. */
|
||||
if ((fp = fopen(filename, "w")) == NULL) {
|
||||
warn("fopen %s", 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(&ourclock, sizeof ourclock, 1, fp);
|
||||
@@ -205,7 +149,55 @@ save(filename, len)
|
||||
fwrite(&ego, sizeof ego, 1, fp);
|
||||
fflush(fp);
|
||||
if (ferror(fp))
|
||||
warn("fwrite %s", home1);
|
||||
warn("fwrite %s", filename);
|
||||
fclose(fp);
|
||||
free(home1);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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) {
|
||||
warn(NULL);
|
||||
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) {
|
||||
warn(NULL);
|
||||
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) {
|
||||
warn(NULL);
|
||||
return NULL;
|
||||
}
|
||||
memcpy(newname, filename, len);
|
||||
newname[len] = 0;
|
||||
}
|
||||
}
|
||||
return newname;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: words.c,v 1.6 1997/10/11 02:07:39 lukem Exp $ */
|
||||
/* $NetBSD: words.c,v 1.10 2000/09/25 19:37:59 jsm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@@ -38,176 +38,183 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)words.c 8.2 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: words.c,v 1.6 1997/10/11 02:07:39 lukem Exp $");
|
||||
__RCSID("$NetBSD: words.c,v 1.10 2000/09/25 19:37:59 jsm Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
#include "extern.h"
|
||||
|
||||
struct wlist wlist[] = {
|
||||
{"knife", KNIFE, OBJECT},
|
||||
{"sword", SWORD, NOUNS},
|
||||
{"scabbard", SWORD, OBJECT},
|
||||
{"fine", SWORD, OBJECT},
|
||||
{"two-handed", TWO_HANDED, OBJECT},
|
||||
{"cleaver", CLEAVER, OBJECT},
|
||||
{"broadsword", BROAD, OBJECT},
|
||||
{"mail", MAIL, OBJECT},
|
||||
{"coat", MAIL, OBJECT},
|
||||
{"helmet", HELM, OBJECT},
|
||||
{"shield", SHIELD, OBJECT},
|
||||
{"maid", MAID, OBJECT},
|
||||
{"maid's", MAID, OBJECT},
|
||||
{"body", BODY, NOUNS},
|
||||
{"viper", VIPER, OBJECT},
|
||||
{"lamp", LAMPON, OBJECT},
|
||||
{"lantern", LAMPON, OBJECT},
|
||||
{"shoes", SHOES, OBJECT},
|
||||
{"pajamas", PAJAMAS, OBJECT},
|
||||
{"robe", ROBE, OBJECT},
|
||||
{"amulet", AMULET, NOUNS},
|
||||
{"medallion", MEDALION, NOUNS},
|
||||
{"talisman", TALISMAN, NOUNS},
|
||||
{"woodsman", DEADWOOD, OBJECT},
|
||||
{"woodsman's", DEADWOOD, OBJECT},
|
||||
{"mallet", MALLET, OBJECT},
|
||||
{"laser", LASER, OBJECT},
|
||||
{"pistol", LASER, OBJECT},
|
||||
{"blaster", LASER, OBJECT},
|
||||
{"gun", LASER, OBJECT},
|
||||
{"goddess", NORMGOD, NOUNS},
|
||||
{"grenade", GRENADE, OBJECT},
|
||||
{"chain", CHAIN, OBJECT},
|
||||
{"rope", ROPE, OBJECT},
|
||||
{"levis", LEVIS, OBJECT},
|
||||
{"pants", LEVIS, OBJECT},
|
||||
{"mace", MACE, OBJECT},
|
||||
{"shovel", SHOVEL, OBJECT},
|
||||
{"halberd", HALBERD, OBJECT},
|
||||
{"compass", COMPASS, OBJECT},
|
||||
{"elf", ELF, OBJECT},
|
||||
{"coins", COINS, OBJECT},
|
||||
{"matches", MATCHES, OBJECT},
|
||||
{"match", MATCHES, OBJECT},
|
||||
{"book", MATCHES, OBJECT},
|
||||
{"man", MAN, NOUNS},
|
||||
{"papayas", PAPAYAS, OBJECT},
|
||||
{"pineapple", PINEAPPLE, OBJECT},
|
||||
{"kiwi", KIWI, OBJECT},
|
||||
{"coconuts", COCONUTS, OBJECT},
|
||||
{"mango", MANGO, OBJECT},
|
||||
{"ring", RING, OBJECT},
|
||||
{"potion", POTION, OBJECT},
|
||||
{"bracelet", BRACELET, OBJECT},
|
||||
{"timer", TIMER, NOUNS},
|
||||
{"bomb", BOMB, OBJECT},
|
||||
{"warhead", BOMB, OBJECT},
|
||||
{"girl", NATIVE, NOUNS},
|
||||
{"native", NATIVE, NOUNS},
|
||||
{"horse", HORSE, OBJECT},
|
||||
{"stallion", HORSE, OBJECT},
|
||||
{"car", CAR, OBJECT},
|
||||
{"volare", CAR, OBJECT},
|
||||
{"pot", POT, OBJECT},
|
||||
{"jewels", POT, OBJECT},
|
||||
{"bar", BAR, OBJECT},
|
||||
{"diamond", BLOCK, OBJECT},
|
||||
{"block", BLOCK, OBJECT},
|
||||
{"up", UP, VERB},
|
||||
{"u", UP, VERB},
|
||||
{"down", DOWN, VERB},
|
||||
{"d", DOWN, VERB},
|
||||
{"ahead", AHEAD, VERB},
|
||||
{"a", AHEAD, VERB},
|
||||
{"back", BACK, VERB},
|
||||
{"b", BACK, VERB},
|
||||
{"right", RIGHT, VERB},
|
||||
{"r", RIGHT, VERB},
|
||||
{"left", LEFT, VERB},
|
||||
{"l", LEFT, VERB},
|
||||
{"take", TAKE, VERB},
|
||||
{"get", TAKE, VERB},
|
||||
{"use", USE, VERB},
|
||||
{"look", LOOK, VERB},
|
||||
{"lo", LOOK, VERB},
|
||||
{"quit", QUIT, VERB},
|
||||
{"q", QUIT, VERB},
|
||||
{"su", SU, VERB},
|
||||
{"drop", DROP, VERB},
|
||||
{"draw", DRAW, VERB},
|
||||
{"pull", DRAW, VERB},
|
||||
{"carry", DRAW, VERB},
|
||||
{"wear", WEARIT, VERB},
|
||||
{"sheathe", WEARIT, VERB},
|
||||
{"put", PUT, VERB},
|
||||
{"buckle", PUT, VERB},
|
||||
{"strap", PUT, VERB},
|
||||
{"tie", PUT, VERB},
|
||||
{"inven", INVEN, VERB},
|
||||
{"i", INVEN, VERB},
|
||||
{"everything", EVERYTHING, OBJECT},
|
||||
{"all", EVERYTHING, OBJECT},
|
||||
{"and", AND, CONJ},
|
||||
{"kill", KILL, VERB},
|
||||
{"fight", KILL, VERB},
|
||||
{"ravage", RAVAGE, VERB},
|
||||
{"rape", RAVAGE, VERB},
|
||||
{"undress", UNDRESS, VERB},
|
||||
{"throw", THROW, VERB},
|
||||
{"launch", LAUNCH, VERB},
|
||||
{"land", LANDIT, VERB},
|
||||
{"light", LIGHT, VERB},
|
||||
{"strike", LIGHT, VERB},
|
||||
{"follow", FOLLOW, VERB},
|
||||
{"chase", FOLLOW, VERB},
|
||||
{"kiss", KISS, VERB},
|
||||
{"love", LOVE, VERB},
|
||||
{"fuck", LOVE, VERB},
|
||||
{"give", GIVE, VERB},
|
||||
{"smite", SMITE, VERB},
|
||||
{"attack", SMITE, VERB},
|
||||
{"swing", SMITE, VERB},
|
||||
{"stab", SMITE, VERB},
|
||||
{"slice", SMITE, VERB},
|
||||
{"cut", SMITE, VERB},
|
||||
{"hack", SMITE, VERB},
|
||||
{"shoot", SHOOT, VERB},
|
||||
{"blast", SHOOT, VERB},
|
||||
{"on", ON, PREPS},
|
||||
{"off", OFF, PREPS},
|
||||
{"time", TIME, VERB},
|
||||
{"sleep", SLEEP, VERB},
|
||||
{"dig", DIG, VERB},
|
||||
{"eat", EAT, VERB},
|
||||
{"swim", SWIM, VERB},
|
||||
{"drink", DRINK, VERB},
|
||||
{"door", DOOR, NOUNS},
|
||||
{"save", SAVE, VERB},
|
||||
{"ride", RIDE, VERB},
|
||||
{"mount", RIDE, VERB},
|
||||
{"drive", DRIVE, VERB},
|
||||
{"start", DRIVE, VERB},
|
||||
{"score", SCORE, VERB},
|
||||
{"points", SCORE, VERB},
|
||||
{"bury", BURY, VERB},
|
||||
{"jump", JUMP, VERB},
|
||||
{"kick", KICK, VERB},
|
||||
{"kerosene", 0, ADJS},
|
||||
{"plumed", 0, ADJS},
|
||||
{"ancient", 0, ADJS},
|
||||
{"golden", 0, ADJS},
|
||||
{"gold", 0, ADJS},
|
||||
{"ostrich", 0, ADJS},
|
||||
{"rusty", 0, ADJS},
|
||||
{"old", 0, ADJS},
|
||||
{"dented", 0, ADJS},
|
||||
{"blue", 0, ADJS},
|
||||
{"purple", 0, ADJS},
|
||||
{"kingly", 0, ADJS},
|
||||
{"the", 0, ADJS},
|
||||
{"climb", 0, ADJS},
|
||||
{"move", 0, ADJS},
|
||||
{"make", 0, ADJS},
|
||||
{"to", 0, ADJS},
|
||||
{0}
|
||||
{ "knife", KNIFE, OBJECT, NULL },
|
||||
{ "sword", SWORD, NOUNS, NULL },
|
||||
{ "scabbard", SWORD, OBJECT, NULL },
|
||||
{ "fine", SWORD, OBJECT, NULL },
|
||||
{ "two-handed", TWO_HANDED, OBJECT, NULL },
|
||||
{ "cleaver", CLEAVER, OBJECT, NULL },
|
||||
{ "broadsword", BROAD, OBJECT, NULL },
|
||||
{ "mail", MAIL, OBJECT, NULL },
|
||||
{ "coat", MAIL, OBJECT, NULL },
|
||||
{ "helmet", HELM, OBJECT, NULL },
|
||||
{ "shield", SHIELD, OBJECT, NULL },
|
||||
{ "maid", MAID, OBJECT, NULL },
|
||||
{ "maid's", MAID, OBJECT, NULL },
|
||||
{ "body", BODY, NOUNS, NULL },
|
||||
{ "viper", VIPER, OBJECT, NULL },
|
||||
{ "lamp", LAMPON, OBJECT, NULL },
|
||||
{ "lantern", LAMPON, OBJECT, NULL },
|
||||
{ "shoes", SHOES, OBJECT, NULL },
|
||||
{ "pajamas", PAJAMAS, OBJECT, NULL },
|
||||
{ "robe", ROBE, OBJECT, NULL },
|
||||
{ "amulet", AMULET, NOUNS, NULL },
|
||||
{ "medallion", MEDALION, NOUNS, NULL },
|
||||
{ "talisman", TALISMAN, NOUNS, NULL },
|
||||
{ "woodsman", DEADWOOD, OBJECT, NULL },
|
||||
{ "woodsman's", DEADWOOD, OBJECT, NULL },
|
||||
{ "mallet", MALLET, OBJECT, NULL },
|
||||
{ "laser", LASER, OBJECT, NULL },
|
||||
{ "pistol", LASER, OBJECT, NULL },
|
||||
{ "blaster", LASER, OBJECT, NULL },
|
||||
{ "gun", LASER, OBJECT, NULL },
|
||||
{ "goddess", NORMGOD, NOUNS, NULL },
|
||||
{ "grenade", GRENADE, OBJECT, NULL },
|
||||
{ "chain", CHAIN, OBJECT, NULL },
|
||||
{ "rope", ROPE, OBJECT, NULL },
|
||||
{ "levis", LEVIS, OBJECT, NULL },
|
||||
{ "pants", LEVIS, OBJECT, NULL },
|
||||
{ "mace", MACE, OBJECT, NULL },
|
||||
{ "shovel", SHOVEL, OBJECT, NULL },
|
||||
{ "halberd", HALBERD, OBJECT, NULL },
|
||||
{ "compass", COMPASS, OBJECT, NULL },
|
||||
{ "elf", ELF, OBJECT, NULL },
|
||||
{ "coins", COINS, OBJECT, NULL },
|
||||
{ "matches", MATCHES, OBJECT, NULL },
|
||||
{ "match", MATCHES, OBJECT, NULL },
|
||||
{ "book", MATCHES, OBJECT, NULL },
|
||||
{ "man", MAN, NOUNS, NULL },
|
||||
{ "papaya", PAPAYAS, OBJECT, NULL },
|
||||
{ "papayas", PAPAYAS, OBJECT, NULL },
|
||||
{ "pineapple", PINEAPPLE, OBJECT, NULL },
|
||||
{ "kiwi", KIWI, OBJECT, NULL },
|
||||
{ "coconut", COCONUTS, OBJECT, NULL },
|
||||
{ "coconuts", COCONUTS, OBJECT, NULL },
|
||||
{ "mango", MANGO, OBJECT, NULL },
|
||||
{ "ring", RING, OBJECT, NULL },
|
||||
{ "potion", POTION, OBJECT, NULL },
|
||||
{ "bracelet", BRACELET, OBJECT, NULL },
|
||||
{ "timer", TIMER, NOUNS, NULL },
|
||||
{ "bomb", BOMB, OBJECT, NULL },
|
||||
{ "warhead", BOMB, OBJECT, NULL },
|
||||
{ "girl", NATIVE, NOUNS, NULL },
|
||||
{ "native", NATIVE, NOUNS, NULL },
|
||||
{ "horse", HORSE, OBJECT, NULL },
|
||||
{ "stallion", HORSE, OBJECT, NULL },
|
||||
{ "car", CAR, OBJECT, NULL },
|
||||
{ "volare", CAR, OBJECT, NULL },
|
||||
{ "pot", POT, OBJECT, NULL },
|
||||
{ "jewels", POT, OBJECT, NULL },
|
||||
{ "bar", BAR, OBJECT, NULL },
|
||||
{ "diamond", BLOCK, OBJECT, NULL },
|
||||
{ "block", BLOCK, OBJECT, NULL },
|
||||
{ "up", UP, VERB, NULL },
|
||||
{ "u", UP, VERB, NULL },
|
||||
{ "down", DOWN, VERB, NULL },
|
||||
{ "d", DOWN, VERB, NULL },
|
||||
{ "ahead", AHEAD, VERB, NULL },
|
||||
{ "a", AHEAD, VERB, NULL },
|
||||
{ "back", BACK, VERB, NULL },
|
||||
{ "b", BACK, VERB, NULL },
|
||||
{ "right", RIGHT, VERB, NULL },
|
||||
{ "r", RIGHT, VERB, NULL },
|
||||
{ "left", LEFT, VERB, NULL },
|
||||
{ "l", LEFT, VERB, NULL },
|
||||
{ "take", TAKE, VERB, NULL },
|
||||
{ "get", TAKE, VERB, NULL },
|
||||
{ "use", USE, VERB, NULL },
|
||||
{ "look", LOOK, VERB, NULL },
|
||||
{ "lo", LOOK, VERB, NULL },
|
||||
{ "quit", QUIT, VERB, NULL },
|
||||
{ "q", QUIT, VERB, NULL },
|
||||
{ "su", SU, VERB, NULL },
|
||||
{ "drop", DROP, VERB, NULL },
|
||||
{ "draw", DRAW, VERB, NULL },
|
||||
{ "pull", DRAW, VERB, NULL },
|
||||
{ "carry", DRAW, VERB, NULL },
|
||||
{ "wear", WEARIT, VERB, NULL },
|
||||
{ "sheathe", WEARIT, VERB, NULL },
|
||||
{ "put", PUT, VERB, NULL },
|
||||
{ "buckle", PUT, VERB, NULL },
|
||||
{ "strap", PUT, VERB, NULL },
|
||||
{ "tie", PUT, VERB, NULL },
|
||||
{ "inven", INVEN, VERB, NULL },
|
||||
{ "i", INVEN, VERB, NULL },
|
||||
{ "everything", EVERYTHING, OBJECT, NULL },
|
||||
{ "all", EVERYTHING, OBJECT, NULL },
|
||||
{ "and", AND, CONJ, NULL },
|
||||
{ ",", AND, CONJ, NULL },
|
||||
{ "kill", KILL, VERB, NULL },
|
||||
{ "fight", KILL, VERB, NULL },
|
||||
{ "ravage", RAVAGE, VERB, NULL },
|
||||
{ "rape", RAVAGE, VERB, NULL },
|
||||
{ "undress", UNDRESS, VERB, NULL },
|
||||
{ "throw", THROW, VERB, NULL },
|
||||
{ "launch", LAUNCH, VERB, NULL },
|
||||
{ "land", LANDIT, VERB, NULL },
|
||||
{ "light", LIGHT, VERB, NULL },
|
||||
{ "strike", LIGHT, VERB, NULL },
|
||||
{ "follow", FOLLOW, VERB, NULL },
|
||||
{ "chase", FOLLOW, VERB, NULL },
|
||||
{ "kiss", KISS, VERB, NULL },
|
||||
{ "love", LOVE, VERB, NULL },
|
||||
{ "fuck", LOVE, VERB, NULL },
|
||||
{ "give", GIVE, VERB, NULL },
|
||||
{ "smite", SMITE, VERB, NULL },
|
||||
{ "attack", SMITE, VERB, NULL },
|
||||
{ "swing", SMITE, VERB, NULL },
|
||||
{ "stab", SMITE, VERB, NULL },
|
||||
{ "slice", SMITE, VERB, NULL },
|
||||
{ "cut", SMITE, VERB, NULL },
|
||||
{ "hack", SMITE, VERB, NULL },
|
||||
{ "shoot", SHOOT, VERB, NULL },
|
||||
{ "blast", SHOOT, VERB, NULL },
|
||||
{ "open", OPEN, VERB, NULL },
|
||||
{ "unlock", OPEN, VERB, NULL },
|
||||
{ "on", ON, PREPS, NULL },
|
||||
{ "off", OFF, PREPS, NULL },
|
||||
{ "time", TIME, VERB, NULL },
|
||||
{ "sleep", SLEEP, VERB, NULL },
|
||||
{ "dig", DIG, VERB, NULL },
|
||||
{ "eat", EAT, VERB, NULL },
|
||||
{ "swim", SWIM, VERB, NULL },
|
||||
{ "drink", DRINK, VERB, NULL },
|
||||
{ "door", DOOR, NOUNS, NULL },
|
||||
{ "verbose", VERBOSE, VERB, NULL },
|
||||
{ "brief", BRIEF, VERB, NULL },
|
||||
{ "save", SAVE, VERB, NULL },
|
||||
{ "ride", RIDE, VERB, NULL },
|
||||
{ "mount", RIDE, VERB, NULL },
|
||||
{ "drive", DRIVE, VERB, NULL },
|
||||
{ "start", DRIVE, VERB, NULL },
|
||||
{ "score", SCORE, VERB, NULL },
|
||||
{ "points", SCORE, VERB, NULL },
|
||||
{ "bury", BURY, VERB, NULL },
|
||||
{ "jump", JUMP, VERB, NULL },
|
||||
{ "kick", KICK, VERB, NULL },
|
||||
{ "kerosene", 0, ADJS, NULL },
|
||||
{ "plumed", 0, ADJS, NULL },
|
||||
{ "ancient", 0, ADJS, NULL },
|
||||
{ "golden", 0, ADJS, NULL },
|
||||
{ "gold", 0, ADJS, NULL },
|
||||
{ "ostrich", 0, ADJS, NULL },
|
||||
{ "rusty", 0, ADJS, NULL },
|
||||
{ "old", 0, ADJS, NULL },
|
||||
{ "dented", 0, ADJS, NULL },
|
||||
{ "blue", 0, ADJS, NULL },
|
||||
{ "purple", 0, ADJS, NULL },
|
||||
{ "kingly", 0, ADJS, NULL },
|
||||
{ "the", 0, ADJS, NULL },
|
||||
{ "climb", AUXVERB, VERB, NULL },
|
||||
{ "move", AUXVERB, VERB, NULL },
|
||||
{ "make", AUXVERB, VERB, NULL },
|
||||
{ "to", 0, ADJS, NULL },
|
||||
{ NULL, 0, 0, NULL }
|
||||
};
|
||||
|
||||
29
bcd/Makefrag
29
bcd/Makefrag
@@ -1,4 +1,30 @@
|
||||
# Makefrag - makefile fragment for bcd
|
||||
#
|
||||
# Copyright (c) 1997, 1998, 1999 Joseph Samuel Myers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
bcd_DIRS := $(GAMESDIR) $(MAN6DIR)
|
||||
|
||||
@@ -8,6 +34,3 @@ bcd_install: bcd_all
|
||||
$(INSTALL_BINARY) bcd/bcd $(INSTALL_PREFIX)$(GAMESDIR)/bcd
|
||||
$(HIDE_GAME) bcd
|
||||
$(INSTALL_MANUAL) bcd/bcd.6
|
||||
|
||||
bcd_check: bcd_all
|
||||
date | bcd/bcd
|
||||
|
||||
17
bcd/bcd.c
17
bcd/bcd.c
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: bcd.c,v 1.7 1997/10/10 09:54:18 lukem Exp $ */
|
||||
/* $NetBSD: bcd.c,v 1.11 2000/07/03 03:57:40 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)bcd.c 8.2 (Berkeley) 3/20/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: bcd.c,v 1.7 1997/10/10 09:54:18 lukem Exp $");
|
||||
__RCSID("$NetBSD: bcd.c,v 1.11 2000/07/03 03:57:40 matt Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -83,6 +83,7 @@ __RCSID("$NetBSD: bcd.c,v 1.7 1997/10/10 09:54:18 lukem Exp $");
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
@@ -128,7 +129,7 @@ const u_short holes[256] = {
|
||||
#define bit(w,i) ((w)&(1<<(i)))
|
||||
|
||||
int main __P((int, char *[]));
|
||||
void printcard __P((char *));
|
||||
void printcard __P((unsigned char *));
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
@@ -147,10 +148,10 @@ main(argc, argv)
|
||||
|
||||
if (argc > 1) {
|
||||
while (--argc)
|
||||
printcard(*++argv);
|
||||
printcard((unsigned char *)*++argv);
|
||||
} else
|
||||
while (fgets(cardline, sizeof(cardline), stdin))
|
||||
printcard(cardline);
|
||||
printcard((unsigned char *)cardline);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -158,17 +159,17 @@ main(argc, argv)
|
||||
|
||||
void
|
||||
printcard(str)
|
||||
char *str;
|
||||
unsigned char *str;
|
||||
{
|
||||
static const char rowchars[] = " 123456789";
|
||||
int i, row;
|
||||
unsigned char *p;
|
||||
|
||||
/* ruthlessly remove newlines and truncate at 48 characters. */
|
||||
if ((p = strchr(str, '\n')))
|
||||
if ((p = (unsigned char *)strchr((char *)str, '\n')))
|
||||
*p = '\0';
|
||||
|
||||
if (strlen(str) > COLUMNS)
|
||||
if (strlen((char *)str) > COLUMNS)
|
||||
str[COLUMNS] = '\0';
|
||||
|
||||
/* make string upper case. */
|
||||
|
||||
@@ -1,18 +1,23 @@
|
||||
# $NetBSD: Makefile,v 1.12 1997/10/11 09:34:16 mycroft Exp $
|
||||
# $NetBSD: Makefile,v 1.19 2002/09/18 02:51:46 lukem Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/11/93
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
SUBDIR= boggle mkdict mkindex
|
||||
|
||||
MKDICT!=cd $(.CURDIR)/mkdict; \
|
||||
printf "xxx: .MAKE\n\t@echo \$${.OBJDIR}/mkdict\n" | ${MAKE} -s -f-
|
||||
MKINDEX!=cd $(.CURDIR)/mkindex; \
|
||||
printf "xxx: .MAKE\n\t@echo \$${.OBJDIR}/mkindex\n" | ${MAKE} -s -f-
|
||||
WORDS=${.CURDIR}/../../share/dict/web2
|
||||
FILES=dictionary dictindex
|
||||
MKDICTDIR!= cd $(.CURDIR)/mkdict; ${PRINTOBJDIR}
|
||||
MKDICT=${MKDICTDIR}/mkdict
|
||||
MKINDEXDIR!= cd $(.CURDIR)/mkindex; ${PRINTOBJDIR}
|
||||
MKINDEX=${MKINDEXDIR}/mkindex
|
||||
WORDS=${NETBSDSRCDIR}/share/dict/web2
|
||||
DICTFILES=dictionary dictindex
|
||||
.if ${MKSHARE} != "no"
|
||||
FILES=${DICTFILES}
|
||||
FILESDIR=/usr/share/games/boggle
|
||||
CLEANFILES+=${FILES}
|
||||
.endif
|
||||
CLEANFILES+=${DICTFILES}
|
||||
|
||||
all: ${FILES}
|
||||
realall: ${FILES}
|
||||
|
||||
${MKDICT}:
|
||||
@cd ${.CURDIR}/mkdict && ${MAKE}
|
||||
@@ -20,7 +25,6 @@ ${MKDICT}:
|
||||
${MKINDEX}:
|
||||
@cd ${.CURDIR}/mkindex && ${MAKE}
|
||||
|
||||
|
||||
dictionary: ${WORDS} ${MKDICT}
|
||||
rm -f ${.TARGET}
|
||||
${MKDICT} < ${WORDS} > ${.TARGET}
|
||||
|
||||
@@ -1,4 +1,30 @@
|
||||
# Makefrag - makefile fragment for boggle
|
||||
#
|
||||
# Copyright (c) 1998 Joseph Samuel Myers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
boggle_all:
|
||||
|
||||
|
||||
@@ -1,21 +1,9 @@
|
||||
# $NetBSD: Makefile,v 1.8 1998/04/13 14:14:39 lukem Exp $
|
||||
# $NetBSD: Makefile,v 1.12 2002/09/18 06:16:40 lukem Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/11/93
|
||||
|
||||
PROG= mkdict
|
||||
NOMAN= # defined
|
||||
|
||||
HOSTPROG= mkdict
|
||||
HOST_CPPFLAGS+= -I${.CURDIR}/../boggle
|
||||
NOMAN= noman
|
||||
|
||||
# XXX for "make depend"
|
||||
CPPFLAGS+=-I${.CURDIR}/../boggle
|
||||
|
||||
# only needed during build
|
||||
proginstall::
|
||||
|
||||
# Override these rules for cross-compilation
|
||||
.c.o:
|
||||
${HOST_COMPILE.c} ${.IMPSRC}
|
||||
|
||||
${PROG}: ${OBJS}
|
||||
${HOST_LINK.c} -o ${.TARGET} ${OBJS}
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
.include <bsd.hostprog.mk>
|
||||
|
||||
@@ -1,10 +1,36 @@
|
||||
# Makefrag - makefile fragment for boggle/mkdict
|
||||
#
|
||||
# Copyright (c) 1997, 1998, 1999 Joseph Samuel Myers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
boggle_mkdict_CLEANFILES := dictionary
|
||||
|
||||
# boggle_mkdict_DICTSRC is the dictionary that will be used to construct the
|
||||
# word list used by boggle.
|
||||
boggle_mkdict_DICTSRC := hangman/words
|
||||
boggle_mkdict_DICTSRC := $(DICTIONARY_SRC)
|
||||
|
||||
boggle_mkdict_DIRS := $(BOGGLE_DIR)
|
||||
boggle_mkdict_INCS := -Iboggle/boggle
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mkdict.c,v 1.3 1997/10/11 02:12:21 lukem Exp $ */
|
||||
/* $NetBSD: mkdict.c,v 1.8 2001/08/29 18:22:56 jsm Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@@ -36,17 +36,15 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__COPYRIGHT("@(#) Copyright (c) 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n");
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
static const char copyright[] __attribute__((__unused__)) =
|
||||
"@(#) Copyright (c) 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)mkdict.c 8.1 (Berkeley) 6/11/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: mkdict.c,v 1.3 1997/10/11 02:12:21 lukem Exp $");
|
||||
static const char rcsid[] __attribute__((__unused__)) =
|
||||
"$NetBSD: mkdict.c,v 1.8 2001/08/29 18:22:56 jsm Exp $";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -62,11 +60,10 @@ __RCSID("$NetBSD: mkdict.c,v 1.3 1997/10/11 02:12:21 lukem Exp $");
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <err.h>
|
||||
|
||||
#include "bog.h"
|
||||
|
||||
int main __P((int, char *[]));
|
||||
int main(int, char *[]);
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
@@ -85,7 +82,7 @@ main(argc, argv)
|
||||
for (nwords = 1;
|
||||
fgets(buf[current], MAXWORDLEN + 1, stdin) != NULL; ++nwords) {
|
||||
if ((p = strchr(buf[current], '\n')) == NULL) {
|
||||
warnx("word too long: %s", buf[current]);
|
||||
fprintf(stderr, "word too long: %s\n", buf[current]);
|
||||
while ((ch = getc(stdin)) != EOF && ch != '\n')
|
||||
;
|
||||
if (ch == EOF)
|
||||
@@ -125,6 +122,11 @@ main(argc, argv)
|
||||
prev = !prev;
|
||||
current = !current;
|
||||
}
|
||||
warnx("%d words", nwords);
|
||||
fprintf(stderr, "%d words\n", nwords);
|
||||
fflush(stdout);
|
||||
if (ferror(stdout)) {
|
||||
perror("error writing standard output");
|
||||
exit(1);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@@ -1,21 +1,9 @@
|
||||
# $NetBSD: Makefile,v 1.6 1998/04/13 14:14:39 lukem Exp $
|
||||
# $NetBSD: Makefile,v 1.10 2002/09/18 06:16:40 lukem Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/11/93
|
||||
|
||||
PROG= mkindex
|
||||
NOMAN= # defined
|
||||
|
||||
HOSTPROG= mkindex
|
||||
HOST_CPPFLAGS+= -I${.CURDIR}/../boggle
|
||||
NOMAN= noman
|
||||
|
||||
# XXX for "make depend"
|
||||
CPPFLAGS+=-I${.CURDIR}/../boggle
|
||||
|
||||
# only needed during build
|
||||
proginstall::
|
||||
|
||||
# Override these rules for cross-compilation
|
||||
.c.o:
|
||||
${HOST_COMPILE.c} ${.IMPSRC}
|
||||
|
||||
${PROG}: ${OBJS}
|
||||
${HOST_LINK.c} -o ${.TARGET} ${OBJS}
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
.include <bsd.hostprog.mk>
|
||||
|
||||
@@ -1,4 +1,30 @@
|
||||
# Makefrag - makefile fragment for boggle/mkindex
|
||||
#
|
||||
# Copyright (c) 1997, 1998 Joseph Samuel Myers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
boggle_mkindex_CLEANFILES := dictindex
|
||||
boggle_mkindex_DIRS := $(BOGGLE_DIR)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mkindex.c,v 1.4 1998/09/11 13:16:05 hubertf Exp $ */
|
||||
/* $NetBSD: mkindex.c,v 1.8 2000/07/31 11:29:48 simonb Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@@ -36,17 +36,15 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__COPYRIGHT("@(#) Copyright (c) 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n");
|
||||
#endif /* not lint */
|
||||
static const char copyright[] __attribute__((__unused__)) = "@(#) Copyright (c) 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)mkindex.c 8.1 (Berkeley) 6/11/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: mkindex.c,v 1.4 1998/09/11 13:16:05 hubertf Exp $");
|
||||
static const char rcsid[] __attribute__((__unused__)) =
|
||||
"$NetBSD: mkindex.c,v 1.8 2000/07/31 11:29:48 simonb Exp $";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -55,13 +53,13 @@ __RCSID("$NetBSD: mkindex.c,v 1.4 1998/09/11 13:16:05 hubertf Exp $");
|
||||
|
||||
#include "bog.h"
|
||||
|
||||
int main __P((void));
|
||||
char *nextword __P((FILE *, char *, int *, int *));
|
||||
int main(void);
|
||||
char *nextword(FILE *, char *, int *, int *);
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int clen, rlen, prev;
|
||||
int clen, rlen, prev, i;
|
||||
long off, start;
|
||||
char buf[MAXWORDLEN + 1];
|
||||
|
||||
@@ -69,14 +67,29 @@ main(void)
|
||||
off = start = 0L;
|
||||
while (nextword(stdin, buf, &clen, &rlen) != NULL) {
|
||||
if (*buf != prev) {
|
||||
/*
|
||||
* Boggle expects a full index even if the dictionary
|
||||
* had no words beginning with some letters.
|
||||
* So we write out entries for every letter from prev
|
||||
* to *buf.
|
||||
*/
|
||||
if (prev != '\0')
|
||||
printf("%c %6ld %6ld\n", prev, start, off - 1);
|
||||
for (i = (prev ? prev + 1 : 'a'); i < *buf; i++)
|
||||
printf("%c %6ld %6ld\n", i, off, off - 1);
|
||||
prev = *buf;
|
||||
start = off;
|
||||
}
|
||||
off += clen + 1;
|
||||
}
|
||||
printf("%c %6ld %6ld\n", prev, start, off - 1);
|
||||
for (i = prev + 1; i <= 'z'; i++)
|
||||
printf("%c %6ld %6ld\n", i, off, off - 1);
|
||||
fflush(stdout);
|
||||
if (ferror(stdout)) {
|
||||
perror("error writing standard output");
|
||||
exit(1);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,30 @@
|
||||
# Makefrag - makefile fragment for caesar
|
||||
#
|
||||
# Copyright (c) 1997, 1998, 1999 Joseph Samuel Myers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
caesar_DIRS := $(GAMESDIR) $(MAN6DIR)
|
||||
|
||||
@@ -11,6 +37,3 @@ caesar_install: caesar_all
|
||||
$(HIDE_GAME) rot13
|
||||
$(INSTALL_MANUAL) caesar/caesar.6
|
||||
$(INSTALL_MANUAL) caesar.6 rot13.6
|
||||
|
||||
#caesar_check: caesar_all
|
||||
# caesar/caesar <fortune/datfiles/fortunes-o.fake.rot13
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: caesar.6,v 1.6 1997/11/12 00:48:29 mrg Exp $
|
||||
.\" $NetBSD: caesar.6,v 1.8 2002/09/26 18:31:59 wiz Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1989, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@@ -39,14 +39,14 @@
|
||||
.Sh NAME
|
||||
.Nm caesar ,
|
||||
.Nm rot13
|
||||
.Nd decrypt caesar cyphers
|
||||
.Nd decrypt caesar ciphers
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Ar rotation
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility attempts to decrypt caesar cyphers using English letter frequency
|
||||
utility attempts to decrypt caesar ciphers using English letter frequency
|
||||
statistics.
|
||||
.Nm
|
||||
reads from the standard input and writes to the standard output.
|
||||
@@ -66,8 +66,7 @@ Their frequencies as a percentage are as follows:
|
||||
.Bd -filled -offset indent
|
||||
E(13), T(10.5), A(8.1), O(7.9), N(7.1), R(6.8), I(6.3), S(6.1), H(5.2),
|
||||
D(3.8), L(3.4), F(2.9), C(2.7), M(2.5), U(2.4), G(2),
|
||||
P(1.9), Y(1.9),
|
||||
W(1.5), B(1.4), V(.9), K(.4), X(.15), J(.13), Q(.11), Z(.07).
|
||||
P(1.9), Y(1.9), W(1.5), B(1.4), V(.9), K(.4), X(.15), J(.13), Q(.11), Z(.07).
|
||||
.Ed
|
||||
.Pp
|
||||
Rotated postings to
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# $NetBSD: rot13.sh,v 1.2 1995/03/21 15:08:23 cgd Exp $
|
||||
# $NetBSD: rot13.sh,v 1.6 2000/04/24 15:42:40 simonb Exp $
|
||||
#
|
||||
# Copyright (c) 1992, 1993
|
||||
# The Regents of the University of California. All rights reserved.
|
||||
|
||||
@@ -1,4 +1,30 @@
|
||||
# Makefrag - makefile fragment for canfield
|
||||
#
|
||||
# Copyright (c) 1998 Joseph Samuel Myers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
canfield_all:
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
# $NetBSD: Makefile,v 1.2 1997/10/03 10:25:35 mrg Exp $
|
||||
# $NetBSD: Makefile,v 1.3 1999/02/13 23:53:57 lukem Exp $
|
||||
|
||||
NOPROG= yes
|
||||
FILES= countmail
|
||||
FILESDIR= /usr/games
|
||||
FILESMODE= 555
|
||||
SCRIPTS= countmail
|
||||
SCRIPTSDIR= /usr/games
|
||||
MAN= countmail.6
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
@@ -1,4 +1,30 @@
|
||||
# Makefrag - makefile fragment for countmail
|
||||
#
|
||||
# Copyright (c) 1997, 1998 Joseph Samuel Myers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
countmail_DIRS := $(GAMESDIR) $(MAN6DIR)
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/bin/sh
|
||||
# $NetBSD: countmail,v 1.3 1998/08/15 09:16:27 mycroft Exp $
|
||||
# $NetBSD: countmail,v 1.5 2002/07/02 17:18:21 mycroft Exp $
|
||||
|
||||
#
|
||||
# Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
# Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This code is derived from software contributed to The NetBSD Foundation
|
||||
@@ -61,125 +61,103 @@ v=$1
|
||||
#done
|
||||
#exec 0<&-
|
||||
|
||||
result=
|
||||
set --
|
||||
g=0
|
||||
v=000$v
|
||||
|
||||
while :; do
|
||||
|
||||
case $v in
|
||||
0 | '') break ;;
|
||||
?) v=00$v ;;
|
||||
??) v=0$v ;;
|
||||
esac
|
||||
|
||||
case $v in
|
||||
'' | 0 | 00) break ;;
|
||||
*000) ;;
|
||||
*)
|
||||
case $g in
|
||||
0) ;;
|
||||
1) val=THOUSAND ;;
|
||||
2) val=MILLION ;;
|
||||
3) val=BILLION ;;
|
||||
4) val=TRILLION ;;
|
||||
5) val=QUADRILLION ;;
|
||||
6) val=QUINTILLION ;;
|
||||
7) val=SEXTILLION ;;
|
||||
8) val=SEPTILLION ;;
|
||||
0) x= ;;
|
||||
1) x=THOUSAND ;;
|
||||
2) x=MILLION ;;
|
||||
3) x=BILLION ;;
|
||||
4) x=TRILLION ;;
|
||||
5) x=QUADRILLION ;;
|
||||
6) x=QUINTILLION ;;
|
||||
7) x=SEXTILLION ;;
|
||||
8) x=SEPTILLION ;;
|
||||
*)
|
||||
echo "YOU HAVE TOO MUCH MAIL!" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
case $g in
|
||||
0) ;;
|
||||
*) result="$val $result" ;;
|
||||
case $v in
|
||||
*10) y=TEN ;;
|
||||
*11) y=ELEVEN ;;
|
||||
*12) y=TWELVE ;;
|
||||
*13) y=THIRTEEN ;;
|
||||
*14) y=FOURTEEN ;;
|
||||
*15) y=FIFTEEN ;;
|
||||
*16) y=SIXTEEN ;;
|
||||
*17) y=SEVENTEEN ;;
|
||||
*18) y=EIGHTEEN ;;
|
||||
*19) y=NINETEEN ;;
|
||||
*2?) y=TWENTY ;;
|
||||
*3?) y=THIRTY ;;
|
||||
*4?) y=FORTY ;;
|
||||
*5?) y=FIFTY ;;
|
||||
*6?) y=SIXTY ;;
|
||||
*7?) y=SEVENTY ;;
|
||||
*8?) y=EIGHTY ;;
|
||||
*9?) y=NINETY ;;
|
||||
*) y= ;;
|
||||
esac
|
||||
|
||||
case $v in
|
||||
*[01]? | *?0) ;;
|
||||
*) y=$y- ;;
|
||||
esac
|
||||
|
||||
case $v in
|
||||
*1?) ;;
|
||||
*1) y=${y}ONE ;;
|
||||
*2) y=${y}TWO ;;
|
||||
*3) y=${y}THREE ;;
|
||||
*4) y=${y}FOUR ;;
|
||||
*5) y=${y}FIVE ;;
|
||||
*6) y=${y}SIX ;;
|
||||
*7) y=${y}SEVEN ;;
|
||||
*8) y=${y}EIGHT ;;
|
||||
*9) y=${y}NINE ;;
|
||||
esac
|
||||
|
||||
case $v in
|
||||
*1??) z=ONE ;;
|
||||
*2??) z=TWO ;;
|
||||
*3??) z=THREE ;;
|
||||
*4??) z=FOUR ;;
|
||||
*5??) z=FIVE ;;
|
||||
*6??) z=SIX ;;
|
||||
*7??) z=SEVEN ;;
|
||||
*8??) z=EIGHT ;;
|
||||
*9??) z=NINE ;;
|
||||
*) z= ;;
|
||||
esac
|
||||
|
||||
set $z ${z:+HUNDRED} $y $x $*
|
||||
;;
|
||||
esac
|
||||
|
||||
g=$(($g + 1))
|
||||
|
||||
case $v in
|
||||
*?10) val=TEN ;;
|
||||
*?11) val=ELEVEN ;;
|
||||
*?12) val=TWELVE ;;
|
||||
*?13) val=THIRTEEN ;;
|
||||
*?14) val=FOURTEEN ;;
|
||||
*?15) val=FIFTEEN ;;
|
||||
*?16) val=SIXTEEN ;;
|
||||
*?17) val=SEVENTEEN ;;
|
||||
*?18) val=EIGHTEEN ;;
|
||||
*?19) val=NINETEEN ;;
|
||||
*)
|
||||
case $v in
|
||||
*?2?) val=TWENTY ;;
|
||||
*?3?) val=THIRTY ;;
|
||||
*?4?) val=FOURTY ;;
|
||||
*?5?) val=FIFTY ;;
|
||||
*?6?) val=SIXTY ;;
|
||||
*?7?) val=SEVENTY ;;
|
||||
*?8?) val=EIGHTY ;;
|
||||
*?9?) val=NINETY ;;
|
||||
*) val= ;;
|
||||
esac
|
||||
|
||||
case $v in
|
||||
*?0? | *??0) ;;
|
||||
*) val=${val}- ;;
|
||||
esac
|
||||
|
||||
case $v in
|
||||
*??1) val=${val}ONE ;;
|
||||
*??2) val=${val}TWO ;;
|
||||
*??3) val=${val}THREE ;;
|
||||
*??4) val=${val}FOUR ;;
|
||||
*??5) val=${val}FIVE ;;
|
||||
*??6) val=${val}SIX ;;
|
||||
*??7) val=${val}SEVEN ;;
|
||||
*??8) val=${val}EIGHT ;;
|
||||
*??9) val=${val}NINE ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
case $v in
|
||||
*?00) ;;
|
||||
*) result="$val $result" ;;
|
||||
esac
|
||||
|
||||
case $v in
|
||||
*1??) val=ONE ;;
|
||||
*2??) val=TWO ;;
|
||||
*3??) val=THREE ;;
|
||||
*4??) val=FOUR ;;
|
||||
*5??) val=FIVE ;;
|
||||
*6??) val=SIX ;;
|
||||
*7??) val=SEVEN ;;
|
||||
*8??) val=EIGHT ;;
|
||||
*9??) val=NINE ;;
|
||||
esac
|
||||
|
||||
case $v in
|
||||
*0??) ;;
|
||||
*) result="$val HUNDRED $result" ;;
|
||||
esac
|
||||
|
||||
v=${v%%???}
|
||||
|
||||
done
|
||||
|
||||
plural=S
|
||||
p=S
|
||||
|
||||
case "$result" in
|
||||
"") result=ZERO ;;
|
||||
"ONE ") plural= ;;
|
||||
case "$*" in
|
||||
"") set ZERO ;;
|
||||
ONE) p= ;;
|
||||
esac
|
||||
|
||||
set -- $result
|
||||
|
||||
echo "$*!
|
||||
|
||||
$* NEW MAIL MESSAGE$plural!
|
||||
$* MAIL MESSAGE$p!
|
||||
|
||||
HAHAHAHAHA!"
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# $NetBSD: Makefile,v 1.10 1998/02/18 22:37:31 jtc Exp $
|
||||
# $NetBSD: Makefile,v 1.12 1999/02/13 02:54:21 lukem Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 5/31/93
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
PROG= cribbage
|
||||
DPADD= ${LIBCURSES}
|
||||
LDADD= -lcurses
|
||||
@@ -8,8 +10,10 @@ SRCS= extern.c crib.c cards.c instr.c io.c score.c support.c
|
||||
MAN= cribbage.6
|
||||
HIDEGAME=hidegame
|
||||
SETGIDGAME=yes
|
||||
.if ${MKSHARE} != "no"
|
||||
FILES= cribbage.n
|
||||
FILESNAME=cribbage.instr
|
||||
FILESDIR=/usr/share/games
|
||||
.endif
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
@@ -1,4 +1,30 @@
|
||||
# Makefrag - makefile fragment for cribbage
|
||||
#
|
||||
# Copyright (c) 1997, 1998 Joseph Samuel Myers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
cribbage_DIRS := $(GAMESDIR) $(MAN6DIR) $(shell dirname $(CRIBBAGE_INSTRFILE))
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cards.c,v 1.4 1997/10/10 12:32:22 lukem Exp $ */
|
||||
/* $NetBSD: cards.c,v 1.6 1999/09/30 18:01:32 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.4 1997/10/10 12:32:22 lukem Exp $");
|
||||
__RCSID("$NetBSD: cards.c,v 1.6 1999/09/30 18:01:32 jsm Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: crib.c,v 1.10 1998/08/30 09:19:37 veego Exp $ */
|
||||
/* $NetBSD: crib.c,v 1.16 2001/12/06 11:59:45 blymn Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1993
|
||||
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)crib.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: crib.c,v 1.10 1998/08/30 09:19:37 veego Exp $");
|
||||
__RCSID("$NetBSD: crib.c,v 1.16 2001/12/06 11:59:45 blymn Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -76,6 +76,8 @@ main(argc, argv)
|
||||
f = fopen(_PATH_LOG, "a");
|
||||
if (f == NULL)
|
||||
warn("fopen %s", _PATH_LOG);
|
||||
if (f != NULL && fileno(f) < 3)
|
||||
exit(1);
|
||||
|
||||
/* Revoke setgid privileges */
|
||||
setregid(getgid(), getgid());
|
||||
@@ -110,7 +112,7 @@ main(argc, argv)
|
||||
|
||||
initscr();
|
||||
(void)signal(SIGINT, rint);
|
||||
crmode();
|
||||
cbreak();
|
||||
noecho();
|
||||
|
||||
Playwin = subwin(stdscr, PLAY_Y, PLAY_X, 0, 0);
|
||||
@@ -130,7 +132,7 @@ main(argc, argv)
|
||||
mvcur(0, COLS - 1, LINES - 1, 0);
|
||||
fflush(stdout);
|
||||
instructions();
|
||||
crmode();
|
||||
cbreak();
|
||||
noecho();
|
||||
clear();
|
||||
refresh();
|
||||
@@ -194,8 +196,6 @@ makeboard()
|
||||
void
|
||||
gamescore()
|
||||
{
|
||||
extern int Lastscore[];
|
||||
|
||||
if (pgames || cgames) {
|
||||
mvprintw(SCORE_Y + 1, SCORE_X + 28, "Games: %3d", pgames);
|
||||
mvprintw(SCORE_Y + 7, SCORE_X + 28, "Games: %3d", cgames);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: cribbage.6,v 1.5 1997/10/10 12:32:26 lukem Exp $
|
||||
.\" $NetBSD: cribbage.6,v 1.10 2002/09/30 12:43:22 wiz Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1980, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@@ -45,9 +45,9 @@
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
plays the card game cribbage, with the program playing one hand
|
||||
and the user the other. The program will initially ask the user if
|
||||
the rules of the game are needed \- if so, it will print out
|
||||
the appropriate section from
|
||||
and the user the other.
|
||||
The program will initially ask the user if the rules of the game are
|
||||
needed \(en if so, it will print out the appropriate section from
|
||||
.Em According to Hoyle
|
||||
with
|
||||
.Xr more 1 .
|
||||
@@ -57,10 +57,10 @@ options include:
|
||||
.Bl -tag -width indent
|
||||
.It Fl e
|
||||
When the player makes a mistake scoring his hand or crib, provide an
|
||||
explanation of the correct score. (This is especially useful for
|
||||
beginning players.)
|
||||
explanation of the correct score.
|
||||
(This is especially useful for beginning players.)
|
||||
.It Fl q
|
||||
Print a shorter form of all messages \- this is only recommended for
|
||||
Print a shorter form of all messages \(en this is only recommended for
|
||||
users who have played the game without specifying this option.
|
||||
.It Fl r
|
||||
Instead of asking the player to cut the deck, the program will randomly
|
||||
@@ -72,24 +72,23 @@ first asks the player whether he wishes to play a short game (
|
||||
.Dq once around ,
|
||||
to 61) or a long game (
|
||||
.Dq twice around ,
|
||||
to 121). A
|
||||
response of
|
||||
to 121).
|
||||
A response of
|
||||
.Sq Ic s
|
||||
will result in a short game, any other response will
|
||||
play a long game.
|
||||
will result in a short game, any other response will play a long game.
|
||||
.Pp
|
||||
At the start of the first game, the program
|
||||
asks the player to cut the deck to determine who gets the
|
||||
first crib. The user should respond with a number between 0 and
|
||||
51, indicating how many cards down the deck is to be cut. The player
|
||||
who cuts the lower ranked card gets the first crib.
|
||||
asks the player to cut the deck to determine who gets the first crib.
|
||||
The user should respond with a number between 0 and
|
||||
51, indicating how many cards down the deck is to be cut.
|
||||
The player who cuts the lower ranked card gets the first crib.
|
||||
If more than one game is played, the
|
||||
loser of the previous game gets the first crib in the current game.
|
||||
.Pp
|
||||
For each hand, the program first prints the player's hand,
|
||||
whose crib it is, and then asks the player
|
||||
to discard two cards into the crib. The cards are prompted for
|
||||
one per line, and are typed as explained below.
|
||||
to discard two cards into the crib.
|
||||
The cards are prompted for one per line, and are typed as explained below.
|
||||
.Pp
|
||||
After discarding, the program cuts the deck (if it is the player's
|
||||
crib) or asks the player to cut the deck (if it's its crib); in the latter
|
||||
@@ -98,11 +97,12 @@ how far down the remaining 40 cards are to be cut.
|
||||
.Pp
|
||||
After cutting the deck, play starts with the non-dealer (the person
|
||||
who doesn't have the crib) leading the first card.
|
||||
Play continues, as per cribbage, until all cards are exhausted. The
|
||||
program keeps track of the scoring of all points and the total of
|
||||
Play continues, as per cribbage, until all cards are exhausted.
|
||||
The program keeps track of the scoring of all points and the total of
|
||||
the cards on the table.
|
||||
.Pp
|
||||
After play, the hands are scored. The program requests the player to
|
||||
After play, the hands are scored.
|
||||
The program requests the player to
|
||||
score his hand (and the crib, if it is his) by printing out the
|
||||
appropriate cards (and the cut card enclosed in brackets).
|
||||
Play continues until one player reaches the game limit (61 or 121).
|
||||
@@ -111,7 +111,8 @@ A carriage return when a numeric input is expected is equivalent
|
||||
to typing the lowest legal value; when cutting the deck this
|
||||
is equivalent to choosing the top card.
|
||||
.Pp
|
||||
Cards are specified as rank followed by suit. The ranks may be specified
|
||||
Cards are specified as rank followed by suit.
|
||||
The ranks may be specified
|
||||
as one of:
|
||||
.Sq a ,
|
||||
.Sq 2 ,
|
||||
@@ -159,7 +160,8 @@ A card may be specified as:
|
||||
or:
|
||||
.Dq Ao rank Ac of Aq suit .
|
||||
If the single letter rank and suit designations are used, the space
|
||||
separating the suit and rank may be left out. Also, if only one card
|
||||
separating the suit and rank may be left out.
|
||||
Also, if only one card
|
||||
of the desired rank is playable, typing the rank is sufficient.
|
||||
For example, if your hand was
|
||||
.Dq 2H, 4D, 5C, 6H, JC, and KD
|
||||
@@ -177,7 +179,7 @@ the following could be typed:
|
||||
.Sq king diamonds ,
|
||||
.Sq king of diamonds .
|
||||
.Sh FILES
|
||||
.Bl -tag -width @gamesdir@/cribbage -compact
|
||||
.Bl -tag -width @cribbage_instrfile@ -compact
|
||||
.It Pa @gamesdir@/cribbage
|
||||
.It Pa @cribbage_scorefile@
|
||||
.It Pa @cribbage_instrfile@
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cribbage.h,v 1.4 1998/09/13 15:27:27 hubertf Exp $ */
|
||||
/* $NetBSD: cribbage.h,v 1.8 2002/12/06 01:48:24 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@@ -59,9 +59,10 @@ extern BOOLEAN rflag; /* if all cuts random */
|
||||
extern BOOLEAN quiet; /* if suppress random mess */
|
||||
extern BOOLEAN playing; /* currently playing game */
|
||||
|
||||
extern char expl[]; /* string for explanation */
|
||||
extern char explan[]; /* string for explanation */
|
||||
|
||||
void addmsg __P((const char *, ...));
|
||||
void addmsg __P((const char *, ...))
|
||||
__attribute__((__format__(__printf__, 1, 2)));
|
||||
int adjust __P((const CARD [], CARD));
|
||||
int anymove __P((const CARD [], int, int));
|
||||
int anysumto __P((const CARD [], int, int, int));
|
||||
@@ -89,7 +90,8 @@ int is_one __P((CARD, const CARD [], int));
|
||||
void makeboard __P((void));
|
||||
void makedeck __P((CARD []));
|
||||
void makeknown __P((const CARD [], int));
|
||||
void msg __P((const char *, ...));
|
||||
void msg __P((const char *, ...))
|
||||
__attribute__((__format__(__printf__, 1, 2)));
|
||||
int msgcard __P((CARD, BOOLEAN));
|
||||
int msgcrd __P((CARD, BOOLEAN, const char *, BOOLEAN));
|
||||
int number __P((int, int, const char *));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: extern.c,v 1.4 1997/10/10 12:32:29 lukem Exp $ */
|
||||
/* $NetBSD: extern.c,v 1.6 2002/12/06 01:48:24 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1993
|
||||
@@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)extern.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: extern.c,v 1.4 1997/10/10 12:32:29 lukem Exp $");
|
||||
__RCSID("$NetBSD: extern.c,v 1.6 2002/12/06 01:48:24 thorpej Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -52,7 +52,7 @@ BOOLEAN iwon = FALSE; /* if comp won last game */
|
||||
BOOLEAN quiet = FALSE; /* if suppress random mess */
|
||||
BOOLEAN rflag = FALSE; /* if all cuts random */
|
||||
|
||||
char expl[128]; /* explanation */
|
||||
char explan[128]; /* explanation */
|
||||
|
||||
int cgames = 0; /* number games comp won */
|
||||
int cscore = 0; /* comp score in this game */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: instr.c,v 1.7 1997/10/11 02:44:31 lukem Exp $ */
|
||||
/* $NetBSD: instr.c,v 1.9 1999/11/09 15:06:32 drochner Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
@@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)instr.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: instr.c,v 1.7 1997/10/11 02:44:31 lukem Exp $");
|
||||
__RCSID("$NetBSD: instr.c,v 1.9 1999/11/09 15:06:32 drochner Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -90,7 +90,7 @@ instructions()
|
||||
_exit(1);
|
||||
}
|
||||
execl("/bin/sh", "sh", "-c", path, NULL);
|
||||
warn("%s", "");
|
||||
warn(NULL);
|
||||
_exit(1);
|
||||
default:
|
||||
do {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: io.c,v 1.10 1997/10/10 12:32:32 lukem Exp $ */
|
||||
/* $NetBSD: io.c,v 1.15 2002/05/26 00:12:11 wiz Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1993
|
||||
@@ -38,24 +38,19 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: io.c,v 1.10 1997/10/10 12:32:32 lukem Exp $");
|
||||
__RCSID("$NetBSD: io.c,v 1.15 2002/05/26 00:12:11 wiz Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
#include <ctype.h>
|
||||
#include <curses.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
#include "deck.h"
|
||||
#include "cribbage.h"
|
||||
#include "cribcur.h"
|
||||
@@ -392,21 +387,11 @@ int Mpos = 0;
|
||||
static int Newpos = 0;
|
||||
|
||||
void
|
||||
#if __STDC__
|
||||
msg(const char *fmt, ...)
|
||||
#else
|
||||
msg(fmt, va_alist)
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
(void)vsprintf(&Msgbuf[Newpos], fmt, ap);
|
||||
Newpos = strlen(Msgbuf);
|
||||
va_end(ap);
|
||||
@@ -418,21 +403,11 @@ msg(fmt, va_alist)
|
||||
* Add things to the current message
|
||||
*/
|
||||
void
|
||||
#if __STDC__
|
||||
addmsg(const char *fmt, ...)
|
||||
#else
|
||||
addmsg(fmt, va_alist)
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
(void)vsprintf(&Msgbuf[Newpos], fmt, ap);
|
||||
Newpos = strlen(Msgbuf);
|
||||
va_end(ap);
|
||||
@@ -612,7 +587,7 @@ getline()
|
||||
|
||||
void
|
||||
rint(signo)
|
||||
int signo __attribute__((unused));
|
||||
int signo __attribute__((__unused__));
|
||||
{
|
||||
bye();
|
||||
exit(1);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: score.c,v 1.6 1998/08/30 09:19:37 veego Exp $ */
|
||||
/* $NetBSD: score.c,v 1.9 2002/12/06 01:48:24 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1993
|
||||
@@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: score.c,v 1.6 1998/08/30 09:19:37 veego Exp $");
|
||||
__RCSID("$NetBSD: score.c,v 1.9 2002/12/06 01:48:24 thorpej Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -122,7 +122,7 @@ scorehand(hand, starter, n, crb, do_explain)
|
||||
CARD h[(CINHAND + 1)];
|
||||
char buf[32];
|
||||
|
||||
expl[0] = '\0'; /* initialize explanation */
|
||||
explan[0] = '\0'; /* initialize explanation */
|
||||
score = 0;
|
||||
flag = TRUE;
|
||||
k = hand[0].suit;
|
||||
@@ -132,29 +132,29 @@ scorehand(hand, starter, n, crb, do_explain)
|
||||
if (hand[i].suit == starter.suit) {
|
||||
score++;
|
||||
if (do_explain)
|
||||
strcat(expl, "His Nobs");
|
||||
strcat(explan, "His Nobs");
|
||||
}
|
||||
h[i] = hand[i];
|
||||
}
|
||||
|
||||
if (flag && n >= CINHAND) {
|
||||
if (do_explain && expl[0] != '\0')
|
||||
strcat(expl, ", ");
|
||||
if (do_explain && explan[0] != '\0')
|
||||
strcat(explan, ", ");
|
||||
if (starter.suit == k) {
|
||||
score += 5;
|
||||
if (do_explain)
|
||||
strcat(expl, "Five-flush");
|
||||
strcat(explan, "Five-flush");
|
||||
} else
|
||||
if (!crb) {
|
||||
score += 4;
|
||||
if (do_explain && expl[0] != '\0')
|
||||
strcat(expl, ", Four-flush");
|
||||
if (do_explain && explan[0] != '\0')
|
||||
strcat(explan, ", Four-flush");
|
||||
else
|
||||
strcpy(expl, "Four-flush");
|
||||
strcpy(explan, "Four-flush");
|
||||
}
|
||||
}
|
||||
if (do_explain && expl[0] != '\0')
|
||||
strcat(expl, ", ");
|
||||
if (do_explain && explan[0] != '\0')
|
||||
strcat(explan, ", ");
|
||||
h[n] = starter;
|
||||
sorthand(h, n + 1); /* sort by rank */
|
||||
i = 2 * fifteens(h, n + 1);
|
||||
@@ -162,9 +162,9 @@ scorehand(hand, starter, n, crb, do_explain)
|
||||
if (do_explain) {
|
||||
if (i > 0) {
|
||||
(void) sprintf(buf, "%d points in fifteens", i);
|
||||
strcat(expl, buf);
|
||||
strcat(explan, buf);
|
||||
} else
|
||||
strcat(expl, "No fifteens");
|
||||
strcat(explan, "No fifteens");
|
||||
}
|
||||
i = pairuns(h, n + 1);
|
||||
score += i;
|
||||
@@ -172,9 +172,9 @@ scorehand(hand, starter, n, crb, do_explain)
|
||||
if (i > 0) {
|
||||
(void) sprintf(buf, ", %d points in pairs, %d in runs",
|
||||
pairpoints, runpoints);
|
||||
strcat(expl, buf);
|
||||
strcat(explan, buf);
|
||||
} else
|
||||
strcat(expl, ", No pairs/runs");
|
||||
strcat(explan, ", No pairs/runs");
|
||||
}
|
||||
return (score);
|
||||
}
|
||||
@@ -354,7 +354,7 @@ pegscore(crd, tbl, n, sum)
|
||||
int
|
||||
adjust(cb, tnv)
|
||||
const CARD cb[];
|
||||
CARD tnv __attribute__((unused));
|
||||
CARD tnv __attribute__((__unused__));
|
||||
{
|
||||
long scr;
|
||||
int i, c0, c1;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: support.c,v 1.4 1997/10/10 12:32:36 lukem Exp $ */
|
||||
/* $NetBSD: support.c,v 1.6 2002/12/06 01:48:25 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1993
|
||||
@@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)support.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: support.c,v 1.4 1997/10/10 12:32:36 lukem Exp $");
|
||||
__RCSID("$NetBSD: support.c,v 1.6 2002/12/06 01:48:25 thorpej Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -152,7 +152,7 @@ plyrhand(hand, s)
|
||||
msg("You should have taken %d, not %d!", i, j);
|
||||
}
|
||||
if (explain)
|
||||
msg("Explanation: %s", expl);
|
||||
msg("Explanation: %s", explan);
|
||||
do_wait();
|
||||
} else
|
||||
win = chkscr(&pscore, i);
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
# $NetBSD: Makefile,v 1.8 1997/11/19 08:23:37 mrg Exp $
|
||||
# $NetBSD: Makefile,v 1.11 2002/09/18 03:23:00 lukem Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 5/31/93
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
# -DLOG log games
|
||||
PROG= dm
|
||||
SRCS= dm.c utmpentry.c
|
||||
MAN= dm.8 dm.conf.5
|
||||
# shouldn't be necessary; just in case.
|
||||
BINGRP= games
|
||||
BINMODE=2555
|
||||
|
||||
.PATH.c: ${NETBSDSRCDIR}/usr.bin/who
|
||||
CPPFLAGS+=-I${NETBSDSRCDIR}/usr.bin/who -DSUPPORT_UTMPX -DSUPPORT_UTMP
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
28
dm/Makefrag
28
dm/Makefrag
@@ -1,7 +1,33 @@
|
||||
# Makefrag - makefile fragment for dm
|
||||
#
|
||||
# Copyright (c) 1997, 1998, 1999 Joseph Samuel Myers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
# Add -DLOG if you want logging
|
||||
dm_DEFS := # -DLOG
|
||||
dm_DEFS := $(GETLOADAVG_DEFS) # -DLOG
|
||||
dm_DIRS := $(GAMESDIR) $(MAN8DIR) $(MAN5DIR)
|
||||
|
||||
dm_all: dm/dm dm/dm.8 dm/dm.conf.5
|
||||
|
||||
@@ -10,4 +10,4 @@ Add -DLOG to the DEFS in the Makefile if you want logging of games
|
||||
playing.
|
||||
|
||||
Joseph S. Myers
|
||||
jsm28@cam.ac.uk
|
||||
jsm@polyomino.org.uk
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: dm.8,v 1.6 1998/06/08 12:41:41 lukem Exp $
|
||||
.\" $NetBSD: dm.8,v 1.8 2003/02/25 10:34:45 wiz Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1987, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@@ -48,7 +48,7 @@ is a program used to regulate game playing.
|
||||
.Nm
|
||||
expects to be invoked with the name of a game that a user wishes to play.
|
||||
This is done by creating symbolic links to
|
||||
.Nm "" ,
|
||||
.Nm ,
|
||||
in the directory
|
||||
.Pa @gamesdir@
|
||||
for all of the regulated games.
|
||||
@@ -63,8 +63,7 @@ program.
|
||||
determines if the requested game is available and, if so, runs it.
|
||||
The file
|
||||
.Pa @dm_configfile@
|
||||
controls the conditions under which games may
|
||||
be run.
|
||||
controls the conditions under which games may be run.
|
||||
.Pp
|
||||
The file
|
||||
.Pa @dm_nogamesfile@
|
||||
@@ -99,7 +98,7 @@ running the games setgid
|
||||
First, all games that allow users to run
|
||||
.Ux
|
||||
commands should carefully
|
||||
set both the real and effective group id's immediately before executing
|
||||
set both the real and effective group ids immediately before executing
|
||||
those commands.
|
||||
Probably more important is that
|
||||
.Nm
|
||||
|
||||
12
dm/dm.c
12
dm/dm.c
@@ -1,4 +1,5 @@
|
||||
/* $NetBSD: dm.c,v 1.11 1998/09/13 15:27:27 hubertf Exp $ */
|
||||
/* $NetBSD: dm.c,v 1.17 2002/08/02 03:06:24 christos Exp $ */
|
||||
/* For Linux: still using old utmp interface from version 1.16. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1993
|
||||
@@ -43,7 +44,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)dm.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: dm.c,v 1.11 1998/09/13 15:27:27 hubertf Exp $");
|
||||
__RCSID("$NetBSD: dm.c,v 1.17 2002/08/02 03:06:24 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -83,7 +84,7 @@ int users __P((void));
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc __attribute__((unused));
|
||||
int argc __attribute__((__unused__));
|
||||
char *argv[];
|
||||
{
|
||||
char *cp;
|
||||
@@ -116,10 +117,7 @@ play(args)
|
||||
{
|
||||
char pbuf[MAXPATHLEN];
|
||||
|
||||
(void)strncpy(pbuf, _PATH_HIDE, sizeof(pbuf) - 1);
|
||||
(void)strncpy(pbuf + sizeof(_PATH_HIDE) - 1, game,
|
||||
sizeof(pbuf) - sizeof(_PATH_HIDE) - 1);
|
||||
pbuf[sizeof(pbuf) - 1] = '\0';
|
||||
snprintf(pbuf, sizeof(pbuf), "%s%s", _PATH_HIDE, game);
|
||||
if (priority > 0) /* < 0 requires root */
|
||||
(void)setpriority(PRIO_PROCESS, 0, priority);
|
||||
execv(pbuf, args);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: dm.conf.5,v 1.5 1998/04/29 18:16:01 fair Exp $
|
||||
.\" $NetBSD: dm.conf.5,v 1.7 2002/09/26 18:32:00 wiz Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1988, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@@ -35,7 +35,7 @@
|
||||
.\"
|
||||
.Dd May 31, 1993
|
||||
.Dt DM.CONF 5
|
||||
.Os BSD 4.2
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm dm.conf
|
||||
.Nd dungeon master configuration file
|
||||
@@ -59,8 +59,7 @@ Entries consist of two white-space separated fields: the string
|
||||
.Em badtty
|
||||
and the ttyname as returned by
|
||||
.Xr ttyname 3 .
|
||||
For example,
|
||||
to keep the uucp dialout,
|
||||
For example, to keep the uucp dialout,
|
||||
.Dq tty19 ,
|
||||
from being used for games, the entry would be:
|
||||
.Bd -literal -offset indent
|
||||
@@ -94,17 +93,14 @@ in no game limitation or priority based on that field.
|
||||
.Pp
|
||||
The game
|
||||
.Em default
|
||||
controls the settings for
|
||||
any game not otherwise listed, and must be the last
|
||||
controls the settings for any game not otherwise listed, and must be the last
|
||||
.Em game
|
||||
entry in the file.
|
||||
Priorities may not be negative.
|
||||
For example, the following entries
|
||||
limits the game
|
||||
For example, the following entries limits the game
|
||||
.Dq hack
|
||||
to running only when the system has 10 or less
|
||||
users and a load average of 5 or less; all other games may be run any time
|
||||
the system has 15 or less users.
|
||||
to running only when the system has 10 or less users and a load average of 5
|
||||
or less; all other games may be run any time the system has 15 or less users.
|
||||
.Bd -literal -offset indent
|
||||
game hack 5 10 *
|
||||
game default * 15 *
|
||||
|
||||
@@ -1,11 +1,23 @@
|
||||
# $NetBSD: Makefile,v 1.7 1997/10/22 04:43:26 lukem Exp $
|
||||
# $NetBSD: Makefile,v 1.10 2002/09/19 03:15:39 lukem Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 5/31/93
|
||||
|
||||
# For MKCRYPTO
|
||||
.include <bsd.own.mk>
|
||||
|
||||
PRIMES= ${NETBSDSRCDIR}/games/primes
|
||||
|
||||
PROG= factor
|
||||
SRCS= factor.c pr_tbl.c
|
||||
CPPFLAGS+=-I${.CURDIR}/../primes
|
||||
CPPFLAGS+=-I${PRIMES}
|
||||
|
||||
.if (${MKCRYPTO} != "no")
|
||||
CPPFLAGS+=-DHAVE_OPENSSL
|
||||
LDADD+= -lcrypto
|
||||
DPADD+= ${LIBCRYPTO}
|
||||
.endif
|
||||
|
||||
MAN= factor.6
|
||||
MLINKS+=factor.6 primes.6
|
||||
.PATH: ${.CURDIR}/../primes
|
||||
.PATH: ${PRIMES}
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
@@ -1,4 +1,30 @@
|
||||
# Makefrag - makefile fragment for factor
|
||||
#
|
||||
# Copyright (c) 1997, 1998, 1999 Joseph Samuel Myers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
# _GNU_SOURCE for isblank()
|
||||
factor_DEFS := -D_GNU_SOURCE
|
||||
@@ -11,6 +37,3 @@ factor_install: factor_all
|
||||
$(INSTALL_BINARY) factor/factor $(INSTALL_PREFIX)$(GAMESDIR)/factor
|
||||
$(HIDE_GAME) factor
|
||||
$(INSTALL_MANUAL) factor/factor.6
|
||||
|
||||
factor_check: factor_all
|
||||
factor/factor 69300
|
||||
|
||||
219
factor/factor.c
219
factor/factor.c
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: factor.c,v 1.8 1998/09/13 15:27:27 hubertf Exp $ */
|
||||
/* $NetBSD: factor.c,v 1.13 2002/06/18 23:07:36 simonb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)factor.c 8.4 (Berkeley) 5/4/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: factor.c,v 1.8 1998/09/13 15:27:27 hubertf Exp $");
|
||||
__RCSID("$NetBSD: factor.c,v 1.13 2002/06/18 23:07:36 simonb Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -69,14 +69,29 @@ __RCSID("$NetBSD: factor.c,v 1.8 1998/09/13 15:27:27 hubertf Exp $");
|
||||
* If no args are given, the list of numbers are read from stdin.
|
||||
*/
|
||||
|
||||
#include <err.h>
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef HAVE_OPENSSL
|
||||
#include <openssl/bn.h>
|
||||
#else
|
||||
typedef long BIGNUM;
|
||||
typedef u_long BN_ULONG;
|
||||
int BN_dec2bn(BIGNUM **a, const char *str);
|
||||
#define BN_new() ((BIGNUM *)calloc(sizeof(BIGNUM), 1))
|
||||
#define BN_is_zero(v) (*(v) == 0)
|
||||
#define BN_is_one(v) (*(v) == 1)
|
||||
#define BN_new() ((BIGNUM *)calloc(sizeof(BIGNUM), 1))
|
||||
#define BN_is_zero(v) (*(v) == 0)
|
||||
#define BN_is_one(v) (*(v) == 1)
|
||||
#define BN_mod_word(a, b) (*(a) % (b))
|
||||
#endif
|
||||
|
||||
#include "primes.h"
|
||||
|
||||
/*
|
||||
@@ -88,18 +103,51 @@ __RCSID("$NetBSD: factor.c,v 1.8 1998/09/13 15:27:27 hubertf Exp $");
|
||||
extern const ubig prime[];
|
||||
extern const ubig *pr_limit; /* largest prime in the prime array */
|
||||
|
||||
int main __P((int, char *[]));
|
||||
void pr_fact __P((ubig)); /* print factors of a value */
|
||||
void usage __P((void)) __attribute__((__noreturn__));
|
||||
#define PRIME_CHECKS 5
|
||||
|
||||
#ifdef HAVE_OPENSSL
|
||||
BN_CTX *ctx; /* just use a global context */
|
||||
#endif
|
||||
|
||||
int main(int, char *[]);
|
||||
void pr_fact(BIGNUM *); /* print factors of a value */
|
||||
void BN_print_dec_fp(FILE *, const BIGNUM *);
|
||||
void usage(void) __attribute__((__noreturn__));
|
||||
#ifdef HAVE_OPENSSL
|
||||
void pollard_pminus1(BIGNUM *); /* print factors for big numbers */
|
||||
#else
|
||||
char *BN_bn2dec(const BIGNUM *);
|
||||
BN_ULONG BN_div_word(BIGNUM *, BN_ULONG);
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef HAVE_OPENSSL
|
||||
int
|
||||
BN_dec2bn(BIGNUM **a, const char *str)
|
||||
{
|
||||
char *p;
|
||||
|
||||
errno = 0;
|
||||
**a = strtoul(str, &p, 10);
|
||||
if (errno)
|
||||
err(1, "%s", str);
|
||||
return (*p == '\n' || *p == '\0');
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
ubig val;
|
||||
BIGNUM *val;
|
||||
int ch;
|
||||
char *p, buf[100]; /* > max number of digits. */
|
||||
char *p, buf[LINE_MAX]; /* > max number of digits. */
|
||||
|
||||
#ifdef HAVE_OPENSSL
|
||||
ctx = BN_CTX_new();
|
||||
#endif
|
||||
val = BN_new();
|
||||
if (val == NULL)
|
||||
errx(1, "can't initialise bignum");
|
||||
|
||||
/* Revoke setgid privileges */
|
||||
setregid(getgid(), getgid());
|
||||
@@ -126,12 +174,8 @@ main(argc, argv)
|
||||
continue;
|
||||
if (*p == '-')
|
||||
errx(1, "negative numbers aren't permitted.");
|
||||
errno = 0;
|
||||
val = strtoul(buf, &p, 10);
|
||||
if (errno)
|
||||
err(1, "%s", buf);
|
||||
if (*p != '\n')
|
||||
errx(1, "%s: illegal numeric format.", buf);
|
||||
if (BN_dec2bn(&val, buf) == 0)
|
||||
errx(1, "%s: illegal numeric format.", argv[0]);
|
||||
pr_fact(val);
|
||||
}
|
||||
/* Factor the arguments. */
|
||||
@@ -139,11 +183,7 @@ main(argc, argv)
|
||||
for (; *argv != NULL; ++argv) {
|
||||
if (argv[0][0] == '-')
|
||||
errx(1, "negative numbers aren't permitted.");
|
||||
errno = 0;
|
||||
val = strtoul(argv[0], &p, 10);
|
||||
if (errno)
|
||||
err(1, "%s", argv[0]);
|
||||
if (*p != '\0')
|
||||
if (BN_dec2bn(&val, argv[0]) == 0)
|
||||
errx(1, "%s: illegal numeric format.", argv[0]);
|
||||
pr_fact(val);
|
||||
}
|
||||
@@ -164,49 +204,152 @@ main(argc, argv)
|
||||
* Factors are printed with leading tabs.
|
||||
*/
|
||||
void
|
||||
pr_fact(val)
|
||||
ubig val; /* Factor this value. */
|
||||
pr_fact(BIGNUM *val)
|
||||
{
|
||||
const ubig *fact; /* The factor found. */
|
||||
|
||||
/* Firewall - catch 0 and 1. */
|
||||
if (val == 0) /* Historical practice; 0 just exits. */
|
||||
if (BN_is_zero(val)) /* Historical practice; 0 just exits. */
|
||||
exit(0);
|
||||
if (val == 1) {
|
||||
(void)printf("1: 1\n");
|
||||
if (BN_is_one(val)) {
|
||||
printf("1: 1\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Factor value. */
|
||||
(void)printf("%lu:", val);
|
||||
for (fact = &prime[0]; val > 1; ++fact) {
|
||||
|
||||
BN_print_dec_fp(stdout, val);
|
||||
putchar(':');
|
||||
for (fact = &prime[0]; !BN_is_one(val); ++fact) {
|
||||
/* Look for the smallest factor. */
|
||||
do {
|
||||
if (val % (long)*fact == 0)
|
||||
if (BN_mod_word(val, (BN_ULONG)*fact) == 0)
|
||||
break;
|
||||
} while (++fact <= pr_limit);
|
||||
|
||||
/* Watch for primes larger than the table. */
|
||||
if (fact > pr_limit) {
|
||||
(void)printf(" %lu", val);
|
||||
#ifdef HAVE_OPENSSL
|
||||
BIGNUM *bnfact;
|
||||
|
||||
bnfact = BN_new();
|
||||
BN_set_word(bnfact, *(fact - 1));
|
||||
BN_sqr(bnfact, bnfact, ctx);
|
||||
if (BN_cmp(bnfact, val) > 0) {
|
||||
putchar(' ');
|
||||
BN_print_dec_fp(stdout, val);
|
||||
} else
|
||||
pollard_pminus1(val);
|
||||
#else
|
||||
printf(" %s", BN_bn2dec(val));
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
/* Divide factor out until none are left. */
|
||||
do {
|
||||
(void)printf(" %lu", *fact);
|
||||
val /= (long)*fact;
|
||||
} while ((val % (long)*fact) == 0);
|
||||
printf(" %lu", *fact);
|
||||
BN_div_word(val, (BN_ULONG)*fact);
|
||||
} while (BN_mod_word(val, (BN_ULONG)*fact) == 0);
|
||||
|
||||
/* Let the user know we're doing something. */
|
||||
(void)fflush(stdout);
|
||||
fflush(stdout);
|
||||
}
|
||||
(void)putchar('\n');
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
/*
|
||||
* Sigh.. No _decimal_ output to file functions in BN.
|
||||
*/
|
||||
void
|
||||
BN_print_dec_fp(FILE *fp, const BIGNUM *num)
|
||||
{
|
||||
char *buf;
|
||||
|
||||
buf = BN_bn2dec(num);
|
||||
if (buf == NULL)
|
||||
return; /* XXX do anything here? */
|
||||
fprintf(fp, buf);
|
||||
free(buf);
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
(void)fprintf(stderr, "usage: factor [value ...]\n");
|
||||
fprintf(stderr, "usage: factor [value ...]\n");
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef HAVE_OPENSSL
|
||||
/* pollard rho, algorithm from Jim Gillogly, May 2000 */
|
||||
|
||||
void
|
||||
pollard_pminus1(BIGNUM *val)
|
||||
{
|
||||
BIGNUM *base, *num, *i, *x;
|
||||
|
||||
base = BN_new();
|
||||
num = BN_new();
|
||||
i = BN_new();
|
||||
x = BN_new();
|
||||
|
||||
BN_set_word(i, 2);
|
||||
BN_set_word(base, 2);
|
||||
|
||||
for (;;) {
|
||||
BN_mod_exp(base, base, i, val, ctx);
|
||||
|
||||
BN_copy(x, base);
|
||||
BN_sub_word(x, 1);
|
||||
BN_gcd(x, x, val, ctx);
|
||||
|
||||
if (!BN_is_one(x)) {
|
||||
if (BN_is_prime(x, PRIME_CHECKS, NULL, NULL,
|
||||
NULL) == 1) {
|
||||
putchar(' ');
|
||||
BN_print_dec_fp(stdout, x);
|
||||
} else
|
||||
pollard_pminus1(x);
|
||||
fflush(stdout);
|
||||
|
||||
BN_div(num, NULL, val, x, ctx);
|
||||
if (BN_is_one(num))
|
||||
return;
|
||||
if (BN_is_prime(num, PRIME_CHECKS, NULL, NULL,
|
||||
NULL) == 1) {
|
||||
putchar(' ');
|
||||
BN_print_dec_fp(stdout, num);
|
||||
fflush(stdout);
|
||||
return;
|
||||
}
|
||||
BN_copy(val, num);
|
||||
}
|
||||
BN_add_word(i, 1);
|
||||
}
|
||||
}
|
||||
#else
|
||||
char *
|
||||
BN_bn2dec(const BIGNUM *val)
|
||||
{
|
||||
char *buf;
|
||||
|
||||
buf = malloc(100);
|
||||
if (!buf)
|
||||
return buf;
|
||||
snprintf(buf, 100, "%ld", (long)*val);
|
||||
return buf;
|
||||
}
|
||||
|
||||
BN_ULONG
|
||||
BN_div_word(BIGNUM *a, BN_ULONG b)
|
||||
{
|
||||
BN_ULONG mod;
|
||||
|
||||
mod = *a % b;
|
||||
*a /= b;
|
||||
return mod;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# $NetBSD: Makefile,v 1.8 1997/03/24 22:15:42 christos Exp $
|
||||
# $NetBSD: Makefile,v 1.10 1999/02/13 02:54:21 lukem Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 5/31/93
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
PROG= fish
|
||||
MAN= fish.6
|
||||
HIDEGAME=hidegame
|
||||
.if ${MKSHARE} != "no"
|
||||
FILES=fish.instr
|
||||
FILESDIR=/usr/share/games
|
||||
.endif
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
@@ -1,4 +1,30 @@
|
||||
# Makefrag - makefile fragment for fish
|
||||
#
|
||||
# Copyright (c) 1997, 1998 Joseph Samuel Myers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
fish_DIRS := $(GAMESDIR) $(MAN6DIR) $(shell dirname $(FISH_INSTRFILE))
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: fish.6,v 1.5 1997/10/10 12:58:29 lukem Exp $
|
||||
.\" $NetBSD: fish.6,v 1.7 2001/04/02 22:42:38 wiz Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1990, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@@ -38,7 +38,8 @@
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm fish
|
||||
.Nd play ``Go Fish''
|
||||
.Nd play
|
||||
.Dq Go Fish
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl p
|
||||
|
||||
38
fish/fish.c
38
fish/fish.c
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fish.c,v 1.6 1998/09/13 15:27:27 hubertf Exp $ */
|
||||
/* $NetBSD: fish.c,v 1.13 2000/05/08 07:56:03 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
@@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)fish.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: fish.c,v 1.6 1998/09/13 15:27:27 hubertf Exp $");
|
||||
__RCSID("$NetBSD: fish.c,v 1.13 2000/05/08 07:56:03 mycroft Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -65,6 +65,7 @@ __RCSID("$NetBSD: fish.c,v 1.6 1998/09/13 15:27:27 hubertf Exp $");
|
||||
#define RANKS 13
|
||||
#define HANDSIZE 7
|
||||
#define CARDS 4
|
||||
#define TOTCARDS RANKS * CARDS
|
||||
|
||||
#define USER 1
|
||||
#define COMPUTER 0
|
||||
@@ -77,8 +78,9 @@ const char *const cards[] = {
|
||||
#define PRC(card) (void)printf(" %s", cards[card])
|
||||
|
||||
int promode;
|
||||
int asked[RANKS], comphand[RANKS], deck[RANKS];
|
||||
int asked[RANKS], comphand[RANKS], deck[TOTCARDS];
|
||||
int userasked[RANKS], userhand[RANKS];
|
||||
int curcard = TOTCARDS;
|
||||
|
||||
void chkwinner __P((int, const int *));
|
||||
int compmove __P((void));
|
||||
@@ -164,13 +166,13 @@ usermove()
|
||||
for (;;) {
|
||||
(void)printf("You ask me for: ");
|
||||
(void)fflush(stdout);
|
||||
if (fgets(buf, BUFSIZ, stdin) == NULL)
|
||||
if (fgets(buf, sizeof(buf), stdin) == NULL)
|
||||
exit(0);
|
||||
if (buf[0] == '\0')
|
||||
continue;
|
||||
if (buf[0] == '\n') {
|
||||
(void)printf("%d cards in my hand, %d in the pool.\n",
|
||||
countcards(comphand), countcards(deck));
|
||||
countcards(comphand), curcard);
|
||||
(void)printf("My books:");
|
||||
(void)countbooks(comphand);
|
||||
continue;
|
||||
@@ -270,9 +272,7 @@ drawcard(player, hand)
|
||||
{
|
||||
int card;
|
||||
|
||||
while (deck[card = nrandom(RANKS)] == 0);
|
||||
++hand[card];
|
||||
--deck[card];
|
||||
++hand[card = deck[--curcard]];
|
||||
if (player == USER || hand[card] == CARDS) {
|
||||
printplayer(player);
|
||||
(void)printf("drew %s", cards[card]);
|
||||
@@ -423,19 +423,21 @@ countbooks(hand)
|
||||
void
|
||||
init()
|
||||
{
|
||||
int i, rank;
|
||||
int i, j, temp;
|
||||
|
||||
for (i = 0; i < RANKS; ++i)
|
||||
deck[i] = CARDS;
|
||||
for (i = 0; i < HANDSIZE; ++i) {
|
||||
while (!deck[rank = nrandom(RANKS)]);
|
||||
++userhand[rank];
|
||||
--deck[rank];
|
||||
for (i = 0; i < TOTCARDS; ++i)
|
||||
deck[i] = i % RANKS;
|
||||
for (i = 0; i < TOTCARDS - 1; ++i) {
|
||||
j = nrandom(TOTCARDS-i);
|
||||
if (j == 0)
|
||||
continue;
|
||||
temp = deck[i];
|
||||
deck[i] = deck[i+j];
|
||||
deck[i+j] = temp;
|
||||
}
|
||||
for (i = 0; i < HANDSIZE; ++i) {
|
||||
while (!deck[rank = nrandom(RANKS)]);
|
||||
++comphand[rank];
|
||||
--deck[rank];
|
||||
++userhand[deck[--curcard]];
|
||||
++comphand[deck[--curcard]];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
# $NetBSD: Makefile,v 1.7 1997/10/22 04:56:11 lukem Exp $
|
||||
# $NetBSD: Makefile,v 1.9 2001/01/09 03:13:40 lukem Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 5/31/93
|
||||
|
||||
SUBDIR= fortune strfile datfiles
|
||||
|
||||
all-datfiles: all-strfile
|
||||
SUBDIR= fortune strfile .WAIT datfiles
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user