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)
|
||||
|
||||
Reference in New Issue
Block a user