summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--factor/Makefile4
-rw-r--r--factor/factor.611
-rw-r--r--factor/factor.c331
-rw-r--r--fish/Makefile6
-rw-r--r--fish/fish.611
-rw-r--r--fish/fish.c19
-rw-r--r--fish/pathnames.h9
-rw-r--r--fortune/Makefile4
-rw-r--r--fortune/Notes1
-rw-r--r--fortune/README1
-rw-r--r--fortune/datfiles/Makefile55
-rw-r--r--fortune/fortune/Makefile3
-rw-r--r--fortune/fortune/fortune.673
-rw-r--r--fortune/fortune/fortune.c157
-rw-r--r--fortune/fortune/pathnames.h9
-rw-r--r--fortune/strfile/Makefile4
-rw-r--r--fortune/strfile/strfile.816
-rw-r--r--fortune/strfile/strfile.c19
-rw-r--r--fortune/strfile/strfile.h9
-rw-r--r--fortune/tools/Do_spell1
-rw-r--r--fortune/tools/Do_troff1
-rw-r--r--fortune/tools/Troff.mac2
-rw-r--r--fortune/tools/do_sort1
-rw-r--r--fortune/unstr/Makefile4
-rw-r--r--fortune/unstr/unstr.c15
-rw-r--r--hack/COPYRIGHT2
-rw-r--r--hack/Makefile4
-rw-r--r--hack/Makequest2
-rw-r--r--hack/Original_READ_ME2
-rw-r--r--hack/READ_ME2
-rw-r--r--hack/alloc.c2
-rw-r--r--hack/config.h2
-rw-r--r--hack/date.h2
-rw-r--r--hack/def.edog.h2
-rw-r--r--hack/def.eshk.h2
-rw-r--r--hack/def.flag.h2
-rw-r--r--hack/def.func_tab.h2
-rw-r--r--hack/def.gen.h2
-rw-r--r--hack/def.gold.h2
-rw-r--r--hack/def.mkroom.h2
-rw-r--r--hack/def.monst.h2
-rw-r--r--hack/def.obj.h2
-rw-r--r--hack/def.objclass.h2
-rw-r--r--hack/def.objects.h2
-rw-r--r--hack/def.permonst.h2
-rw-r--r--hack/def.rm.h2
-rw-r--r--hack/def.trap.h2
-rw-r--r--hack/def.wseg.h2
-rw-r--r--hack/hack.66
-rw-r--r--hack/hack.Decl.c2
-rw-r--r--hack/hack.apply.c2
-rw-r--r--hack/hack.bones.c2
-rw-r--r--hack/hack.c2
-rw-r--r--hack/hack.cmd.c2
-rw-r--r--hack/hack.do.c2
-rw-r--r--hack/hack.do_name.c2
-rw-r--r--hack/hack.do_wear.c2
-rw-r--r--hack/hack.dog.c2
-rw-r--r--hack/hack.eat.c2
-rw-r--r--hack/hack.end.c2
-rw-r--r--hack/hack.engrave.c2
-rw-r--r--hack/hack.fight.c2
-rw-r--r--hack/hack.fix2
-rw-r--r--hack/hack.h2
-rw-r--r--hack/hack.invent.c2
-rw-r--r--hack/hack.ioctl.c2
-rw-r--r--hack/hack.lev.c2
-rw-r--r--hack/hack.main.c2
-rw-r--r--hack/hack.makemon.c2
-rw-r--r--hack/hack.mfndpos.h2
-rw-r--r--hack/hack.mhitu.c2
-rw-r--r--hack/hack.mklev.c2
-rw-r--r--hack/hack.mkmaze.c2
-rw-r--r--hack/hack.mkobj.c2
-rw-r--r--hack/hack.mkshop.c2
-rw-r--r--hack/hack.mon.c2
-rw-r--r--hack/hack.monst.c2
-rw-r--r--hack/hack.o_init.c2
-rw-r--r--hack/hack.objnam.c2
-rw-r--r--hack/hack.options.c2
-rw-r--r--hack/hack.pager.c2
-rw-r--r--hack/hack.potion.c2
-rw-r--r--hack/hack.pri.c2
-rw-r--r--hack/hack.read.c2
-rw-r--r--hack/hack.rip.c2
-rw-r--r--hack/hack.rumors.c2
-rw-r--r--hack/hack.save.c5
-rw-r--r--hack/hack.search.c2
-rw-r--r--hack/hack.sh1
-rw-r--r--hack/hack.shk.c2
-rw-r--r--hack/hack.shknam.c2
-rw-r--r--hack/hack.steal.c2
-rw-r--r--hack/hack.termcap.c2
-rw-r--r--hack/hack.timeout.c2
-rw-r--r--hack/hack.topl.c2
-rw-r--r--hack/hack.track.c2
-rw-r--r--hack/hack.trap.c2
-rw-r--r--hack/hack.tty.c11
-rw-r--r--hack/hack.u_init.c2
-rw-r--r--hack/hack.unix.c2
-rw-r--r--hack/hack.vault.c2
-rw-r--r--hack/hack.version.c2
-rw-r--r--hack/hack.wield.c2
-rw-r--r--hack/hack.wizard.c2
-rw-r--r--hack/hack.worm.c2
-rw-r--r--hack/hack.worn.c2
-rw-r--r--hack/hack.zap.c2
-rw-r--r--hack/makedefs.c2
-rw-r--r--hack/pathnames.h9
-rw-r--r--hack/rnd.c2
-rw-r--r--hangman/Makefile4
-rw-r--r--hangman/endgame.c27
-rw-r--r--hangman/extern.c13
-rw-r--r--hangman/getguess.c20
-rw-r--r--hangman/getword.c26
-rw-r--r--hangman/hangman.611
-rw-r--r--hangman/hangman.h9
-rw-r--r--hangman/main.c19
-rw-r--r--hangman/pathnames.h9
-rw-r--r--hangman/playgame.c13
-rw-r--r--hangman/prdata.c13
-rw-r--r--hangman/prman.c13
-rw-r--r--hangman/prword.c13
-rw-r--r--hangman/setup.c13
-rw-r--r--larn/COPYRIGHT2
-rw-r--r--larn/Fixed.Bugs2
-rw-r--r--larn/Makefile14
-rw-r--r--larn/README2
-rw-r--r--larn/bill.c266
-rw-r--r--larn/config.c2
-rw-r--r--larn/create.c2
-rw-r--r--larn/data.c9
-rw-r--r--larn/diag.c2
-rw-r--r--larn/display.c2
-rw-r--r--larn/fortune.c138
-rw-r--r--larn/global.c2
-rw-r--r--larn/header.h5
-rw-r--r--larn/help.c2
-rw-r--r--larn/io.c2
-rw-r--r--larn/larn.613
-rw-r--r--larn/main.c2
-rw-r--r--larn/monster.c2
-rw-r--r--larn/moreobj.c2
-rw-r--r--larn/movem.c2
-rw-r--r--larn/nap.c2
-rw-r--r--larn/object.c2
-rw-r--r--larn/pathnames.h5
-rw-r--r--larn/regen.c2
-rw-r--r--larn/savelev.c2
-rw-r--r--larn/scores.c2
-rw-r--r--larn/signal.c2
-rw-r--r--larn/store.c9
-rw-r--r--larn/tok.c2
-rw-r--r--monop/Makefile4
-rw-r--r--monop/brd.dat2
-rw-r--r--monop/cards.c13
-rw-r--r--monop/deck.h9
-rw-r--r--monop/execute.c13
-rw-r--r--monop/getinp.c13
-rw-r--r--monop/houses.c13
-rw-r--r--monop/initdeck.c19
-rw-r--r--monop/jail.c13
-rw-r--r--monop/misc.c13
-rw-r--r--monop/mon.dat2
-rw-r--r--monop/monop.65
-rw-r--r--monop/monop.c19
-rw-r--r--monop/monop.def9
-rw-r--r--monop/monop.ext2
-rw-r--r--monop/monop.h9
-rw-r--r--monop/morg.c13
-rw-r--r--monop/pathnames.h9
-rw-r--r--monop/print.c13
-rw-r--r--monop/prop.c13
-rw-r--r--monop/prop.dat2
-rw-r--r--monop/rent.c13
-rw-r--r--monop/roll.c13
-rw-r--r--monop/spec.c13
-rw-r--r--monop/trade.c13
-rw-r--r--morse/Makefile4
-rw-r--r--morse/morse.c19
-rw-r--r--number/Makefile4
-rw-r--r--number/number.629
-rw-r--r--number/number.c287
-rw-r--r--pom/Makefile4
-rw-r--r--pom/pom.611
-rw-r--r--pom/pom.c19
-rw-r--r--ppt/Makefile4
-rw-r--r--ppt/ppt.c19
-rw-r--r--primes/Makefile4
-rw-r--r--primes/pattern.c13
-rw-r--r--primes/pr_tbl.c13
-rw-r--r--primes/primes.c315
-rw-r--r--primes/primes.h25
193 files changed, 1435 insertions, 1259 deletions
diff --git a/factor/Makefile b/factor/Makefile
index edb6f563..d63a6204 100644
--- a/factor/Makefile
+++ b/factor/Makefile
@@ -1,5 +1,5 @@
-# from: @(#)Makefile 5.7 (Berkeley) 4/8/91
-# $Id: Makefile,v 1.3 1994/12/22 09:34:03 cgd Exp $
+# $NetBSD: Makefile,v 1.4 1995/03/23 08:28:00 cgd Exp $
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
PROG= factor
SRCS= factor.c pr_tbl.c
diff --git a/factor/factor.6 b/factor/factor.6
index 4bf869d6..d21be552 100644
--- a/factor/factor.6
+++ b/factor/factor.6
@@ -1,5 +1,7 @@
-.\" Copyright (c) 1989 The Regents of the University of California.
-.\" All rights reserved.
+.\" $NetBSD: factor.6,v 1.4 1995/03/23 08:28:05 cgd Exp $
+.\"
+.\" Copyright (c) 1989, 1993
+.\" The Regents of the University of California. All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" Landon Curt Noll.
@@ -32,15 +34,14 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" from: @(#)factor.6 5.3 (Berkeley) 6/23/90
-.\" $Id: factor.6,v 1.3 1993/08/05 01:46:37 jtc Exp $
+.\" @(#)factor.6 8.1 (Berkeley) 5/31/93
.\"
.\"
.\" By: Landon Curt Noll chongo@toad.com, ...!{sun,tolsoft}!hoptoad!chongo
.\"
.\" chongo <for a good prime call: 391581 * 2^216193 - 1> /\oo/\
.\"
-.Dd June 23, 1990
+.Dd May 31, 1993
.Dt FACTOR 6
.Os
.Sh NAME
diff --git a/factor/factor.c b/factor/factor.c
index 9b5e0120..c578a747 100644
--- a/factor/factor.c
+++ b/factor/factor.c
@@ -1,6 +1,8 @@
+/* $NetBSD: factor.c,v 1.5 1995/03/23 08:28:07 cgd Exp $ */
+
/*
- * Copyright (c) 1989 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Landon Curt Noll.
@@ -35,14 +37,17 @@
*/
#ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1989 The Regents of the University of California.\n\
- All rights reserved.\n";
+static char copyright[] =
+"@(#) Copyright (c) 1989, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
-/*static char sccsid[] = "from: @(#)factor.c 4.4 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: factor.c,v 1.4 1994/03/03 03:07:24 deraadt Exp $";
+#if 0
+static char sccsid[] = "@(#)factor.c 8.3 (Berkeley) 3/30/94";
+#else
+static char rcsid[] = "$NetBSD: factor.c,v 1.5 1995/03/23 08:28:07 cgd Exp $";
+#endif
#endif /* not lint */
/*
@@ -64,9 +69,13 @@ static char rcsid[] = "$Id: factor.c,v 1.4 1994/03/03 03:07:24 deraadt Exp $";
* If no args are given, the list of numbers are read from stdin.
*/
-#include <stdio.h>
-#include <limits.h>
+#include <err.h>
#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+
#include "primes.h"
/*
@@ -76,202 +85,66 @@ static char rcsid[] = "$Id: factor.c,v 1.4 1994/03/03 03:07:24 deraadt Exp $";
* up to 65537 and 65537^2 > 2^32-1.
*/
extern ubig prime[];
-extern ubig *pr_limit; /* largest prime in the prime array */
-
-#define MAX_LINE 255 /* max line allowed on stdin */
+extern ubig *pr_limit; /* largest prime in the prime array */
-void pr_fact(); /* print factors of a value */
-long small_fact(); /* find smallest factor of a value */
-char *read_num_buf(); /* read a number buffer */
-char *program; /* name of this program */
+void pr_fact __P((ubig)); /* print factors of a value */
+void usage __P((void));
+int
main(argc, argv)
- int argc; /* arg count */
- char *argv[]; /* the args */
+ int argc;
+ char *argv[];
{
- int arg; /* which arg to factor */
- long val; /* the value to factor */
- char buf[MAX_LINE+1]; /* input buffer */
-
- /* parse args */
- program = argv[0];
- if (argc >= 2) {
-
- /* factor each arg */
- for (arg=1; arg < argc; ++arg) {
-
- /* process the buffer */
- if (read_num_buf(NULL, argv[arg]) == NULL) {
- fprintf(stderr, "%s: ouch\n", program);
- exit(1);
- }
-
- /* factor the argument */
- if (sscanf(argv[arg], "%ld", &val) == 1) {
- pr_fact(val);
- } else {
- fprintf(stderr, "%s: ouch\n", program);
- exit(1);
- }
+ ubig val;
+ int ch;
+ char *p, buf[100]; /* > max number of digits. */
+
+ while ((ch = getopt(argc, argv, "")) != EOF)
+ switch (ch) {
+ case '?':
+ default:
+ usage();
}
-
- /* no args supplied, read numbers from stdin */
- } else {
- /*
- * read asciii numbers from input
- */
- while (read_num_buf(stdin, buf) != NULL) {
-
- /* factor the argument */
- if (sscanf(buf, "%ld", &val) == 1) {
- pr_fact(val);
+ argc -= optind;
+ argv += optind;
+
+ /* No args supplied, read numbers from stdin. */
+ if (argc == 0)
+ for (;;) {
+ if (fgets(buf, sizeof(buf), stdin) == NULL) {
+ if (ferror(stdin))
+ err(1, "stdin");
+ exit (0);
}
+ for (p = buf; isblank(*p); ++p);
+ if (*p == '\n' || *p == '\0')
+ 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);
+ pr_fact(val);
}
- }
- exit(0);
-}
-
-/*
- * read_num_buf - read a number buffer from a stream
- *
- * Read a number on a line of the form:
- *
- * ^[ \t]*\([+-]?[0-9][0-9]\)*.*$
- *
- * where ? is a 1-or-0 operator and the number is within \( \).
- *
- * If does not match the above pattern, it is ignored and a new
- * line is read. If the number is too large or small, we will
- * print ouch and read a new line.
- *
- * We have to be very careful on how we check the magnitude of the
- * input. We can not use numeric checks because of the need to
- * check values against maximum numeric values.
- *
- * This routine will return a line containing a ascii number between
- * NEG_SEMIBIG and SEMIBIG, or it will return NULL.
- *
- * If the stream is NULL then buf will be processed as if were
- * a single line stream.
- *
- * returns:
- * char * pointer to leading digit, + or -
- * NULL EOF or error
- */
-char *
-read_num_buf(input, buf)
- FILE *input; /* input stream or NULL */
- char *buf; /* input buffer */
-{
- static char limit[MAX_LINE+1]; /* ascii value of SEMIBIG */
- static int limit_len; /* digit count of limit */
- static char neg_limit[MAX_LINE+1]; /* value of NEG_SEMIBIG */
- static int neg_limit_len; /* digit count of neg_limit */
- int len; /* digits in input (excluding +/-) */
- char *s; /* line start marker */
- char *d; /* first digit, skip +/- */
- char *p; /* scan pointer */
- char *z; /* zero scan pointer */
-
- /* form the ascii value of SEMIBIG if needed */
- if (!isascii(limit[0]) || !isdigit(limit[0])) {
- sprintf(limit, "%ld", SEMIBIG);
- limit_len = strlen(limit);
- sprintf(neg_limit, "%ld", NEG_SEMIBIG);
- neg_limit_len = strlen(neg_limit)-1; /* exclude - */
- }
-
- /*
- * the search for a good line
- */
- if (input != NULL && fgets(buf, MAX_LINE, input) == NULL) {
- /* error or EOF */
- return NULL;
- }
- do {
-
- /* ignore leading whitespace */
- for (s=buf; *s && s < buf+MAX_LINE; ++s) {
- if (!isascii(*s) || !isspace(*s)) {
- break;
- }
- }
-
- /* skip over any leading + or - */
- if (*s == '+' || *s == '-') {
- d = s+1;
- } else {
- d = s;
- }
-
- /* note leading zeros */
- for (z=d; *z && z < buf+MAX_LINE; ++z) {
- if (*z != '0') {
- break;
- }
- }
-
- /* scan for the first non-digit */
- for (p=d; *p && p < buf+MAX_LINE; ++p) {
- if (!isascii(*p) || !isdigit(*p)) {
- break;
- }
- }
-
- /* ignore empty lines */
- if (p == d) {
- continue;
- }
- *p = '\0';
-
- /* object if too many digits */
- len = strlen(z);
- len = (len<=0) ? 1 : len;
- if (*s == '-') {
- /* accept if digit count is below limit */
- if (len < neg_limit_len) {
- /* we have good input */
- return s;
-
- /* reject very large numbers */
- } else if (len > neg_limit_len) {
- fprintf(stderr, "%s: ouch\n", program);
- exit(1);
-
- /* carefully check against near limit numbers */
- } else if (strcmp(z, neg_limit+1) > 0) {
- fprintf(stderr, "%s: ouch\n", program);
- exit(1);
- }
- /* number is near limit, but is under it */
- return s;
-
- } else {
- /* accept if digit count is below limit */
- if (len < limit_len) {
- /* we have good input */
- return s;
-
- /* reject very large numbers */
- } else if (len > limit_len) {
- fprintf(stderr, "%s: ouch\n", program);
- exit(1);
-
- /* carefully check against near limit numbers */
- } else if (strcmp(z, limit) > 0) {
- fprintf(stderr, "%s: ouch\n", program);
- exit(1);
- }
- /* number is near limit, but is under it */
- return s;
+ /* Factor the arguments. */
+ else
+ 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')
+ errx(1, "%s: illegal numeric format.", argv[0]);
+ pr_fact(val);
}
- } while (input != NULL && fgets(buf, MAX_LINE, input) != NULL);
-
- /* error or EOF */
- return NULL;
+ exit(0);
}
-
/*
* pr_fact - print the factors of a number
*
@@ -287,62 +160,48 @@ read_num_buf(input, buf)
*/
void
pr_fact(val)
- long val; /* factor this value */
+ ubig val; /* Factor this value. */
{
- ubig *fact; /* the factor found */
+ ubig *fact; /* The factor found. */
- /* firewall - catch 0 and 1 */
- switch (val) {
- case -(2147483648U):
- /* avoid negation problems */
- puts("-2147483648: -1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\n");
- return;
- case -1:
- puts("-1: -1\n");
- return;
- case 0:
+ /* Firewall - catch 0 and 1. */
+ if (val == 0) /* Historical practice; 0 just exits. */
exit(0);
- case 1:
- puts("1: 1\n");
+ if (val == 1) {
+ (void)printf("1: 1\n");
return;
- default:
- if (val < 0) {
- val = -val;
- printf("%ld: -1", val);
- } else {
- printf("%ld:", val);
- }
- fflush(stdout);
- break;
}
- /*
- * factor value
- */
- fact = &prime[0];
- while (val > 1) {
-
- /* look for the smallest factor */
+ /* Factor value. */
+ (void)printf("%lu:", val);
+ for (fact = &prime[0]; val > 1; ++fact) {
+ /* Look for the smallest factor. */
do {
- if (val%(long)*fact == 0) {
+ if (val % (long)*fact == 0)
break;
- }
} while (++fact <= pr_limit);
- /* watch for primes larger than the table */
+ /* Watch for primes larger than the table. */
if (fact > pr_limit) {
- printf(" %ld\n", val);
- return;
+ (void)printf(" %lu", val);
+ break;
}
- /* divide factor out until none are left */
+ /* Divide factor out until none are left. */
do {
- printf(" %ld", *fact);
+ (void)printf(" %lu", *fact);
val /= (long)*fact;
} while ((val % (long)*fact) == 0);
- fflush(stdout);
- ++fact;
+
+ /* Let the user know we're doing something. */
+ (void)fflush(stdout);
}
- putchar('\n');
- return;
+ (void)putchar('\n');
+}
+
+void
+usage()
+{
+ (void)fprintf(stderr, "usage: factor [value ...]\n");
+ exit (0);
}
diff --git a/fish/Makefile b/fish/Makefile
index c798831f..61ab5d16 100644
--- a/fish/Makefile
+++ b/fish/Makefile
@@ -1,5 +1,5 @@
-# from: @(#)Makefile 5.5 (Berkeley) 1/18/91
-# $Id: Makefile,v 1.5 1995/01/12 19:06:53 jtc Exp $
+# $NetBSD: Makefile,v 1.6 1995/03/23 08:28:14 cgd Exp $
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
PROG= fish
MAN= fish.6
@@ -7,6 +7,6 @@ HIDEGAME=hidegame
beforeinstall:
install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/fish.instr \
- ${DESTDIR}/usr/share/games
+ ${DESTDIR}/usr/share/games/fish.instr
.include <bsd.prog.mk>
diff --git a/fish/fish.6 b/fish/fish.6
index 788b0e63..3c60193c 100644
--- a/fish/fish.6
+++ b/fish/fish.6
@@ -1,5 +1,7 @@
-.\" Copyright (c) 1990 The Regents of the University of California.
-.\" All rights reserved.
+.\" $NetBSD: fish.6,v 1.4 1995/03/23 08:28:16 cgd Exp $
+.\"
+.\" Copyright (c) 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
@@ -29,10 +31,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" from: @(#)fish.6 6.2 (Berkeley) 1/18/91
-.\" $Id: fish.6,v 1.3 1993/08/05 01:46:41 jtc Exp $
+.\" @(#)fish.6 8.1 (Berkeley) 5/31/93
.\"
-.Dd January 18, 1991
+.Dd May 31, 1993
.Dt FISH 6
.Os
.Sh NAME
diff --git a/fish/fish.c b/fish/fish.c
index 9eb93031..14af9c05 100644
--- a/fish/fish.c
+++ b/fish/fish.c
@@ -1,6 +1,8 @@
+/* $NetBSD: fish.c,v 1.3 1995/03/23 08:28:18 cgd Exp $ */
+
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Muffy Barkocy.
@@ -35,14 +37,17 @@
*/
#ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1990 The Regents of the University of California.\n\
- All rights reserved.\n";
+static char copyright[] =
+"@(#) Copyright (c) 1990, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
-/*static char sccsid[] = "from: @(#)fish.c 5.4 (Berkeley) 1/18/91";*/
-static char rcsid[] = "$Id: fish.c,v 1.2 1993/08/01 18:54:54 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)fish.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: fish.c,v 1.3 1995/03/23 08:28:18 cgd Exp $";
+#endif
#endif /* not lint */
#include <sys/types.h>
diff --git a/fish/pathnames.h b/fish/pathnames.h
index 3cd156c8..aa257ff8 100644
--- a/fish/pathnames.h
+++ b/fish/pathnames.h
@@ -1,6 +1,8 @@
+/* $NetBSD: pathnames.h,v 1.3 1995/03/23 08:28:21 cgd Exp $ */
+
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,8 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * from: @(#)pathnames.h 5.1 (Berkeley) 1/18/91
- * $Id: pathnames.h,v 1.2 1993/08/01 18:54:53 mycroft Exp $
+ * @(#)pathnames.h 8.1 (Berkeley) 5/31/93
*/
#define _PATH_INSTR "/usr/share/games/fish.instr"
diff --git a/fortune/Makefile b/fortune/Makefile
index d912d072..2a951ab1 100644
--- a/fortune/Makefile
+++ b/fortune/Makefile
@@ -1,5 +1,5 @@
-# from: @(#)Makefile 5.6 (Berkeley) 4/27/91
-# $Id: Makefile,v 1.4 1993/08/01 05:45:23 mycroft Exp $
+# $NetBSD: Makefile,v 1.5 1995/03/23 08:28:23 cgd Exp $
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
SUBDIR= fortune
diff --git a/fortune/Notes b/fortune/Notes
index 9be4f4d2..717682f0 100644
--- a/fortune/Notes
+++ b/fortune/Notes
@@ -1,3 +1,4 @@
+# $NetBSD: Notes,v 1.2 1995/03/23 08:28:26 cgd Exp $
# @(#)Notes 8.1 (Berkeley) 5/31/93
Warning:
diff --git a/fortune/README b/fortune/README
index ee9ef642..29de138b 100644
--- a/fortune/README
+++ b/fortune/README
@@ -1,3 +1,4 @@
+# $NetBSD: README,v 1.2 1995/03/23 08:28:29 cgd Exp $
# @(#)README 8.1 (Berkeley) 5/31/93
The potentially offensive fortunes are not installed by default on BSD
diff --git a/fortune/datfiles/Makefile b/fortune/datfiles/Makefile
index d92f8ba4..8c87385b 100644
--- a/fortune/datfiles/Makefile
+++ b/fortune/datfiles/Makefile
@@ -1,37 +1,44 @@
-# from: @(#)Makefile 5.2 (Berkeley) 5/6/91
-# $Id: Makefile,v 1.10 1994/02/10 02:31:32 cgd Exp $
+# $NetBSD: Makefile,v 1.11 1995/03/23 08:28:33 cgd Exp $
+# @(#)Makefile 8.2 (Berkeley) 4/19/94
-#
-# set `OBSCENE' to "real" to have obscene fortunes installed,
-# fake to have a note stating that they're not installed
-# isntalled in their place
-#
-OBSCENE=real
+SRCS= fortunes fortunes2 startrek zippy
+BLDS= fortunes.dat fortunes2.dat startrek.dat zippy.dat \
+ fortunes-o fortunes-o.dat
-NORMDAT= fortunes.dat startrek.dat zippy.dat
-OBSDAT= fortunes-o.dat
-DATFILES= ${NORMDAT} ${OBSDAT}
+# TO INSTALL THE POTENTIALLY OFFENSIVE FORTUNES, UNCOMMENT THE THREE
+# LINES AND COMMENT OUT THE FOURTH LINE.
-CLEANFILES+=${DATFILES}
+# THE THREE LINES
+SRCS+= fortunes2-o limerick
+BLDS+= fortunes2-o.dat limerick.dat
+TYPE= real
+
+# THE FOURTH LINE
+#TYPE= fake
+
+CLEANFILES+=${BLDS}
STRFILE!=cd $(.CURDIR)/../strfile; \
printf "xxx:\n\techo \$${.OBJDIR}/strfile\n" | ${MAKE} -r -s -f - xxx
-all: ${DATFILES}
+all: ${BLDS}
-install:
- install ${COPY} -o ${BINOWN} -g ${BINGRP} -m 444 ${DATFILES} \
- ${DESTDIR}/usr/share/games/fortune
+install: ${SRCS} ${BLDS}
(cd ${.CURDIR} && install -c -o ${BINOWN} -g ${BINGRP} -m 444 \
- ${NORMDAT:R} ${DESTDIR}/usr/share/games/fortune)
- (cd ${.CURDIR} && install -c -o ${BINOWN} -g ${BINGRP} -m 444 \
- ${OBSDAT:R}.${OBSCENE}.rot13 \
- ${DESTDIR}/usr/share/games/fortune/${OBSDAT:R})
-
-fortunes-o.dat: ${.TARGET:R}.${OBSCENE}.rot13
- ${STRFILE} -rsx ${.CURDIR}/${.TARGET:R}.${OBSCENE}.rot13 ${.TARGET}
+ ${SRCS} ${DESTDIR}/usr/share/games/fortune)
+ install -o ${BINOWN} -g ${BINGRP} -m 444 ${BLDS} \
+ ${DESTDIR}/usr/share/games/fortune
-fortunes.dat startrek.dat zippy.dat: ${.TARGET:R}
+fortunes.dat fortunes2.dat fortunes2-o.dat limerick.dat startrek.dat zippy.dat:
${STRFILE} -rs ${.CURDIR}/${.TARGET:R} ${.TARGET}
+fortunes-o.dat: fortunes-o
+ ${STRFILE} -rsx fortunes-o ${.TARGET}
+
+#fortunes-o: fortunes-o.${TYPE}
+# /usr/games/caesar 13 < ${.ALLSRC} > ${.TARGET}
+
+fortunes-o: fortunes-o.${TYPE}.rot13
+ cat < ${.ALLSRC} > ${.TARGET}
+
.include <bsd.prog.mk>
diff --git a/fortune/fortune/Makefile b/fortune/fortune/Makefile
index 71cbf376..51ba8d99 100644
--- a/fortune/fortune/Makefile
+++ b/fortune/fortune/Makefile
@@ -1,4 +1,5 @@
-# $Id: Makefile,v 1.7 1994/12/22 09:34:12 cgd Exp $
+# $NetBSD: Makefile,v 1.8 1995/03/23 08:28:36 cgd Exp $
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
PROG= fortune
MAN= fortune.6
diff --git a/fortune/fortune/fortune.6 b/fortune/fortune/fortune.6
index d4876e1a..da994244 100644
--- a/fortune/fortune/fortune.6
+++ b/fortune/fortune/fortune.6
@@ -1,5 +1,7 @@
-.\" Copyright (c) 1985 The Regents of the University of California.
-.\" All rights reserved.
+.\" $NetBSD: fortune.6,v 1.4 1995/03/23 08:28:37 cgd Exp $
+.\"
+.\" Copyright (c) 1985, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" Ken Arnold.
@@ -32,10 +34,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" from: @(#)fortune.6 6.8 (Berkeley) 6/23/90
-.\" $Id: fortune.6,v 1.3 1993/08/05 02:15:58 jtc Exp $
+.\" @(#)fortune.6 8.3 (Berkeley) 4/19/94
.\"
-.Dd June 23, 1990
+.Dd April 19, 1994
.Dt FORTUNE 6
.Os
.Sh NAME
@@ -57,9 +58,12 @@ Epigrams are divided into several categories, where each category
is subdivided into those which are potentially offensive and those
which are not.
The options are as follows:
-.Bl -tag -width indent
+.Bl -tag -width flag
.It Fl a
Choose from all lists of maxims, both offensive and not.
+(See the
+.Fl o
+option for more information on offensive fortunes.)
.It Fl e
Consider all fortune files to be of equal size (see discussion below
on multiple files).
@@ -76,22 +80,24 @@ See
for a description of patterns.
.It Fl o
Choose only from potentially offensive aphorisms.
-.Pp
+.Bf -symbolic
Please, please, please request a potentially offensive fortune if and
only if you believe, deep down in your heart, that you are willing
to be offended.
-(And that if you are, you'll just quit using -o rather than give us
+(And that if you are, you'll just quit using
+.Fl o
+rather than give us
grief about it, okay?)
-.Pp
+.Ef
.Bd -filled -offset indent
\&... let us keep in mind the basic governing philosophy
of The Brotherhood, as handsomely summarized in these words:
we believe in healthy, hearty laughter -- at the expense of
the whole human race, if needs be.
Needs be.
+.Bd -filled -offset indent-two -compact
+--H. Allen Smith, "Rude Jokes"
.Ed
-.Bd -filled -offset indent-two
--- H. Allen Smith, "Rude Jokes"
.Ed
.It Fl s
Short apothegms only.
@@ -109,12 +115,12 @@ to guarantee that the message can be read before the screen is cleared.
The user may specify alternate sayings.
You can specify a specific file, a directory which contains one or
more files, or the special word
-.Ar all
+.Em all
which says to use all the standard databases.
Any of these may be preceded by a percentage, which is a number
.Ar N
between 0 and 100 inclusive, followed by a
-.Em % .
+.Ar % .
If it is, there will be a
.Ar N
percent probability that an adage will be picked from that file
@@ -125,35 +131,44 @@ and/or directories, in which case the probability of selecting from
one of them will be based on their relative sizes.
.Pp
As an example, given two databases
-.Ar funny
+.Em funny
and
-.Ar not-funny ,
+.Em not-funny ,
with
-.Ar funny
+.Em funny
twice as big, saying
-.Dl fortune funny not-funny
+.Bd -literal -offset indent
+fortune funny not-funny
+.Ed
+.Pp
will get you fortunes out of
-.Ar funny
+.Em funny
two-thirds of the time.
The command
-.Dl fortune 90% funny 10% not-funny
+.Bd -literal -offset indent
+fortune 90% funny 10% not-funny
+.Ed
+.Pp
will pick out 90% of its fortunes from
-.Ar funny
-(the
-.Dq 10% not-funny
-is unnecessary, since 10% is all that's left).
+.Em funny
+(the ``10% not-funny'' is unnecessary, since 10% is all that's left).
The
.Fl e
option says to consider all files equal;
thus
-.Dl fortune Fl e
+.Bd -literal -offset indent
+fortune -e
+.Ed
+.Pp
is equivalent to
-.Dl fortune 50% funny 50% not-funny
+.Bd -literal -offset indent
+fortune 50% funny 50% not
+.Em -funny
+.Ed
.Sh FILES
-.Pa /usr/share/games/fortune
-.Sh AUTHOR
-Ken Arnold
+.Bl -tag -width Pa -compact
+.It Pa /usr/share/games/fortune
+.El
.Sh SEE ALSO
.Xr regex 3 ,
.Xr regcmp 3 ,
-.Xr strfile(8)
diff --git a/fortune/fortune/fortune.c b/fortune/fortune/fortune.c
index 01811bf0..c8b96eaa 100644
--- a/fortune/fortune/fortune.c
+++ b/fortune/fortune/fortune.c
@@ -1,6 +1,8 @@
+/* $NetBSD: fortune.c,v 1.8 1995/03/23 08:28:40 cgd Exp $ */
+
/*-
- * Copyright (c) 1986 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1986, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ken Arnold.
@@ -35,54 +37,33 @@
*/
#ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1986 The Regents of the University of California.\n\
- All rights reserved.\n";
+static char copyright[] =
+"@(#) Copyright (c) 1986, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
-/*static char sccsid[] = "from: @(#)fortune.c 5.13 (Berkeley) 4/8/91";*/
-static char rcsid[] = "$Id: fortune.c,v 1.7 1993/12/04 02:19:49 jtc Exp $";
+#if 0
+static char sccsid[] = "@(#)fortune.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: fortune.c,v 1.8 1995/03/23 08:28:40 cgd Exp $";
+#endif
#endif /* not lint */
-# include <machine/endian.h>
# include <sys/param.h>
# include <sys/stat.h>
+
# include <dirent.h>
-# include <stdio.h>
+# include <fcntl.h>
# include <assert.h>
+# include <unistd.h>
+# include <stdio.h>
+# include <ctype.h>
# include <stdlib.h>
# include <string.h>
-# include <time.h>
# include "strfile.h"
# include "pathnames.h"
-#ifdef SYSV
-# define NO_LOCK
-# define REGCMP
-# ifdef NO_REGEX
-# undef NO_REGEX
-# endif /* NO_REGEX */
-# define index strchr
-# define rindex strrchr
-#endif /* SYSV */
-
-#ifndef NO_REGEX
-# include <ctype.h>
-#endif /* NO_REGEX */
-
-# ifndef NO_LOCK
-# include <sys/file.h>
-# endif /* NO_LOCK */
-
-# ifndef F_OK
-/* codes for access() */
-# define F_OK 0 /* does file exist */
-# define X_OK 1 /* is it executable by caller */
-# define W_OK 2 /* writable by caller */
-# define R_OK 4 /* readable by caller */
-# endif /* F_OK */
-
# define TRUE 1
# define FALSE 0
# define bool short
@@ -91,21 +72,21 @@ static char rcsid[] = "$Id: fortune.c,v 1.7 1993/12/04 02:19:49 jtc Exp $";
# define CPERS 20 /* # of chars for each sec */
# define SLEN 160 /* # of chars in short fortune */
-# define POS_UNKNOWN ((unsigned long) -1) /* pos for file unknown */
+# define POS_UNKNOWN ((off_t) -1) /* pos for file unknown */
# define NO_PROB (-1) /* no prob specified for file */
# ifdef DEBUG
# define DPRINTF(l,x) if (Debug >= l) fprintf x; else
# undef NDEBUG
-# else /* DEBUG */
+# else
# define DPRINTF(l,x)
# define NDEBUG 1
-# endif /* DEBUG */
+# endif
typedef struct fd {
int percent;
int fd, datfd;
- unsigned long pos;
+ off_t pos;
FILE *inf;
char *name;
char *path;
@@ -145,12 +126,44 @@ FILEDESC *Fortfile; /* Fortune file to use */
STRFILE Noprob_tbl; /* sum of data for all no prob files */
-char *do_malloc(), *copy(), *off_name();
-
-FILEDESC *pick_child(), *new_fp();
+int add_dir __P((FILEDESC *));
+int add_file __P((int,
+ char *, char *, FILEDESC **, FILEDESC **, FILEDESC *));
+void all_forts __P((FILEDESC *, char *));
+char *copy __P((char *, u_int));
+void display __P((FILEDESC *));
+void do_free __P((void *));
+void *do_malloc __P((u_int));
+int form_file_list __P((char **, int));
+int fortlen __P((void));
+void get_fort __P((void));
+void get_pos __P((FILEDESC *));
+void get_tbl __P((FILEDESC *));
+void getargs __P((int, char *[]));
+void init_prob __P((void));
+int is_dir __P((char *));
+int is_fortfile __P((char *, char **, char **, int));
+int is_off_name __P((char *));
+int max __P((int, int));
+FILEDESC *
+ new_fp __P((void));
+char *off_name __P((char *));
+void open_dat __P((FILEDESC *));
+void open_fp __P((FILEDESC *));
+FILEDESC *
+ pick_child __P((FILEDESC *));
+void print_file_list __P((void));
+void print_list __P((FILEDESC *, int));
+void sum_noprobs __P((FILEDESC *));
+void sum_tbl __P((STRFILE *, STRFILE *));
+void usage __P((void));
+void zero_tbl __P((STRFILE *));
-#ifndef NO_REGEX
-char *conv_pat();
+#ifndef NO_REGEX
+char *conv_pat __P((char *));
+int find_matches __P((void));
+void matches_in_list __P((FILEDESC *));
+int maxlen_in_list __P((FILEDESC *));
#endif
#ifndef NO_REGEX
@@ -167,15 +180,10 @@ char *regcmp(), *regex();
# define BAD_COMP(f) ((f) != NULL)
# define RE_EXEC(p) re_exec(p)
-char *re_comp();
-#ifdef SYSV
-char *re_exec();
-#else
-int re_exec();
-#endif
#endif
#endif
+int
main(ac, av)
int ac;
char *av[];
@@ -229,6 +237,7 @@ char *av[];
/* NOTREACHED */
}
+void
display(fp)
FILEDESC *fp;
{
@@ -236,7 +245,7 @@ FILEDESC *fp;
char line[BUFSIZ];
open_fp(fp);
- (void) fseek(fp->inf, Seekpts[0], 0);
+ (void) fseek(fp->inf, (long)Seekpts[0], 0);
for (Fort_len = 0; fgets(line, sizeof line, fp->inf) != NULL &&
!STR_ENDSTRING(line, fp->tbl); Fort_len++) {
if (fp->tbl.str_flags & STR_ROTATED)
@@ -254,6 +263,7 @@ FILEDESC *fp;
* fortlen:
* Return the length of the fortune.
*/
+int
fortlen()
{
register int nchar;
@@ -263,7 +273,7 @@ fortlen()
nchar = (Seekpts[1] - Seekpts[0] <= SLEN);
else {
open_fp(Fortfile);
- (void) fseek(Fortfile->inf, Seekpts[0], 0);
+ (void) fseek(Fortfile->inf, (long)Seekpts[0], 0);
nchar = 0;
while (fgets(line, sizeof line, Fortfile->inf) != NULL &&
!STR_ENDSTRING(line, Fortfile->tbl))
@@ -276,20 +286,20 @@ fortlen()
/*
* This routine evaluates the arguments on the command line
*/
+void
getargs(argc, argv)
register int argc;
register char **argv;
{
register int ignore_case;
# ifndef NO_REGEX
- register char *pat = NULL; /* 29 Sep 92*/
+ register char *pat = NULL;
# endif /* NO_REGEX */
extern char *optarg;
extern int optind;
int ch;
ignore_case = FALSE;
- /* pat = NULL;*/ /* 29 Sep 92*/
# ifdef DEBUG
while ((ch = getopt(argc, argv, "aDefilm:osw")) != EOF)
@@ -377,6 +387,7 @@ register char **argv;
* form_file_list:
* Form the file list from the file specifications.
*/
+int
form_file_list(files, file_cnt)
register char **files;
register int file_cnt;
@@ -436,6 +447,7 @@ register int file_cnt;
* add_file:
* Add a file to the file list.
*/
+int
add_file(percent, file, dir, head, tail, parent)
int percent;
register char *file;
@@ -602,6 +614,7 @@ char *file;
* is_off_name:
* Is the file an offensive-style name?
*/
+int
is_off_name(file)
char *file;
{
@@ -616,6 +629,7 @@ char *file;
* Modify a FILEDESC element to be the parent of two children if
* there are two children to be a parent of.
*/
+void
all_forts(fp, offensive)
register FILEDESC *fp;
char *offensive;
@@ -665,11 +679,12 @@ char *offensive;
* add_dir:
* Add the contents of an entire directory.
*/
+int
add_dir(fp)
register FILEDESC *fp;
{
register DIR *dir;
- register struct dirent *dirent;
+ register struct dirent *dirent;
auto FILEDESC *tailp;
auto char *name;
@@ -703,6 +718,7 @@ register FILEDESC *fp;
* is_dir:
* Return TRUE if the file is a directory, FALSE otherwise.
*/
+int
is_dir(file)
char *file;
{
@@ -721,9 +737,9 @@ char *file;
* suffixes, as contained in suflist[], are ruled out.
*/
/* ARGSUSED */
+int
is_fortfile(file, datp, posp, check_for_offend)
-char *file;
-char **datp, **posp;
+char *file, **datp, **posp;
int check_for_offend;
{
register int i;
@@ -809,11 +825,11 @@ unsigned int len;
* do_malloc:
* Do a malloc, checking for NULL return.
*/
-char *
+void *
do_malloc(size)
unsigned int size;
{
- char *new;
+ void *new;
if ((new = malloc(size)) == NULL) {
(void) fprintf(stderr, "fortune: out of memory.\n");
@@ -826,8 +842,9 @@ unsigned int size;
* do_free:
* Free malloc'ed space, if any.
*/
+void
do_free(ptr)
-char *ptr;
+void *ptr;
{
if (ptr != NULL)
free(ptr);
@@ -837,6 +854,7 @@ char *ptr;
* init_prob:
* Initialize the fortune probabilities.
*/
+void
init_prob()
{
register FILEDESC *fp, *last;
@@ -908,6 +926,7 @@ init_prob()
* get_fort:
* Get the fortune data file's seek pointer for the next fortune.
*/
+void
get_fort()
{
register FILEDESC *fp;
@@ -1007,6 +1026,7 @@ FILEDESC *parent;
* sum_noprobs:
* Sum up all the noprob probabilities, starting with fp.
*/
+void
sum_noprobs(fp)
register FILEDESC *fp;
{
@@ -1023,6 +1043,7 @@ register FILEDESC *fp;
did_noprobs = TRUE;
}
+int
max(i, j)
register int i, j;
{
@@ -1033,6 +1054,7 @@ register int i, j;
* open_fp:
* Assocatiate a FILE * with the given FILEDESC.
*/
+void
open_fp(fp)
FILEDESC *fp;
{
@@ -1046,6 +1068,7 @@ FILEDESC *fp;
* open_dat:
* Open up the dat file if we need to.
*/
+void
open_dat(fp)
FILEDESC *fp;
{
@@ -1060,6 +1083,7 @@ FILEDESC *fp;
* Get the position from the pos file, if there is one. If not,
* return a random number.
*/
+void
get_pos(fp)
FILEDESC *fp;
{
@@ -1083,13 +1107,14 @@ FILEDESC *fp;
}
if (++(fp->pos) >= fp->tbl.str_numstr)
fp->pos -= fp->tbl.str_numstr;
- DPRINTF(1, (stderr, "pos for %s is %d\n", fp->name, fp->pos));
+ DPRINTF(1, (stderr, "pos for %s is %qd\n", fp->name, fp->pos));
}
/*
* get_tbl:
* Get the tbl data file the datfile.
*/
+void
get_tbl(fp)
FILEDESC *fp;
{
@@ -1129,6 +1154,7 @@ FILEDESC *fp;
* zero_tbl:
* Zero out the fields we care about in a tbl structure.
*/
+void
zero_tbl(tp)
register STRFILE *tp;
{
@@ -1141,6 +1167,7 @@ register STRFILE *tp;
* sum_tbl:
* Merge the tbl data of t2 into t1.
*/
+void
sum_tbl(t1, t2)
register STRFILE *t1, *t2;
{
@@ -1157,6 +1184,7 @@ register STRFILE *t1, *t2;
* print_file_list:
* Print out the file list
*/
+void
print_file_list()
{
print_list(File_list, 0);
@@ -1166,6 +1194,7 @@ print_file_list()
* print_list:
* Print out the actual list, recursively.
*/
+void
print_list(list, lev)
register FILEDESC *list;
int lev;
@@ -1234,6 +1263,7 @@ register char *orig;
* find_matches:
* Find all the fortunes which match the pattern we've been given.
*/
+int
find_matches()
{
Fort_len = maxlen_in_list(File_list);
@@ -1251,6 +1281,7 @@ find_matches()
* maxlen_in_list
* Return the maximum fortune len in the file list.
*/
+int
maxlen_in_list(list)
FILEDESC *list;
{
@@ -1276,6 +1307,7 @@ FILEDESC *list;
* matches_in_list
* Print out the matches from the files in the list.
*/
+void
matches_in_list(list)
FILEDESC *list;
{
@@ -1314,6 +1346,7 @@ FILEDESC *list;
}
# endif /* NO_REGEX */
+void
usage()
{
(void) fprintf(stderr, "fortune [-a");
diff --git a/fortune/fortune/pathnames.h b/fortune/fortune/pathnames.h
index 739cc60c..b74569f8 100644
--- a/fortune/fortune/pathnames.h
+++ b/fortune/fortune/pathnames.h
@@ -1,6 +1,8 @@
+/* $NetBSD: pathnames.h,v 1.3 1995/03/23 08:28:42 cgd Exp $ */
+
/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,8 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * from: @(#)pathnames.h 5.2 (Berkeley) 4/8/91
- * $Id: pathnames.h,v 1.2 1993/08/01 18:54:47 mycroft Exp $
+ * @(#)pathnames.h 8.1 (Berkeley) 5/31/93
*/
#define FORTDIR "/usr/share/games/fortune"
diff --git a/fortune/strfile/Makefile b/fortune/strfile/Makefile
index 8bc08934..a8847445 100644
--- a/fortune/strfile/Makefile
+++ b/fortune/strfile/Makefile
@@ -1,5 +1,5 @@
-# from: @(#)Makefile 5.1 (Berkeley) 4/27/91
-# $Id: Makefile,v 1.4 1994/12/22 09:34:17 cgd Exp $
+# $NetBSD: Makefile,v 1.5 1995/03/23 08:28:44 cgd Exp $
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
PROG= strfile
MAN= strfile.8
diff --git a/fortune/strfile/strfile.8 b/fortune/strfile/strfile.8
index 9178f49d..98836103 100644
--- a/fortune/strfile/strfile.8
+++ b/fortune/strfile/strfile.8
@@ -1,5 +1,7 @@
-.\" Copyright (c) 1989, 1991 The Regents of the University of California.
-.\" All rights reserved.
+.\" $NetBSD: strfile.8,v 1.3 1995/03/23 08:28:45 cgd Exp $
+.\"
+.\" Copyright (c) 1989, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
.\"
.\"
.\" This code is derived from software contributed to Berkeley by
@@ -33,10 +35,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" from: @(#)strfile.8 5.9 (Berkeley) 3/16/91
-.\" $Id: strfile.8,v 1.2 1993/08/01 07:46:52 mycroft Exp $
+.\" @(#)strfile.8 8.1 (Berkeley) 6/9/93
.\"
-.Dd March 16, 1991
+.Dd June 9, 1993
.Dt STRFILE 8
.Os BSD 4
.Sh NAME
@@ -143,6 +144,5 @@ default output file.
.El
.Sh HISTORY
The
-.Nm
-command
-.Ud
+.Nm strfile
+utility first appeared in 4.4BSD.
diff --git a/fortune/strfile/strfile.c b/fortune/strfile/strfile.c
index 47246c08..3b8b20d8 100644
--- a/fortune/strfile/strfile.c
+++ b/fortune/strfile/strfile.c
@@ -1,6 +1,8 @@
+/* $NetBSD: strfile.c,v 1.3 1995/03/23 08:28:47 cgd Exp $ */
+
/*-
- * Copyright (c) 1989 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ken Arnold.
@@ -35,14 +37,17 @@
*/
#ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1989 The Regents of the University of California.\n\
- All rights reserved.\n";
+static char copyright[] =
+"@(#) Copyright (c) 1989, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
-/*static char sccsid[] = "from: @(#)strfile.c 5.12 (Berkeley) 4/8/91";*/
-static char rcsid[] = "$Id: strfile.c,v 1.2 1993/08/01 18:54:43 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)strfile.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: strfile.c,v 1.3 1995/03/23 08:28:47 cgd Exp $";
+#endif
#endif /* not lint */
# include <machine/endian.h>
diff --git a/fortune/strfile/strfile.h b/fortune/strfile/strfile.h
index 1000a886..48efc747 100644
--- a/fortune/strfile/strfile.h
+++ b/fortune/strfile/strfile.h
@@ -1,6 +1,8 @@
+/* $NetBSD: strfile.h,v 1.3 1995/03/23 08:28:49 cgd Exp $ */
+
/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ken Arnold.
@@ -33,8 +35,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * from: @(#)strfile.h 5.8 (Berkeley) 4/8/91
- * $Id: strfile.h,v 1.2 1993/08/01 18:54:44 mycroft Exp $
+ * @(#)strfile.h 8.1 (Berkeley) 5/31/93
*/
#define STR_ENDSTRING(line,tbl) \
diff --git a/fortune/tools/Do_spell b/fortune/tools/Do_spell
index d997392e..1961a112 100644
--- a/fortune/tools/Do_spell
+++ b/fortune/tools/Do_spell
@@ -1,4 +1,5 @@
#!/bin/sh -
+# $NetBSD: Do_spell,v 1.2 1995/03/23 08:28:50 cgd Exp $
#
# @(#)Do_spell 8.1 (Berkeley) 5/31/93
#
diff --git a/fortune/tools/Do_troff b/fortune/tools/Do_troff
index 52cb282b..6df4ee62 100644
--- a/fortune/tools/Do_troff
+++ b/fortune/tools/Do_troff
@@ -1,4 +1,5 @@
#!/bin/csh -f
+# $NetBSD: Do_troff,v 1.2 1995/03/23 08:28:52 cgd Exp $
#
# @(#)Do_troff 8.1 (Berkeley) 5/31/93
#
diff --git a/fortune/tools/Troff.mac b/fortune/tools/Troff.mac
index c2b433e1..43231f3b 100644
--- a/fortune/tools/Troff.mac
+++ b/fortune/tools/Troff.mac
@@ -1,3 +1,5 @@
+.\" $NetBSD: Troff.mac,v 1.2 1995/03/23 08:28:53 cgd Exp $
+.\"
.nr tp 8
.nr hm 3v
.nr fm 2v
diff --git a/fortune/tools/do_sort b/fortune/tools/do_sort
index b868a4c2..ddae1ace 100644
--- a/fortune/tools/do_sort
+++ b/fortune/tools/do_sort
@@ -1,4 +1,5 @@
#! /bin/sh
+# $NetBSD: do_sort,v 1.2 1995/03/23 08:28:54 cgd Exp $
#
# @(#)do_sort 8.1 (Berkeley) 5/31/93
#
diff --git a/fortune/unstr/Makefile b/fortune/unstr/Makefile
index c884c67d..2619580a 100644
--- a/fortune/unstr/Makefile
+++ b/fortune/unstr/Makefile
@@ -1,5 +1,5 @@
-# from: @(#)Makefile 5.1 (Berkeley) 4/27/91
-# $Id: Makefile,v 1.2 1993/08/01 05:45:17 mycroft Exp $
+# $NetBSD: Makefile,v 1.3 1995/03/23 08:28:58 cgd Exp $
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
PROG= unstr
NOMAN= noman
diff --git a/fortune/unstr/unstr.c b/fortune/unstr/unstr.c
index 59bd4b68..5ea33d26 100644
--- a/fortune/unstr/unstr.c
+++ b/fortune/unstr/unstr.c
@@ -1,6 +1,8 @@
+/* $NetBSD: unstr.c,v 1.3 1995/03/23 08:29:00 cgd Exp $ */
+
/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ken Arnold.
@@ -35,14 +37,13 @@
*/
#ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1991 The Regents of the University of California.\n\
- All rights reserved.\n";
+static char copyright[] =
+"@(#) Copyright (c) 1991, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
-/*static char sccsid[] = "from: @(#)unstr.c 5.8 (Berkeley) 4/8/91";*/
-static char rcsid[] = "$Id: unstr.c,v 1.2 1993/08/01 18:54:39 mycroft Exp $";
+static char sccsid[] = "@(#)unstr.c 8.1 (Berkeley) 5/31/93";
#endif /* not lint */
/*
diff --git a/hack/COPYRIGHT b/hack/COPYRIGHT
index 71a94494..d71c09f5 100644
--- a/hack/COPYRIGHT
+++ b/hack/COPYRIGHT
@@ -1,3 +1,5 @@
+$NetBSD: COPYRIGHT,v 1.2 1995/03/23 08:29:05 cgd Exp $
+
This entire subtree is copyright the Stichting Mathematisch Centrum.
The following copyright notice applies to all files found here. None of
these files contain AT&T proprietary source code.
diff --git a/hack/Makefile b/hack/Makefile
index 8058104e..4fa0fc04 100644
--- a/hack/Makefile
+++ b/hack/Makefile
@@ -1,5 +1,5 @@
-# from: @(#)Makefile 5.10 (Berkeley) 12/8/90
-# $Id: Makefile,v 1.15 1994/12/22 09:34:30 cgd Exp $
+# $NetBSD: Makefile,v 1.16 1995/03/23 08:29:07 cgd Exp $
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
PROG= hack
CFLAGS+=-I.
diff --git a/hack/Makequest b/hack/Makequest
index 9271c284..256d8363 100644
--- a/hack/Makequest
+++ b/hack/Makequest
@@ -1,3 +1,5 @@
+# $NetBSD: Makequest,v 1.2 1995/03/23 08:29:08 cgd Exp $
+#
# Hack or Quest Makefile.
# on some systems the termcap library is in -ltermcap
diff --git a/hack/Original_READ_ME b/hack/Original_READ_ME
index 9d2070be..3787a9d1 100644
--- a/hack/Original_READ_ME
+++ b/hack/Original_READ_ME
@@ -1,3 +1,5 @@
+$NetBSD: Original_READ_ME,v 1.2 1995/03/23 08:29:10 cgd Exp $
+
This is export hack, my first semester programming project.
To set it up for your system, you will have to do the following:
diff --git a/hack/READ_ME b/hack/READ_ME
index cfe6ca2f..0f3aa89b 100644
--- a/hack/READ_ME
+++ b/hack/READ_ME
@@ -1,3 +1,5 @@
+$NetBSD: READ_ME,v 1.2 1995/03/23 08:29:12 cgd Exp $
+
Hack is a display oriented dungeons & dragons - like game.
Both display and command structure resemble rogue.
(For a game with the same structure but entirely different display -
diff --git a/hack/alloc.c b/hack/alloc.c
index 60bf4da5..f64cc195 100644
--- a/hack/alloc.c
+++ b/hack/alloc.c
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "$Id: alloc.c,v 1.2 1993/08/02 17:19:10 mycroft Exp $";
+static char rcsid[] = "$NetBSD: alloc.c,v 1.3 1995/03/23 08:29:14 cgd Exp $";
#endif /* not lint */
#ifdef LINT
diff --git a/hack/config.h b/hack/config.h
index 1af52672..f7bb5c5c 100644
--- a/hack/config.h
+++ b/hack/config.h
@@ -1,7 +1,7 @@
/*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
*
- * $Id: config.h,v 1.2 1993/08/02 17:16:36 mycroft Exp $
+ * $NetBSD: config.h,v 1.3 1995/03/23 08:29:15 cgd Exp $
*/
#include "pathnames.h"
diff --git a/hack/date.h b/hack/date.h
index 36df5333..0320b698 100644
--- a/hack/date.h
+++ b/hack/date.h
@@ -1,3 +1,3 @@
-/* $Id: date.h,v 1.2 1993/08/02 17:16:38 mycroft Exp $ */
+/* $NetBSD: date.h,v 1.3 1995/03/23 08:29:17 cgd Exp $ */
char datestring[] = "Tue Jul 23 1985";
diff --git a/hack/def.edog.h b/hack/def.edog.h
index 92eabfd1..00fa911f 100644
--- a/hack/def.edog.h
+++ b/hack/def.edog.h
@@ -1,7 +1,7 @@
/*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
*
- * $Id: def.edog.h,v 1.2 1993/08/02 17:16:39 mycroft Exp $
+ * $NetBSD: def.edog.h,v 1.3 1995/03/23 08:29:18 cgd Exp $
*/
struct edog {
diff --git a/hack/def.eshk.h b/hack/def.eshk.h
index 075be7df..781c3461 100644
--- a/hack/def.eshk.h
+++ b/hack/def.eshk.h
@@ -1,7 +1,7 @@
/*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
*
- * $Id: def.eshk.h,v 1.2 1993/08/02 17:16:41 mycroft Exp $
+ * $NetBSD: def.eshk.h,v 1.3 1995/03/23 08:29:21 cgd Exp $
*/
#define BILLSZ 200
diff --git a/hack/def.flag.h b/hack/def.flag.h
index 9401be49..2fff1d3f 100644
--- a/hack/def.flag.h
+++ b/hack/def.flag.h
@@ -1,7 +1,7 @@
/*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
*
- * $Id: def.flag.h,v 1.2 1993/08/02 17:16:42 mycroft Exp $
+ * $NetBSD: def.flag.h,v 1.3 1995/03/23 08:29:22 cgd Exp $
*/
struct flag {
diff --git a/hack/def.func_tab.h b/hack/def.func_tab.h
index ca1fd352..363c8f3b 100644
--- a/hack/def.func_tab.h
+++ b/hack/def.func_tab.h
@@ -1,7 +1,7 @@
/*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
*
- * $Id: def.func_tab.h,v 1.2 1993/08/02 17:16:43 mycroft Exp $
+ * $NetBSD: def.func_tab.h,v 1.3 1995/03/23 08:29:23 cgd Exp $
*/
struct func_tab {
diff --git a/hack/def.gen.h b/hack/def.gen.h
index 87323845..56e4832b 100644
--- a/hack/def.gen.h
+++ b/hack/def.gen.h
@@ -1,7 +1,7 @@
/*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
*
- * $Id: def.gen.h,v 1.2 1993/08/02 17:16:44 mycroft Exp $
+ * $NetBSD: def.gen.h,v 1.3 1995/03/23 08:29:25 cgd Exp $
*/
struct gen {
diff --git a/hack/def.gold.h b/hack/def.gold.h
index 5564d3b1..7333bdd5 100644
--- a/hack/def.gold.h
+++ b/hack/def.gold.h
@@ -1,7 +1,7 @@
/*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
*
- * $Id: def.gold.h,v 1.2 1993/08/02 17:16:45 mycroft Exp $
+ * $NetBSD: def.gold.h,v 1.3 1995/03/23 08:29:27 cgd Exp $
*/
struct gold {
diff --git a/hack/def.mkroom.h b/hack/def.mkroom.h
index 8b1ce799..45c21561 100644
--- a/hack/def.mkroom.h
+++ b/hack/def.mkroom.h
@@ -1,7 +1,7 @@
/*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
*
- * $Id: def.mkroom.h,v 1.2 1993/08/02 17:16:46 mycroft Exp $
+ * $NetBSD: def.mkroom.h,v 1.3 1995/03/23 08:29:29 cgd Exp $
*/
struct mkroom {
diff --git a/hack/def.monst.h b/hack/def.monst.h
index de545f30..6d883eaf 100644
--- a/hack/def.monst.h
+++ b/hack/def.monst.h
@@ -1,7 +1,7 @@
/*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
*
- * $Id: def.monst.h,v 1.2 1993/08/02 17:16:48 mycroft Exp $
+ * $NetBSD: def.monst.h,v 1.3 1995/03/23 08:29:30 cgd Exp $
*/
struct monst {
diff --git a/hack/def.obj.h b/hack/def.obj.h
index 818f0653..897046f2 100644
--- a/hack/def.obj.h
+++ b/hack/def.obj.h
@@ -1,7 +1,7 @@
/*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
*
- * $Id: def.obj.h,v 1.2 1993/08/02 17:16:49 mycroft Exp $
+ * $NetBSD: def.obj.h,v 1.3 1995/03/23 08:29:32 cgd Exp $
*/
struct obj {
diff --git a/hack/def.objclass.h b/hack/def.objclass.h
index fa79f68c..15f7f98d 100644
--- a/hack/def.objclass.h
+++ b/hack/def.objclass.h
@@ -1,7 +1,7 @@
/*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
*
- * $Id: def.objclass.h,v 1.2 1993/08/02 17:16:50 mycroft Exp $
+ * $NetBSD: def.objclass.h,v 1.3 1995/03/23 08:29:34 cgd Exp $
*/
/* definition of a class of objects */
diff --git a/hack/def.objects.h b/hack/def.objects.h
index a7b0138d..3876c2aa 100644
--- a/hack/def.objects.h
+++ b/hack/def.objects.h
@@ -1,7 +1,7 @@
/*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
*
- * $Id: def.objects.h,v 1.2 1993/08/02 17:16:51 mycroft Exp $
+ * $NetBSD: def.objects.h,v 1.3 1995/03/23 08:29:36 cgd Exp $
*/
/* objects have letter " % ) ( 0 _ ` [ ! ? / = * */
diff --git a/hack/def.permonst.h b/hack/def.permonst.h
index 2967c1ef..d3c75f47 100644
--- a/hack/def.permonst.h
+++ b/hack/def.permonst.h
@@ -1,7 +1,7 @@
/*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
*
- * $Id: def.permonst.h,v 1.2 1993/08/02 17:16:52 mycroft Exp $
+ * $NetBSD: def.permonst.h,v 1.3 1995/03/23 08:29:37 cgd Exp $
*/
struct permonst {
diff --git a/hack/def.rm.h b/hack/def.rm.h
index f9b6b4be..b4ffc81c 100644
--- a/hack/def.rm.h
+++ b/hack/def.rm.h
@@ -1,7 +1,7 @@
/*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
*
- * $Id: def.rm.h,v 1.2 1993/08/02 17:16:53 mycroft Exp $
+ * $NetBSD: def.rm.h,v 1.3 1995/03/23 08:29:39 cgd Exp $
*/
/* Level location types */
diff --git a/hack/def.trap.h b/hack/def.trap.h
index 34445669..55477e48 100644
--- a/hack/def.trap.h
+++ b/hack/def.trap.h
@@ -1,7 +1,7 @@
/*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
*
- * $Id: def.trap.h,v 1.2 1993/08/02 17:16:54 mycroft Exp $
+ * $NetBSD: def.trap.h,v 1.3 1995/03/23 08:29:41 cgd Exp $
*/
struct trap {
diff --git a/hack/def.wseg.h b/hack/def.wseg.h
index add0b243..35812db3 100644
--- a/hack/def.wseg.h
+++ b/hack/def.wseg.h
@@ -1,7 +1,7 @@
/*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
*
- * $Id: def.wseg.h,v 1.2 1993/08/02 17:16:55 mycroft Exp $
+ * $NetBSD: def.wseg.h,v 1.3 1995/03/23 08:29:42 cgd Exp $
*/
#ifndef NOWORM
diff --git a/hack/hack.6 b/hack/hack.6
index 36749408..42af6082 100644
--- a/hack/hack.6
+++ b/hack/hack.6
@@ -1,4 +1,4 @@
-.\" $Id: hack.6,v 1.3 1993/08/05 17:35:08 jtc Exp $ -*- nroff -*-
+.\" $NetBSD: hack.6,v 1.4 1995/03/23 08:29:44 cgd Exp $ -*- nroff -*-
.Dd March 31, 1985
.Dt HACK 6
.Os
@@ -32,13 +32,13 @@ To win the game (as opposed to merely playing to beat other people high
scores) you must locate the Amulet of Yendor which is somewhere below
the 20th level of the dungeon and get it out. Nobody has achieved this
yet and if somebody does, he will probably go down in history as a hero
-among heros.
+among heroes.
.Pp
When the game ends, either by your death, when you quit, or if you escape
from the caves,
.Nm hack
will give you (a fragment of) the list of top scorers. The scoring
-is based on many aspects of your behaviour but a rough estimate is
+is based on many aspects of your behavior but a rough estimate is
obtained by taking the amount of gold you've found in the cave plus four
times your (real) experience. Precious stones may be worth a lot of gold
when brought to the exit.
diff --git a/hack/hack.Decl.c b/hack/hack.Decl.c
index af66c621..c7688dc6 100644
--- a/hack/hack.Decl.c
+++ b/hack/hack.Decl.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.Decl.c,v 1.2 1993/08/02 17:16:57 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.Decl.c,v 1.3 1995/03/23 08:29:45 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.apply.c b/hack/hack.apply.c
index dc512905..46bdc64f 100644
--- a/hack/hack.apply.c
+++ b/hack/hack.apply.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.apply.c,v 1.3 1993/08/02 17:16:58 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.apply.c,v 1.4 1995/03/23 08:29:47 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.bones.c b/hack/hack.bones.c
index 75bd7cd0..b495294c 100644
--- a/hack/hack.bones.c
+++ b/hack/hack.bones.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.bones.c,v 1.2 1993/08/02 17:16:59 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.bones.c,v 1.3 1995/03/23 08:29:48 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.c b/hack/hack.c
index b8af9323..5261e183 100644
--- a/hack/hack.c
+++ b/hack/hack.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.c,v 1.2 1993/08/02 17:17:01 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.c,v 1.3 1995/03/23 08:29:50 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.cmd.c b/hack/hack.cmd.c
index f0034859..0af29895 100644
--- a/hack/hack.cmd.c
+++ b/hack/hack.cmd.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.cmd.c,v 1.2 1993/08/02 17:17:02 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.cmd.c,v 1.3 1995/03/23 08:29:52 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.do.c b/hack/hack.do.c
index 7e7fd765..aec8b911 100644
--- a/hack/hack.do.c
+++ b/hack/hack.do.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.do.c,v 1.2 1993/08/02 17:17:03 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.do.c,v 1.3 1995/03/23 08:29:53 cgd Exp $";
#endif /* not lint */
/* Contains code for 'd', 'D' (drop), '>', '<' (up, down) and 't' (throw) */
diff --git a/hack/hack.do_name.c b/hack/hack.do_name.c
index baf45a2f..313b5533 100644
--- a/hack/hack.do_name.c
+++ b/hack/hack.do_name.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.do_name.c,v 1.2 1993/08/02 17:17:05 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.do_name.c,v 1.3 1995/03/23 08:29:56 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.do_wear.c b/hack/hack.do_wear.c
index 84021b7d..2084b630 100644
--- a/hack/hack.do_wear.c
+++ b/hack/hack.do_wear.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.do_wear.c,v 1.2 1993/08/02 17:17:06 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.do_wear.c,v 1.3 1995/03/23 08:29:57 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.dog.c b/hack/hack.dog.c
index 06a23330..d9192a4c 100644
--- a/hack/hack.dog.c
+++ b/hack/hack.dog.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.dog.c,v 1.2 1993/08/02 17:17:07 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.dog.c,v 1.3 1995/03/23 08:29:59 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.eat.c b/hack/hack.eat.c
index 94a25b55..7745f63f 100644
--- a/hack/hack.eat.c
+++ b/hack/hack.eat.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.eat.c,v 1.2 1993/08/02 17:17:08 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.eat.c,v 1.3 1995/03/23 08:30:01 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.end.c b/hack/hack.end.c
index c103d945..20b77e4f 100644
--- a/hack/hack.end.c
+++ b/hack/hack.end.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.end.c,v 1.2 1993/08/02 17:17:10 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.end.c,v 1.3 1995/03/23 08:30:05 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.engrave.c b/hack/hack.engrave.c
index a51f9a5d..e32807d3 100644
--- a/hack/hack.engrave.c
+++ b/hack/hack.engrave.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.engrave.c,v 1.2 1993/08/02 17:17:11 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.engrave.c,v 1.3 1995/03/23 08:30:08 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.fight.c b/hack/hack.fight.c
index 1701915e..92d11c2e 100644
--- a/hack/hack.fight.c
+++ b/hack/hack.fight.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.fight.c,v 1.2 1993/08/02 17:17:12 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.fight.c,v 1.3 1995/03/23 08:30:12 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.fix b/hack/hack.fix
index 01e64602..c01616ce 100644
--- a/hack/hack.fix
+++ b/hack/hack.fix
@@ -1,3 +1,5 @@
+$NetBSD: hack.fix,v 1.2 1995/03/23 08:30:17 cgd Exp $
+
/***** unido:net.games.hack / ab / 7:23 pm Sep 13, 1985*/
Recently hack (1.0.3) crashed with core dumps during some good games.
diff --git a/hack/hack.h b/hack/hack.h
index 3acd6845..f097252f 100644
--- a/hack/hack.h
+++ b/hack/hack.h
@@ -1,7 +1,7 @@
/*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
*
- * $Id: hack.h,v 1.2 1993/08/02 17:17:14 mycroft Exp $
+ * $NetBSD: hack.h,v 1.3 1995/03/23 08:30:21 cgd Exp $
*/
#include "config.h"
diff --git a/hack/hack.invent.c b/hack/hack.invent.c
index e971d1a0..3cc42763 100644
--- a/hack/hack.invent.c
+++ b/hack/hack.invent.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.invent.c,v 1.3 1993/08/02 17:17:15 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.invent.c,v 1.4 1995/03/23 08:30:25 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.ioctl.c b/hack/hack.ioctl.c
index 714dcc51..af62748f 100644
--- a/hack/hack.ioctl.c
+++ b/hack/hack.ioctl.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.ioctl.c,v 1.3 1995/01/07 04:36:41 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.ioctl.c,v 1.4 1995/03/23 08:30:29 cgd Exp $";
#endif /* not lint */
/* This cannot be part of hack.tty.c (as it was earlier) since on some
diff --git a/hack/hack.lev.c b/hack/hack.lev.c
index d69ea65e..e15d39ee 100644
--- a/hack/hack.lev.c
+++ b/hack/hack.lev.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.lev.c,v 1.2 1993/08/02 17:17:17 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.lev.c,v 1.3 1995/03/23 08:30:32 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.main.c b/hack/hack.main.c
index ab6daa5c..cdec0b25 100644
--- a/hack/hack.main.c
+++ b/hack/hack.main.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.main.c,v 1.2 1993/08/02 17:17:18 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.main.c,v 1.3 1995/03/23 08:30:35 cgd Exp $";
#endif /* not lint */
#include <stdio.h>
diff --git a/hack/hack.makemon.c b/hack/hack.makemon.c
index 6b4df69f..f7fc0ecb 100644
--- a/hack/hack.makemon.c
+++ b/hack/hack.makemon.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.makemon.c,v 1.2 1993/08/02 17:17:19 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.makemon.c,v 1.3 1995/03/23 08:30:38 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.mfndpos.h b/hack/hack.mfndpos.h
index 8630dd2b..f7c98a3e 100644
--- a/hack/hack.mfndpos.h
+++ b/hack/hack.mfndpos.h
@@ -1,7 +1,7 @@
/*
* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
*
- * $Id: hack.mfndpos.h,v 1.2 1993/08/02 17:17:20 mycroft Exp $
+ * $NetBSD: hack.mfndpos.h,v 1.3 1995/03/23 08:30:41 cgd Exp $
*/
#define ALLOW_TRAPS 0777
diff --git a/hack/hack.mhitu.c b/hack/hack.mhitu.c
index a3b1393b..430bfa42 100644
--- a/hack/hack.mhitu.c
+++ b/hack/hack.mhitu.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.mhitu.c,v 1.2 1993/08/02 17:17:21 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.mhitu.c,v 1.3 1995/03/23 08:30:42 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.mklev.c b/hack/hack.mklev.c
index d6902143..5e8c7b51 100644
--- a/hack/hack.mklev.c
+++ b/hack/hack.mklev.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.mklev.c,v 1.2 1993/08/02 17:17:23 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.mklev.c,v 1.3 1995/03/23 08:30:43 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.mkmaze.c b/hack/hack.mkmaze.c
index 84a1453a..f69fe864 100644
--- a/hack/hack.mkmaze.c
+++ b/hack/hack.mkmaze.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.mkmaze.c,v 1.2 1993/08/02 17:17:24 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.mkmaze.c,v 1.3 1995/03/23 08:30:46 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.mkobj.c b/hack/hack.mkobj.c
index 788283a3..d4e37fd7 100644
--- a/hack/hack.mkobj.c
+++ b/hack/hack.mkobj.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.mkobj.c,v 1.2 1993/08/02 17:17:25 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.mkobj.c,v 1.3 1995/03/23 08:30:47 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.mkshop.c b/hack/hack.mkshop.c
index d11e9540..4ecc92af 100644
--- a/hack/hack.mkshop.c
+++ b/hack/hack.mkshop.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.mkshop.c,v 1.3 1993/08/02 17:17:26 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.mkshop.c,v 1.4 1995/03/23 08:30:50 cgd Exp $";
#endif /* not lint */
#include <stdlib.h>
diff --git a/hack/hack.mon.c b/hack/hack.mon.c
index c66c936f..de3ddb3c 100644
--- a/hack/hack.mon.c
+++ b/hack/hack.mon.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.mon.c,v 1.2 1993/08/02 17:17:28 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.mon.c,v 1.3 1995/03/23 08:30:57 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.monst.c b/hack/hack.monst.c
index 4869e55c..5cd23382 100644
--- a/hack/hack.monst.c
+++ b/hack/hack.monst.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.monst.c,v 1.2 1993/08/02 17:17:29 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.monst.c,v 1.3 1995/03/23 08:31:03 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.o_init.c b/hack/hack.o_init.c
index fb4f7396..ccda56b5 100644
--- a/hack/hack.o_init.c
+++ b/hack/hack.o_init.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.o_init.c,v 1.2 1993/08/02 17:17:30 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.o_init.c,v 1.3 1995/03/23 08:31:06 cgd Exp $";
#endif /* not lint */
#include "config.h" /* for typedefs */
diff --git a/hack/hack.objnam.c b/hack/hack.objnam.c
index 533ef17c..2ab2f2ae 100644
--- a/hack/hack.objnam.c
+++ b/hack/hack.objnam.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.objnam.c,v 1.2 1993/08/02 17:17:31 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.objnam.c,v 1.3 1995/03/23 08:31:10 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.options.c b/hack/hack.options.c
index 941fa58b..078ec7f0 100644
--- a/hack/hack.options.c
+++ b/hack/hack.options.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.options.c,v 1.2 1993/08/02 17:19:12 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.options.c,v 1.3 1995/03/23 08:31:14 cgd Exp $";
#endif /* not lint */
#include "config.h"
diff --git a/hack/hack.pager.c b/hack/hack.pager.c
index b9e4ba41..0e3d6817 100644
--- a/hack/hack.pager.c
+++ b/hack/hack.pager.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.pager.c,v 1.3 1995/02/28 18:31:36 jtc Exp $";
+static char rcsid[] = "$NetBSD: hack.pager.c,v 1.4 1995/03/23 08:31:16 cgd Exp $";
#endif /* not lint */
/* This file contains the command routine dowhatis() and a pager. */
diff --git a/hack/hack.potion.c b/hack/hack.potion.c
index 9b0d70f4..ed71901d 100644
--- a/hack/hack.potion.c
+++ b/hack/hack.potion.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.potion.c,v 1.2 1993/08/02 17:19:14 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.potion.c,v 1.3 1995/03/23 08:31:18 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.pri.c b/hack/hack.pri.c
index 7e5eb893..0a8606ac 100644
--- a/hack/hack.pri.c
+++ b/hack/hack.pri.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.pri.c,v 1.3 1993/12/02 03:07:18 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.pri.c,v 1.4 1995/03/23 08:31:20 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.read.c b/hack/hack.read.c
index 5c7840e1..7fbbf8a7 100644
--- a/hack/hack.read.c
+++ b/hack/hack.read.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.read.c,v 1.2 1993/08/02 17:19:17 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.read.c,v 1.3 1995/03/23 08:31:22 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.rip.c b/hack/hack.rip.c
index 8bb37559..ced3a27b 100644
--- a/hack/hack.rip.c
+++ b/hack/hack.rip.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.rip.c,v 1.3 1993/08/02 17:19:18 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.rip.c,v 1.4 1995/03/23 08:31:23 cgd Exp $";
#endif /* not lint */
#include <stdio.h>
diff --git a/hack/hack.rumors.c b/hack/hack.rumors.c
index e86142df..0ace09e2 100644
--- a/hack/hack.rumors.c
+++ b/hack/hack.rumors.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.rumors.c,v 1.2 1993/08/02 17:19:20 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.rumors.c,v 1.3 1995/03/23 08:31:24 cgd Exp $";
#endif /* not lint */
#include <stdio.h>
diff --git a/hack/hack.save.c b/hack/hack.save.c
index a60f6c6a..3e7a2543 100644
--- a/hack/hack.save.c
+++ b/hack/hack.save.c
@@ -3,13 +3,14 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.save.c,v 1.4 1994/03/28 11:21:12 cgd Exp $";
+static char rcsid[] = "$NetBSD: hack.save.c,v 1.5 1995/03/23 08:31:27 cgd Exp $";
#endif /* not lint */
#include "hack.h"
extern char genocided[60]; /* defined in Decl.c */
extern char fut_geno[60]; /* idem */
#include <signal.h>
+#include <unistd.h>
extern char SAVEF[], nul[];
extern char pl_character[PL_CSIZ];
@@ -137,7 +138,7 @@ register fd;
savelev(nfd,tmp);
(void) close(nfd);
}
- (void) lseek(fd, 0, 0);
+ (void) lseek(fd, (off_t)0, 0);
getlev(fd, 0, 0);
(void) close(fd);
(void) unlink(SAVEF);
diff --git a/hack/hack.search.c b/hack/hack.search.c
index 21803908..d1b77f72 100644
--- a/hack/hack.search.c
+++ b/hack/hack.search.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.search.c,v 1.2 1993/08/02 17:19:22 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.search.c,v 1.3 1995/03/23 08:31:28 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.sh b/hack/hack.sh
index 8136ec42..c3b734c8 100644
--- a/hack/hack.sh
+++ b/hack/hack.sh
@@ -1,4 +1,5 @@
#!/bin/sh
+# $NetBSD: hack.sh,v 1.2 1995/03/23 08:31:30 cgd Exp $
HACKDIR=/usr/games/lib/hackdir
HACK=$HACKDIR/hack
MAXNROFPLAYERS=4
diff --git a/hack/hack.shk.c b/hack/hack.shk.c
index ca6bb2a5..6e216b7a 100644
--- a/hack/hack.shk.c
+++ b/hack/hack.shk.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.shk.c,v 1.2 1993/08/02 17:19:23 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.shk.c,v 1.3 1995/03/23 08:31:31 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.shknam.c b/hack/hack.shknam.c
index 38cdaac3..152dbdb1 100644
--- a/hack/hack.shknam.c
+++ b/hack/hack.shknam.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.shknam.c,v 1.2 1993/08/02 17:19:25 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.shknam.c,v 1.3 1995/03/23 08:31:33 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.steal.c b/hack/hack.steal.c
index 0bb4f1cc..9fdae8f4 100644
--- a/hack/hack.steal.c
+++ b/hack/hack.steal.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.steal.c,v 1.2 1993/08/02 17:19:26 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.steal.c,v 1.3 1995/03/23 08:31:34 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.termcap.c b/hack/hack.termcap.c
index 3999cade..939514b7 100644
--- a/hack/hack.termcap.c
+++ b/hack/hack.termcap.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.termcap.c,v 1.2 1993/08/02 17:19:27 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.termcap.c,v 1.3 1995/03/23 08:31:36 cgd Exp $";
#endif /* not lint */
#include <stdio.h>
diff --git a/hack/hack.timeout.c b/hack/hack.timeout.c
index 38095f83..fa431368 100644
--- a/hack/hack.timeout.c
+++ b/hack/hack.timeout.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.timeout.c,v 1.2 1993/08/02 17:19:29 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.timeout.c,v 1.3 1995/03/23 08:31:37 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.topl.c b/hack/hack.topl.c
index 3c1b6f3b..bd671bc5 100644
--- a/hack/hack.topl.c
+++ b/hack/hack.topl.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.topl.c,v 1.2 1993/08/02 17:19:30 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.topl.c,v 1.3 1995/03/23 08:31:40 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.track.c b/hack/hack.track.c
index 5960ead6..1225d06c 100644
--- a/hack/hack.track.c
+++ b/hack/hack.track.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.track.c,v 1.2 1993/08/02 17:19:31 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.track.c,v 1.3 1995/03/23 08:31:42 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.trap.c b/hack/hack.trap.c
index 15983f97..dbcb1214 100644
--- a/hack/hack.trap.c
+++ b/hack/hack.trap.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.trap.c,v 1.2 1993/08/02 17:19:32 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.trap.c,v 1.3 1995/03/23 08:31:44 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.tty.c b/hack/hack.tty.c
index 1297c3c5..5a16f314 100644
--- a/hack/hack.tty.c
+++ b/hack/hack.tty.c
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1988 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1988, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +32,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)hack.tty.c 5.3 (Berkeley) 5/13/91";*/
-static char rcsid[] = "$Id: hack.tty.c,v 1.2 1993/08/01 18:54:35 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)hack.tty.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: hack.tty.c,v 1.3 1995/03/23 08:31:47 cgd Exp $";
+#endif
#endif /* not lint */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
diff --git a/hack/hack.u_init.c b/hack/hack.u_init.c
index 8cef4170..f61899d0 100644
--- a/hack/hack.u_init.c
+++ b/hack/hack.u_init.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.u_init.c,v 1.3 1993/08/02 17:19:33 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.u_init.c,v 1.4 1995/03/23 08:31:51 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.unix.c b/hack/hack.unix.c
index fdb8ae00..86308446 100644
--- a/hack/hack.unix.c
+++ b/hack/hack.unix.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.unix.c,v 1.2 1993/08/02 17:19:34 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.unix.c,v 1.3 1995/03/23 08:31:55 cgd Exp $";
#endif /* not lint */
/* This file collects some Unix dependencies; hack.pager.c contains some more */
diff --git a/hack/hack.vault.c b/hack/hack.vault.c
index 0c8a2671..4564d974 100644
--- a/hack/hack.vault.c
+++ b/hack/hack.vault.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.vault.c,v 1.2 1993/08/02 17:19:36 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.vault.c,v 1.3 1995/03/23 08:31:59 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.version.c b/hack/hack.version.c
index ee1381eb..538a0a7e 100644
--- a/hack/hack.version.c
+++ b/hack/hack.version.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.version.c,v 1.2 1993/08/02 17:19:37 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.version.c,v 1.3 1995/03/23 08:32:03 cgd Exp $";
#endif /* not lint */
#include "date.h"
diff --git a/hack/hack.wield.c b/hack/hack.wield.c
index da92119a..e0f40b64 100644
--- a/hack/hack.wield.c
+++ b/hack/hack.wield.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.wield.c,v 1.2 1993/08/02 17:19:38 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.wield.c,v 1.3 1995/03/23 08:32:06 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.wizard.c b/hack/hack.wizard.c
index caec93f7..984c8b63 100644
--- a/hack/hack.wizard.c
+++ b/hack/hack.wizard.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.wizard.c,v 1.2 1993/08/02 17:19:39 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.wizard.c,v 1.3 1995/03/23 08:32:09 cgd Exp $";
#endif /* not lint */
/* wizard code - inspired by rogue code from Merlyn Leroy (digi-g!brian) */
diff --git a/hack/hack.worm.c b/hack/hack.worm.c
index b88269e4..1849e387 100644
--- a/hack/hack.worm.c
+++ b/hack/hack.worm.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.worm.c,v 1.2 1993/08/02 17:19:40 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.worm.c,v 1.3 1995/03/23 08:32:12 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.worn.c b/hack/hack.worn.c
index 638befbe..6dd5c2b1 100644
--- a/hack/hack.worn.c
+++ b/hack/hack.worn.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.worn.c,v 1.2 1993/08/02 17:19:42 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.worn.c,v 1.3 1995/03/23 08:32:17 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/hack.zap.c b/hack/hack.zap.c
index 85b9dc38..a282dc0e 100644
--- a/hack/hack.zap.c
+++ b/hack/hack.zap.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: hack.zap.c,v 1.2 1993/08/02 17:19:43 mycroft Exp $";
+static char rcsid[] = "$NetBSD: hack.zap.c,v 1.3 1995/03/23 08:32:21 cgd Exp $";
#endif /* not lint */
#include "hack.h"
diff --git a/hack/makedefs.c b/hack/makedefs.c
index 05d685ed..550e3e95 100644
--- a/hack/makedefs.c
+++ b/hack/makedefs.c
@@ -3,7 +3,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: makedefs.c,v 1.2 1993/08/02 17:19:44 mycroft Exp $";
+static char rcsid[] = "$NetBSD: makedefs.c,v 1.3 1995/03/23 08:32:24 cgd Exp $";
#endif /* not lint */
#include <stdio.h>
diff --git a/hack/pathnames.h b/hack/pathnames.h
index 3b4b81dd..37c496e9 100644
--- a/hack/pathnames.h
+++ b/hack/pathnames.h
@@ -1,6 +1,8 @@
+/* $NetBSD: pathnames.h,v 1.3 1995/03/23 08:32:27 cgd Exp $ */
+
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,8 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * from: @(#)pathnames.h 5.1 (Berkeley) 5/2/90
- * $Id: pathnames.h,v 1.2 1993/08/01 18:54:34 mycroft Exp $
+ * @(#)pathnames.h 8.1 (Berkeley) 5/31/93
*/
#define _PATH_MAIL "/usr/bin/mail"
diff --git a/hack/rnd.c b/hack/rnd.c
index d90970af..6bdd0aba 100644
--- a/hack/rnd.c
+++ b/hack/rnd.c
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "$Id: rnd.c,v 1.2 1993/08/02 17:19:45 mycroft Exp $";
+static char rcsid[] = "$NetBSD: rnd.c,v 1.3 1995/03/23 08:32:28 cgd Exp $";
#endif /* not lint */
#define RND(x) ((random()>>3) % x)
diff --git a/hangman/Makefile b/hangman/Makefile
index 7785f294..1c965e92 100644
--- a/hangman/Makefile
+++ b/hangman/Makefile
@@ -1,5 +1,5 @@
-# from: @(#)Makefile 5.7 (Berkeley) 5/11/90
-# $Id: Makefile,v 1.4 1994/12/22 09:34:37 cgd Exp $
+# $NetBSD: Makefile,v 1.5 1995/03/23 08:32:38 cgd Exp $
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
PROG= hangman
SRCS= endgame.c extern.c getguess.c getword.c main.c playgame.c \
diff --git a/hangman/endgame.c b/hangman/endgame.c
index 8fb634ae..300c0efb 100644
--- a/hangman/endgame.c
+++ b/hangman/endgame.c
@@ -1,6 +1,8 @@
+/* $NetBSD: endgame.c,v 1.3 1995/03/23 08:32:40 cgd Exp $ */
+
/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)endgame.c 5.3 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: endgame.c,v 1.2 1993/08/01 18:54:28 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)endgame.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: endgame.c,v 1.3 1995/03/23 08:32:40 cgd Exp $";
+#endif
#endif /* not lint */
# include "hangman.h"
@@ -70,5 +75,17 @@ endgame()
leaveok(stdscr, TRUE);
move(MESGY, MESGX);
- addstr("\n\n\n");
+ deleteln();
+ deleteln();
+ deleteln();
}
+
+
+
+
+
+
+
+
+
+
diff --git a/hangman/extern.c b/hangman/extern.c
index 91b70d45..2d5f0082 100644
--- a/hangman/extern.c
+++ b/hangman/extern.c
@@ -1,6 +1,8 @@
+/* $NetBSD: extern.c,v 1.3 1995/03/23 08:32:41 cgd Exp $ */
+
/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)extern.c 5.3 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: extern.c,v 1.2 1993/08/01 18:54:27 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)extern.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: extern.c,v 1.3 1995/03/23 08:32:41 cgd Exp $";
+#endif
#endif /* not lint */
# include "hangman.h"
diff --git a/hangman/getguess.c b/hangman/getguess.c
index d8c5cc02..e7a31acd 100644
--- a/hangman/getguess.c
+++ b/hangman/getguess.c
@@ -1,6 +1,8 @@
+/* $NetBSD: getguess.c,v 1.5 1995/03/23 08:32:43 cgd Exp $ */
+
/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,12 +34,15 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)getguess.c 5.4 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: getguess.c,v 1.4 1993/11/10 15:28:25 cgd Exp $";
+#if 0
+static char sccsid[] = "@(#)getguess.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: getguess.c,v 1.5 1995/03/23 08:32:43 cgd Exp $";
+#endif
#endif /* not lint */
-# include <termios.h>
-# include "hangman.h"
+#include <sys/ttydefaults.h>
+#include "hangman.h"
/*
* getguess:
@@ -102,7 +107,8 @@ readch()
else if (ch == CTRL('L')) {
wrefresh(curscr);
mvcur(0, 0, curscr->cury, curscr->curx);
- } else
+ }
+ else
return ch;
}
}
diff --git a/hangman/getword.c b/hangman/getword.c
index c54d293d..e858fabe 100644
--- a/hangman/getword.c
+++ b/hangman/getword.c
@@ -1,6 +1,8 @@
+/* $NetBSD: getword.c,v 1.4 1995/03/23 08:32:45 cgd Exp $ */
+
/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,17 +34,15 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)getword.c 5.3 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: getword.c,v 1.3 1994/06/29 21:22:50 deraadt Exp $";
+#if 0
+static char sccsid[] = "@(#)getword.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: getword.c,v 1.4 1995/03/23 08:32:45 cgd Exp $";
+#endif
#endif /* not lint */
-# include "hangman.h"
-
-# if pdp11
-# define RN (((off_t) rand() << 16) | (off_t) rand())
-# else
-# define RN rand()
-# endif
+#include "hangman.h"
+#include <stdlib.h>
/*
* getword:
@@ -52,10 +52,12 @@ getword()
{
register FILE *inf;
register char *wp, *gp;
+ register long pos;
inf = Dict;
for (;;) {
- fseek(inf, abs(RN % Dict_size), 0);
+ pos = (double)rand() / (RAND_MAX + 1.0) * (double)Dict_size;
+ fseek(inf, pos, 0);
if (fgets(Word, BUFSIZ, inf) == NULL)
continue;
if (fgets(Word, BUFSIZ, inf) == NULL)
diff --git a/hangman/hangman.6 b/hangman/hangman.6
index be0573dd..42040574 100644
--- a/hangman/hangman.6
+++ b/hangman/hangman.6
@@ -1,5 +1,7 @@
-.\" Copyright (c) 1983 The Regents of the University of California.
-.\" All rights reserved.
+.\" $NetBSD: hangman.6,v 1.5 1995/03/23 08:32:46 cgd Exp $
+.\"
+.\" Copyright (c) 1983, 1993
+.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
@@ -29,10 +31,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" from: @(#)hangman.6 6.3 (Berkeley) 6/23/90
-.\" $Id: hangman.6,v 1.4 1993/09/16 17:02:51 jtc Exp $
+.\" @(#)hangman.6 8.1 (Berkeley) 5/31/93
.\"
-.Dd June 23, 1990
+.Dd May 31, 1993
.Dt HANGMAN 6
.Os
.Sh NAME
diff --git a/hangman/hangman.h b/hangman/hangman.h
index e8dbffd6..7d7bf484 100644
--- a/hangman/hangman.h
+++ b/hangman/hangman.h
@@ -1,6 +1,8 @@
+/* $NetBSD: hangman.h,v 1.4 1995/03/23 08:32:48 cgd Exp $ */
+
/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,8 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * from: @(#)hangman.h 5.5 (Berkeley) 2/28/91
- * $Id: hangman.h,v 1.3 1994/06/29 21:22:52 deraadt Exp $
+ * @(#)hangman.h 8.1 (Berkeley) 5/31/93
*/
# include <curses.h>
diff --git a/hangman/main.c b/hangman/main.c
index a4a44d5a..3da3bac1 100644
--- a/hangman/main.c
+++ b/hangman/main.c
@@ -1,6 +1,8 @@
+/* $NetBSD: main.c,v 1.3 1995/03/23 08:32:50 cgd Exp $ */
+
/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,14 +34,17 @@
*/
#ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1983 Regents of the University of California.\n\
- All rights reserved.\n";
+static char copyright[] =
+"@(#) Copyright (c) 1983, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
-/*static char sccsid[] = "from: @(#)main.c 5.4 (Berkeley) 2/28/91";*/
-static char rcsid[] = "$Id: main.c,v 1.2 1993/08/01 18:54:24 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: main.c,v 1.3 1995/03/23 08:32:50 cgd Exp $";
+#endif
#endif /* not lint */
# include "hangman.h"
diff --git a/hangman/pathnames.h b/hangman/pathnames.h
index e46fc9b6..5b539e37 100644
--- a/hangman/pathnames.h
+++ b/hangman/pathnames.h
@@ -1,6 +1,8 @@
+/* $NetBSD: pathnames.h,v 1.3 1995/03/23 08:32:51 cgd Exp $ */
+
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,8 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * from: @(#)pathnames.h 5.1 (Berkeley) 6/1/90
- * $Id: pathnames.h,v 1.2 1993/08/01 18:54:29 mycroft Exp $
+ * @(#)pathnames.h 8.1 (Berkeley) 5/31/93
*/
#define _PATH_DICT "/usr/share/dict/words"
diff --git a/hangman/playgame.c b/hangman/playgame.c
index 2663923a..5a591520 100644
--- a/hangman/playgame.c
+++ b/hangman/playgame.c
@@ -1,6 +1,8 @@
+/* $NetBSD: playgame.c,v 1.3 1995/03/23 08:32:53 cgd Exp $ */
+
/*-
- * Copyright (c) 1983 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)playgame.c 5.3 (Berkeley) 4/8/91";*/
-static char rcsid[] = "$Id: playgame.c,v 1.2 1993/08/01 18:54:23 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)playgame.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: playgame.c,v 1.3 1995/03/23 08:32:53 cgd Exp $";
+#endif
#endif /* not lint */
# include "hangman.h"
diff --git a/hangman/prdata.c b/hangman/prdata.c
index 02321d0a..adfff8f3 100644
--- a/hangman/prdata.c
+++ b/hangman/prdata.c
@@ -1,6 +1,8 @@
+/* $NetBSD: prdata.c,v 1.3 1995/03/23 08:32:54 cgd Exp $ */
+
/*-
- * Copyright (c) 1983 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)prdata.c 5.3 (Berkeley) 4/8/91";*/
-static char rcsid[] = "$Id: prdata.c,v 1.2 1993/08/01 18:54:23 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)prdata.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: prdata.c,v 1.3 1995/03/23 08:32:54 cgd Exp $";
+#endif
#endif /* not lint */
# include "hangman.h"
diff --git a/hangman/prman.c b/hangman/prman.c
index a740f053..2337b639 100644
--- a/hangman/prman.c
+++ b/hangman/prman.c
@@ -1,6 +1,8 @@
+/* $NetBSD: prman.c,v 1.3 1995/03/23 08:32:56 cgd Exp $ */
+
/*-
- * Copyright (c) 1983 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)prman.c 5.3 (Berkeley) 4/8/91";*/
-static char rcsid[] = "$Id: prman.c,v 1.2 1993/08/01 18:54:22 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)prman.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: prman.c,v 1.3 1995/03/23 08:32:56 cgd Exp $";
+#endif
#endif /* not lint */
# include "hangman.h"
diff --git a/hangman/prword.c b/hangman/prword.c
index 0efbb3bb..ba2ab634 100644
--- a/hangman/prword.c
+++ b/hangman/prword.c
@@ -1,6 +1,8 @@
+/* $NetBSD: prword.c,v 1.3 1995/03/23 08:32:58 cgd Exp $ */
+
/*-
- * Copyright (c) 1983 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)prword.c 5.3 (Berkeley) 4/8/91";*/
-static char rcsid[] = "$Id: prword.c,v 1.2 1993/08/01 18:54:21 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)prword.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: prword.c,v 1.3 1995/03/23 08:32:58 cgd Exp $";
+#endif
#endif /* not lint */
# include "hangman.h"
diff --git a/hangman/setup.c b/hangman/setup.c
index d119e755..73c835f9 100644
--- a/hangman/setup.c
+++ b/hangman/setup.c
@@ -1,6 +1,8 @@
+/* $NetBSD: setup.c,v 1.3 1995/03/23 08:32:59 cgd Exp $ */
+
/*-
- * Copyright (c) 1983 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)setup.c 5.4 (Berkeley) 4/8/91";*/
-static char rcsid[] = "$Id: setup.c,v 1.2 1993/08/01 18:54:20 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)setup.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: setup.c,v 1.3 1995/03/23 08:32:59 cgd Exp $";
+#endif
#endif /* not lint */
# include "hangman.h"
diff --git a/larn/COPYRIGHT b/larn/COPYRIGHT
index 43ff637d..2f66c0fc 100644
--- a/larn/COPYRIGHT
+++ b/larn/COPYRIGHT
@@ -1,3 +1,5 @@
+$NetBSD: COPYRIGHT,v 1.2 1995/03/23 08:33:02 cgd Exp $
+
This entire subtree is copyright by Noah Morgan.
The following copyright notice applies to all files found here. None of
these files contain AT&T proprietary source code.
diff --git a/larn/Fixed.Bugs b/larn/Fixed.Bugs
index d2acae0a..e1bc278f 100644
--- a/larn/Fixed.Bugs
+++ b/larn/Fixed.Bugs
@@ -1,3 +1,5 @@
+$NetBSD: Fixed.Bugs,v 1.2 1995/03/23 08:33:03 cgd Exp $
+
This is a list of the fixes/enhancements made to larn V11.0 in Version 12.0.
(Version numbers consist of 2 parts: ver.subver. When the save file format
changes, ver must be bumped. This is why the next release of Larn is 12.0
diff --git a/larn/Makefile b/larn/Makefile
index 4ad920ae..04739f97 100644
--- a/larn/Makefile
+++ b/larn/Makefile
@@ -1,5 +1,5 @@
-# from: @(#)Makefile 5.9 (Berkeley) 7/25/90
-# $Id: Makefile,v 1.6 1994/12/22 09:34:45 cgd Exp $
+# $NetBSD: Makefile,v 1.7 1995/03/23 08:33:05 cgd Exp $
+# @(#)Makefile 5.12 (Berkeley) 5/30/93
# EXTRA
# Incorporates code to gather additional performance statistics
@@ -54,7 +54,7 @@
PROG= larn
MAN= larn.6
-CFLAGS+=-DBSD -DVER=12 -DSUBVER=0 -DNONAP
+CFLAGS+=-DBSD -DVER=12 -DSUBVER=0 -DNONAP -DUIDSCORE
SRCS= main.c object.c create.c tok.c display.c global.c data.c io.c \
monster.c store.c diag.c help.c config.c nap.c bill.c scores.c \
signal.c moreobj.c movem.c regen.c fortune.c savelev.c
@@ -63,14 +63,6 @@ LDADD= -ltermcap -lcompat
HIDEGAME=hidegame
beforeinstall:
- @if [ ! -d ${DESTDIR}/usr/share/games/larn ]; then \
- /bin/rm -f ${DESTDIR}/usr/share/games/larn ; \
- mkdir -p ${DESTDIR}/usr/share/games/larn ; \
- chown root.wheel ${DESTDIR}/usr/share/games/larn ; \
- chmod 755 ${DESTDIR}/usr/share/games/larn ; \
- else \
- true ; \
- fi
(cd ${.CURDIR}/datfiles; install -c -o ${BINOWN} -g ${BINGRP} -m 444 \
larnmaze larnopts lfortune larn.help \
${DESTDIR}/usr/share/games/larn)
diff --git a/larn/README b/larn/README
index 71e477b3..5abeadbb 100644
--- a/larn/README
+++ b/larn/README
@@ -1,3 +1,5 @@
+$NetBSD: README,v 1.2 1995/03/23 08:33:07 cgd Exp $
+
Larn is a dungeon type game program. Larn is a adventure/action game similar
in concept to rogue or hack, but with a much different feel.
Try it, you'll like it!
diff --git a/larn/bill.c b/larn/bill.c
index 3336a06f..53625023 100644
--- a/larn/bill.c
+++ b/larn/bill.c
@@ -1,136 +1,162 @@
-#ifndef lint
-static char rcsid[] = "$Id: bill.c,v 1.2 1993/08/02 17:19:54 mycroft Exp $";
-#endif /* not lint */
+/* $NetBSD: bill.c,v 1.3 1995/03/23 08:33:10 cgd Exp $ */
-#include "header.h"
-/* bill.c "Larn is copyrighted 1986 by Noah Morgan. */
-static char mail600[32];
-/*
- * function to create the tax bill for the user
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * 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. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
*/
-static int pid;
-static letter1()
- {
- sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */
- if (lcreat(mail600) < 0) { write(1,"can't write 600 letter\n",23); return(0);}
- lprcat("\n\n\n\n\n\n\n\n\n\n\n\n");
- standout("From:"); lprcat(" the LRS (Larn Revenue Service)\n");
- standout("\nSubject:"); lprcat(" undeclared income\n");
- lprcat("\n We heard you survived the caverns of Larn. Let me be the");
- lprcat("\nfirst to congratulate you on your success. It is quite a feat.");
- lprcat("\nIt must also have been very profitable for you.");
- lprcat("\n\n The Dungeon Master has informed us that you brought");
- lprintf("\n%d gold pieces back with you from your journey. As the",(long)c[GOLD]);
- lprcat("\ncounty of Larn is in dire need of funds, we have spared no time");
- lprintf("\nin preparing your tax bill. You owe %d gold pieces as",
- (long)c[GOLD]*TAXRATE);
- lprcat("\nof this notice, and is due within 5 days. Failure to pay will");
- lprcat("\nmean penalties. Once again, congratulations, We look forward");
- lprcat("\nto your future successful expeditions.\n");
- lwclose(); return(1);
- }
-
-static letter2()
- {
- sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */
- if (lcreat(mail600) < 0) { write(1,"can't write 601 letter\n",23); return(0);}
- lprcat("\n\n\n\n\n\n\n\n\n\n\n\n");
- standout("From:"); lprcat(" His Majesty King Wilfred of Larndom\n");
- standout("\nSubject:"); lprcat(" a noble deed\n");
- lprcat("\n I have heard of your magnificent feat, and I, King Wilfred,");
- lprcat("\nforthwith declare today to be a national holiday. Furthermore,");
- lprcat("\nhence three days, Ye be invited to the castle to receive the");
- lprcat("\nhonour of Knight of the realm. Upon thy name shall it be written. . .");
- lprcat("\nBravery and courage be yours.");
- lprcat("\nMay you live in happiness forevermore . . .\n");
- lwclose(); return(1);
- }
-static letter3()
- {
- sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */
- if (lcreat(mail600) < 0) { write(1,"can't write 602 letter\n",23); return(0);}
- lprcat("\n\n\n\n\n\n\n\n\n\n\n\n");
- standout("From:"); lprcat(" Count Endelford\n");
- standout("\nSubject:"); lprcat(" You Bastard!\n");
- lprcat("\n I heard (from sources) of your journey. Congratulations!");
- lprcat("\nYou Bastard! With several attempts I have yet to endure the");
- lprcat(" caves,\nand you, a nobody, makes the journey! From this time");
- lprcat(" onward, bewarned\nupon our meeting you shall pay the price!\n");
- lwclose(); return(1);
- }
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)bill.c 5.2 (Berkeley) 5/28/91";
+#else
+static char rcsid[] = "$NetBSD: bill.c,v 1.3 1995/03/23 08:33:10 cgd Exp $";
+#endif
+#endif /* not lint */
-static letter4()
- {
- sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */
- if (lcreat(mail600) < 0) { write(1,"can't write 603 letter\n",23); return(0);}
- lprcat("\n\n\n\n\n\n\n\n\n\n\n\n");
- standout("From:"); lprcat(" Mainair, Duke of Larnty\n");
- standout("\nSubject:"); lprcat(" High Praise\n");
- lprcat("\n With a certainty a hero I declare to be amongst us! A nod of");
- lprcat("\nfavour I send to thee. Me thinks Count Endelford this day of");
- lprcat("\nright breath'eth fire as of dragon of whom ye are slayer. I");
- lprcat("\nyearn to behold his anger and jealously. Should ye choose to");
- lprcat("\nunleash some of thy wealth upon those who be unfortunate, I,");
- lprcat("\nDuke Mainair, Shall equal thy gift also.\n");
- lwclose(); return(1);
- }
+#include <sys/file.h>
+#include <sys/wait.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include "header.h"
-static letter5()
- {
- sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */
- if (lcreat(mail600) < 0) { write(1,"can't write 604 letter\n",23); return(0);}
- lprcat("\n\n\n\n\n\n\n\n\n\n\n\n");
- standout("From:"); lprcat(" St. Mary's Children's Home\n");
- standout("\nSubject:"); lprcat(" these poor children\n");
- lprcat("\n News of your great conquests has spread to all of Larndom.");
- lprcat("\nMight I have a moment of a great man's time. We here at St.");
- lprcat("\nMary's Children's Home are very poor, and many children are");
- lprcat("\nstarving. Disease is widespread and very often fatal without");
- lprcat("\ngood food. Could you possibly find it in your heart to help us");
- lprcat("\nin our plight? Whatever you could give will help much.");
- lprcat("\n(your gift is tax deductible)\n");
- lwclose(); return(1);
- }
+/* bill.c Larn is copyrighted 1986 by Noah Morgan. */
-static letter6()
- {
- sprintf(mail600,"/tmp/#%dmail600",pid); /* prepare path */
- if (lcreat(mail600) < 0) { write(1,"can't write 605 letter\n",23); return(0);}
- lprcat("\n\n\n\n\n\n\n\n\n\n\n\n");
- standout("From:"); lprcat(" The National Cancer Society of Larn\n");
- standout("\nSubject:"); lprcat(" hope\n");
- lprcat("\nCongratulations on your successful expedition. We are sure much");
- lprcat("\ncourage and determination were needed on your quest. There are");
- lprcat("\nmany though, that could never hope to undertake such a journey");
- lprcat("\ndue to an enfeebling disease -- cancer. We at the National");
- lprcat("\nCancer Society of Larn wish to appeal to your philanthropy in");
- lprcat("\norder to save many good people -- possibly even yourself a few");
- lprcat("\nyears from now. Much work needs to be done in researching this");
- lprcat("\ndreaded disease, and you can help today. Could you please see it");
- lprcat("\nin your heart to give generously? Your continued good health");
- lprcat("\ncan be your everlasting reward.\n");
- lwclose(); return(1);
- }
+char *mail[] = {
+ "From: the LRS (Larn Revenue Service)\n",
+ "~s undeclared income\n",
+ "\n We have heard you survived the caverns of Larn. Let me be the",
+ "\nfirst to congratulate you on your success. It was quite a feat.",
+ "\nIt was also very profitable for you...",
+ "\n\n The Dungeon Master has informed us that you brought",
+ "1",
+ "\ncounty of Larn is in dire need of funds, we have spared no time",
+ "2",
+ "\nof this notice, and is due within 5 days. Failure to pay will",
+ "\nmean penalties. Once again, congratulations, We look forward",
+ "\nto your future successful expeditions.\n",
+ NULL,
+ "From: His Majesty King Wilfred of Larndom\n",
+ "~s a noble deed\n",
+ "\n I have heard of your magnificent feat, and I, King Wilfred,",
+ "\nforthwith declare today to be a national holiday. Furthermore,",
+ "\nhence three days, ye be invited to the castle to receive the",
+ "\nhonour of Knight of the realm. Upon thy name shall it be written...",
+ "\n\nBravery and courage be yours.",
+ "\n\nMay you live in happiness forevermore...\n",
+ NULL,
+ "From: Count Endelford\n",
+ "~s You Bastard!\n",
+ "\n I have heard (from sources) of your journey. Congratulations!",
+ "\nYou Bastard! With several attempts I have yet to endure the",
+ " caves,\nand you, a nobody, makes the journey! From this time",
+ " onward, bewarned\nupon our meeting you shall pay the price!\n",
+ NULL,
+ "From: Mainair, Duke of Larnty\n",
+ "~s High Praise\n",
+ "\n With certainty, a hero I declare to be amongst us! A nod of",
+ "\nfavour I send to thee. Me thinks Count Endelford this day of",
+ "\nright breath'eth fire as of dragon of whom ye are slayer. I",
+ "\nyearn to behold his anger and jealously. Should ye choose to",
+ "\nunleash some of thy wealth upon those who be unfortunate, I,",
+ "\nDuke Mainair, shall equal thy gift also.\n",
+ NULL,
+ "From: St. Mary's Children's Home\n",
+ "~s these poor children\n",
+ "\n News of your great conquests has spread to all of Larndom.",
+ "\nMight I have a moment of a great adventurers's time? We here at",
+ "\nSt. Mary's Children's Home are very poor, and many children are",
+ "\nstarving. Disease is widespread and very often fatal without",
+ "\ngood food. Could you possibly find it in your heart to help us",
+ "\nin our plight? Whatever you could give will help much.",
+ "\n(your gift is tax deductible)\n",
+ NULL,
+ "From: The National Cancer Society of Larn\n",
+ "~s hope\n",
+ "\nCongratulations on your successful expedition. We are sure much",
+ "\ncourage and determination were needed on your quest. There are",
+ "\nmany though, that could never hope to undertake such a journey",
+ "\ndue to an enfeebling disease -- cancer. We at the National",
+ "\nCancer Society of Larn wish to appeal to your philanthropy in",
+ "\norder to save many good people -- possibly even yourself a few",
+ "\nyears from now. Much work needs to be done in researching this",
+ "\ndreaded disease, and you can help today. Could you please see it",
+ "\nin your heart to give generously? Your continued good health",
+ "\ncan be your everlasting reward.\n",
+ NULL
+};
/*
* function to mail the letters to the player if a winner
*/
-static int (*pfn[])()= { letter1, letter2, letter3, letter4, letter5, letter6 };
+
+void
mailbill()
- {
+{
register int i;
+ char fname[32];
char buf[128];
- wait(0); pid=getpid();
- if (fork() == 0)
- {
+ char **cp;
+ int fd;
+
+ wait(0);
+ if (fork() == 0) {
resetscroll();
- for (i=0; i<sizeof(pfn)/sizeof(int (*)()); i++)
- if ((*pfn[i])())
- {
- sleep(20); sprintf(buf,"mail %s < %s",loginname,mail600);
- system(buf); unlink(mail600);
- }
- exit();
+ cp = mail;
+ sprintf(fname, "/tmp/#%dlarnmail", getpid());
+ for (i = 0; i < 6; i++) {
+ if ((fd = open(fname, O_WRONLY | O_TRUNC | O_CREAT),
+ 0666) == -1)
+ exit(0);
+ while (*cp != NULL) {
+ if (*cp[0] == '1') {
+ sprintf(buf, "\n%d gold pieces back with you from your journey. As the",
+ (long)c[GOLD]);
+ write(fd, buf, strlen(buf));
+ } else if (*cp[0] == '2') {
+ sprintf(buf, "\nin preparing your tax bill. You owe %d gold pieces as", (long)c[GOLD]*TAXRATE);
+ write(fd, buf, strlen(buf));
+ } else
+ write(fd, *cp, strlen(*cp));
+ cp++;
+ }
+ cp++;
+
+ close(fd);
+ sprintf(buf, "mail -I %s < %s > /dev/null",
+ loginname, fname);
+ system(buf);
+ unlink(fname);
}
}
+ exit(0);
+}
diff --git a/larn/config.c b/larn/config.c
index cb8b7d2b..bf29e4dc 100644
--- a/larn/config.c
+++ b/larn/config.c
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "$Id: config.c,v 1.2 1993/08/02 17:19:56 mycroft Exp $";
+static char rcsid[] = "$NetBSD: config.c,v 1.3 1995/03/23 08:33:12 cgd Exp $";
#endif /* not lint */
/*
diff --git a/larn/create.c b/larn/create.c
index ea809a2c..32426589 100644
--- a/larn/create.c
+++ b/larn/create.c
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "$Id: create.c,v 1.2 1993/08/02 17:19:57 mycroft Exp $";
+static char rcsid[] = "$NetBSD: create.c,v 1.3 1995/03/23 08:33:14 cgd Exp $";
#endif /* not lint */
/* create.c Larn is copyrighted 1986 by Noah Morgan. */
diff --git a/larn/data.c b/larn/data.c
index f3ed901d..e0e7d43f 100644
--- a/larn/data.c
+++ b/larn/data.c
@@ -1,3 +1,5 @@
+/* $NetBSD: data.c,v 1.5 1995/03/23 08:33:17 cgd Exp $ */
+
/*-
* Copyright (c) 1988 The Regents of the University of California.
* All rights reserved.
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)data.c 5.3 (Berkeley) 5/13/91";*/
-static char rcsid[] = "$Id: data.c,v 1.4 1994/10/23 05:21:43 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)data.c 5.3 (Berkeley) 5/13/91";
+#else
+static char rcsid[] = "$NetBSD: data.c,v 1.5 1995/03/23 08:33:17 cgd Exp $";
+#endif
#endif /* not lint */
/* data.c Larn is copyrighted 1986 by Noah Morgan. */
diff --git a/larn/diag.c b/larn/diag.c
index 57c8c47f..bc4dda74 100644
--- a/larn/diag.c
+++ b/larn/diag.c
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "$Id: diag.c,v 1.4 1994/10/21 21:26:06 mycroft Exp $";
+static char rcsid[] = "$NetBSD: diag.c,v 1.5 1995/03/23 08:33:20 cgd Exp $";
#endif /* not lint */
/* diag.c Larn is copyrighted 1986 by Noah Morgan. */
diff --git a/larn/display.c b/larn/display.c
index 25c52979..adfcefe3 100644
--- a/larn/display.c
+++ b/larn/display.c
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "$Id: display.c,v 1.2 1993/08/02 17:19:59 mycroft Exp $";
+static char rcsid[] = "$NetBSD: display.c,v 1.3 1995/03/23 08:33:21 cgd Exp $";
#endif /* not lint */
/* display.c Larn is copyrighted 1986 by Noah Morgan. */
diff --git a/larn/fortune.c b/larn/fortune.c
index 0efd4418..54a7a955 100644
--- a/larn/fortune.c
+++ b/larn/fortune.c
@@ -1,67 +1,91 @@
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * 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. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
#ifndef lint
-static char rcsid[] = "$Id: fortune.c,v 1.2 1993/08/02 17:20:00 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)fortune.c 5.5 (Berkeley) 6/10/91";
+#else
+static char rcsid[] = "$NetBSD: fortune.c,v 1.3 1995/03/23 08:33:23 cgd Exp $";
+#endif
#endif /* not lint */
/* fortune.c Larn is copyrighted 1986 by Noah Morgan. */
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include "header.h"
/*
- * function to return a random fortune from the fortune file
+ * function to return a random fortune from the fortune file
*/
-static char *base=0; /* pointer to the fortune text */
-static char **flines=0; /* array of pointers to each fortune */
-static int fd=0; /* true if we have load the fortune info */
-static int nlines=0; /* # lines in fortune database */
-
-char *fortune(file)
- char *file;
- {
- register char *p;
- register int lines,tmp;
- struct stat stat;
- char *malloc();
- if (fd==0)
- {
- if ((fd=open(file,O_RDONLY)) < 0) /* open the file */
- return(0); /* can't find file */
-
- /* find out how big fortune file is and get memory for it */
- stat.st_size = 16384;
- if ((fstat(fd,&stat) < 0) || ((base=malloc(1+stat.st_size)) == 0))
- {
- close(fd); fd= -1; free((char*)base); return(0); /* can't stat file */
- }
-
- /* read in the entire fortune file */
- if (read(fd,base,stat.st_size) != stat.st_size)
- {
- close(fd); fd= -1; free((char*)base); return(0); /* can't read file */
- }
- close(fd); base[stat.st_size]=0; /* final NULL termination */
-
- /* count up all the lines (and NULL terminate) to know memory needs */
- for (p=base,lines=0; p<base+stat.st_size; p++) /* count lines */
- if (*p == '\n') *p=0,lines++;
- nlines = lines;
- /* get memory for array of pointers to each fortune */
- if ((flines=(char**)malloc(nlines*sizeof(char*))) == 0)
- {
- free((char*)base); fd= -1; return(0); /* malloc() failure */
- }
+char *flines[] = {
+ "gem value = gem * 2 ^ perfection",
+ "sitting down can have unexpected results",
+ "don't pry into the affairs of others",
+ "drinking can be hazardous to your health",
+ "beware of the gusher!",
+ "some monsters are greedy",
+ "nymphs have light fingers",
+ "try kissing a disenchantress!",
+ "hammers and brains don't mix",
+ "what does a potion of cure dianthroritis taste like?",
+ "hit point gain/loss when raising a level depends on constitution",
+ "healing a mighty wizard can be exhilarating",
+ "be sure to pay your taxes",
+ "are Vampires afraid of something?",
+ "some dragons can fly",
+ "dos thou strive for perfection?",
+ "patience is a virtue, unless your daughter dies",
+ "what does the Eye of Larn see in its guardian?",
+ "a level 25 player casts like crazy!",
+ "energy rings affect spell regeneration",
+ "difficulty affects regeneration",
+ "control of the pesty spirits is most helpful",
+ "don't fall into a bottomless pit",
+ "dexterity allows you to carry more",
+ "you can get 2 points of WC for the price of one",
+ "never enter the dungeon naked! the monsters will laugh at you!",
+ "did someone put itching powder in your armor?",
+ "you klutz!",
+ "avoid opening doors. you never know whats on the other side.",
+ "infinite regeneration ---> temptation",
+ "the greatest weapon in the game has not the highest Weapon Class",
+ "you can't buy the most powerful scroll",
+ "identify things before you use them",
+ "there's more than one way through a wall"
+};
- /* now assign each pointer to a line */
- for (p=base,tmp=0; tmp<nlines; tmp++)
- {
- flines[tmp]=p; while (*p++); /* advance to next line */
- }
- }
+#define NFORTUNES 34
- if (fd > 2) /* if we have a database to look at */
- return(flines[rund((nlines<=0)?1:nlines)]);
- else
- return(0);
- }
+char *
+fortune()
+{
+ return (flines[random() % NFORTUNES]);
+}
diff --git a/larn/global.c b/larn/global.c
index de724d7c..9be6c0d6 100644
--- a/larn/global.c
+++ b/larn/global.c
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "$Id: global.c,v 1.2 1993/08/02 17:20:02 mycroft Exp $";
+static char rcsid[] = "$NetBSD: global.c,v 1.3 1995/03/23 08:33:26 cgd Exp $";
#endif /* not lint */
/* global.c Larn is copyrighted 1986 by Noah Morgan.
diff --git a/larn/header.h b/larn/header.h
index 371dd118..aa853c47 100644
--- a/larn/header.h
+++ b/larn/header.h
@@ -1,4 +1,4 @@
-/* $Id: header.h,v 1.4 1994/10/21 21:26:08 mycroft Exp $ */
+/* $NetBSD: header.h,v 1.5 1995/03/23 08:33:29 cgd Exp $ */
/* header.h Larn is copyrighted 1986 by Noah Morgan. */
@@ -353,10 +353,11 @@ extern struct monst monster[];
extern struct sphere *spheres;
extern struct _itm itm[];
-char *fortune(),*malloc(),*getenv(),*getlogin(),*lgetw(),*lgetl(),*ctime();
+char *fortune(),*getenv(),*getlogin(),*lgetw(),*lgetl(),*ctime();
char *tmcapcnv(),*tgetstr(),*tgoto();
long paytaxes(),lgetc(),lrint(),time();
unsigned long readnum();
+void *malloc();
/* macro to create scroll #'s with probability of occurrence */
#define newscroll() (scprob[rund(81)])
diff --git a/larn/help.c b/larn/help.c
index 57ae59e3..8cbae3a1 100644
--- a/larn/help.c
+++ b/larn/help.c
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "$Id: help.c,v 1.2 1993/08/02 17:20:04 mycroft Exp $";
+static char rcsid[] = "$NetBSD: help.c,v 1.3 1995/03/23 08:33:33 cgd Exp $";
#endif /* not lint */
/* help.c Larn is copyrighted 1986 by Noah Morgan. */
diff --git a/larn/io.c b/larn/io.c
index b41d64a9..ded2ac2a 100644
--- a/larn/io.c
+++ b/larn/io.c
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "$Id: io.c,v 1.2 1993/08/02 17:20:05 mycroft Exp $";
+static char rcsid[] = "$NetBSD: io.c,v 1.3 1995/03/23 08:33:38 cgd Exp $";
#endif /* not lint */
/* io.c Larn is copyrighted 1986 by Noah Morgan.
diff --git a/larn/larn.6 b/larn/larn.6
index 83177dbd..d5536262 100644
--- a/larn/larn.6
+++ b/larn/larn.6
@@ -1,3 +1,5 @@
+.\" $NetBSD: larn.6,v 1.3 1995/03/23 08:33:42 cgd Exp $
+.\"
.\" Copyright (c) 1990 The Regents of the University of California.
.\" All rights reserved.
.\"
@@ -29,15 +31,14 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" from: @(#)larn.6 5.4 (Berkeley) 8/1/91
-.\" $Id: larn.6,v 1.2 1993/08/01 07:46:47 mycroft Exp $
+.\" @(#)larn.6 5.5 (Berkeley) 12/30/93
.\"
-.Dd August 1, 1991
+.Dd December 30, 1993
.Dt LARN 6
.Os
.Sh NAME
.Nm larn
-.Nd Exploring the caverns of Larn
+.Nd exploring the caverns of Larn
.Sh SYNOPSIS
.Nm larn
.Op Fl r
@@ -138,8 +139,8 @@ separated from other words by whitespace.
When
.Sy dropping gold ,
if you type '*' as your amount, all your gold gets dropped.
-In general, typing in '*' means all of what your interested in. This is true
-when visiting the bank, or when contributing at altars.
+In general, typing in '*' means all of what you are interested in.
+This is true when visiting the bank, or when contributing at altars.
.Pp
You can get out of the store, trading post, school, or home by hitting
.Sy <esc> .
diff --git a/larn/main.c b/larn/main.c
index 964a482b..1d0743cc 100644
--- a/larn/main.c
+++ b/larn/main.c
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "$Id: main.c,v 1.4 1994/10/21 21:26:10 mycroft Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.5 1995/03/23 08:33:46 cgd Exp $";
#endif /* not lint */
/* main.c */
diff --git a/larn/monster.c b/larn/monster.c
index 45a64bc4..1178bd66 100644
--- a/larn/monster.c
+++ b/larn/monster.c
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "$Id: monster.c,v 1.2 1993/08/02 17:20:10 mycroft Exp $";
+static char rcsid[] = "$NetBSD: monster.c,v 1.3 1995/03/23 08:33:50 cgd Exp $";
#endif /* not lint */
/*
diff --git a/larn/moreobj.c b/larn/moreobj.c
index e30629a3..737154f2 100644
--- a/larn/moreobj.c
+++ b/larn/moreobj.c
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "$Id: moreobj.c,v 1.2 1993/08/02 17:20:12 mycroft Exp $";
+static char rcsid[] = "$NetBSD: moreobj.c,v 1.3 1995/03/23 08:33:54 cgd Exp $";
#endif /* not lint */
/* moreobj.c Larn is copyrighted 1986 by Noah Morgan.
diff --git a/larn/movem.c b/larn/movem.c
index ccc6c9fb..82b361e3 100644
--- a/larn/movem.c
+++ b/larn/movem.c
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "$Id: movem.c,v 1.2 1993/08/02 17:20:14 mycroft Exp $";
+static char rcsid[] = "$NetBSD: movem.c,v 1.3 1995/03/23 08:33:58 cgd Exp $";
#endif /* not lint */
/*
diff --git a/larn/nap.c b/larn/nap.c
index 732974d2..c6d2775d 100644
--- a/larn/nap.c
+++ b/larn/nap.c
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "$Id: nap.c,v 1.2 1993/08/02 17:20:15 mycroft Exp $";
+static char rcsid[] = "$NetBSD: nap.c,v 1.3 1995/03/23 08:34:01 cgd Exp $";
#endif /* not lint */
/* nap.c Larn is copyrighted 1986 by Noah Morgan. */
diff --git a/larn/object.c b/larn/object.c
index b3d4bc9d..d71f6734 100644
--- a/larn/object.c
+++ b/larn/object.c
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "$Id: object.c,v 1.4 1994/10/21 21:26:12 mycroft Exp $";
+static char rcsid[] = "$NetBSD: object.c,v 1.5 1995/03/23 08:34:05 cgd Exp $";
#endif /* not lint */
/* object.c Larn is copyrighted 1986 by Noah Morgan. */
diff --git a/larn/pathnames.h b/larn/pathnames.h
index 62c428fc..9d921a9c 100644
--- a/larn/pathnames.h
+++ b/larn/pathnames.h
@@ -1,3 +1,5 @@
+/* $NetBSD: pathnames.h,v 1.4 1995/03/23 08:34:09 cgd Exp $ */
+
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -30,8 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * from: @(#)pathnames.h 5.1 (Berkeley) 5/2/90
- * $Id: pathnames.h,v 1.3 1994/09/18 00:21:38 mycroft Exp $
+ * @(#)pathnames.h 5.1 (Berkeley) 5/2/90
*/
#define _PATH_LOG "/var/games/larn/llog12.0"
diff --git a/larn/regen.c b/larn/regen.c
index e65be75b..2f68643a 100644
--- a/larn/regen.c
+++ b/larn/regen.c
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "$Id: regen.c,v 1.2 1993/08/02 17:20:17 mycroft Exp $";
+static char rcsid[] = "$NetBSD: regen.c,v 1.3 1995/03/23 08:34:11 cgd Exp $";
#endif /* not lint */
/* regen.c Larn is copyrighted 1986 by Noah Morgan. */
diff --git a/larn/savelev.c b/larn/savelev.c
index 993eaa86..4761233c 100644
--- a/larn/savelev.c
+++ b/larn/savelev.c
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "$Id: savelev.c,v 1.2 1993/08/02 17:20:18 mycroft Exp $";
+static char rcsid[] = "$NetBSD: savelev.c,v 1.3 1995/03/23 08:34:13 cgd Exp $";
#endif /* not lint */
/* savelev.c Larn is copyrighted 1986 by Noah Morgan. */
diff --git a/larn/scores.c b/larn/scores.c
index a0b1c478..cd9fd9e2 100644
--- a/larn/scores.c
+++ b/larn/scores.c
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "$Id: scores.c,v 1.3 1993/08/02 17:20:19 mycroft Exp $";
+static char rcsid[] = "$NetBSD: scores.c,v 1.4 1995/03/23 08:34:15 cgd Exp $";
#endif /* not lint */
/* scores.c Larn is copyrighted 1986 by Noah Morgan.
diff --git a/larn/signal.c b/larn/signal.c
index a7c751f8..e12b1314 100644
--- a/larn/signal.c
+++ b/larn/signal.c
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "$Id: signal.c,v 1.2 1993/08/02 17:20:21 mycroft Exp $";
+static char rcsid[] = "$NetBSD: signal.c,v 1.3 1995/03/23 08:34:18 cgd Exp $";
#endif /* not lint */
#include <signal.h>
diff --git a/larn/store.c b/larn/store.c
index 24783ea1..3f49ba61 100644
--- a/larn/store.c
+++ b/larn/store.c
@@ -1,3 +1,5 @@
+/* $NetBSD: store.c,v 1.4 1995/03/23 08:34:20 cgd Exp $ */
+
/*-
* Copyright (c) 1988 The Regents of the University of California.
* All rights reserved.
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)store.c 5.4 (Berkeley) 5/13/91";*/
-static char rcsid[] = "$Id: store.c,v 1.3 1994/10/21 21:26:14 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)store.c 5.4 (Berkeley) 5/13/91";
+#else
+static char rcsid[] = "$NetBSD: store.c,v 1.4 1995/03/23 08:34:20 cgd Exp $";
+#endif
#endif /* not lint */
/* store.c Larn is copyrighted 1986 by Noah Morgan. */
diff --git a/larn/tok.c b/larn/tok.c
index 6804dd52..5b9e2610 100644
--- a/larn/tok.c
+++ b/larn/tok.c
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "$Id: tok.c,v 1.2 1993/08/02 17:20:22 mycroft Exp $";
+static char rcsid[] = "$NetBSD: tok.c,v 1.3 1995/03/23 08:34:23 cgd Exp $";
#endif /* not lint */
/* tok.c Larn is copyrighted 1986 by Noah Morgan. */
diff --git a/monop/Makefile b/monop/Makefile
index 67d9eed7..0b692e3d 100644
--- a/monop/Makefile
+++ b/monop/Makefile
@@ -1,5 +1,5 @@
-# from: @(#)Makefile 5.8 (Berkeley) 9/2/92
-# $Id: Makefile,v 1.11 1994/12/22 09:34:57 cgd Exp $
+# $NetBSD: Makefile,v 1.12 1995/03/23 08:34:32 cgd Exp $
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
PROG= monop
SRCS= monop.c cards.c execute.c getinp.c houses.c jail.c misc.c morg.c \
diff --git a/monop/brd.dat b/monop/brd.dat
index ff8498d0..987fa293 100644
--- a/monop/brd.dat
+++ b/monop/brd.dat
@@ -1,3 +1,5 @@
+/* $NetBSD: brd.dat,v 1.2 1995/03/23 08:34:34 cgd Exp $ */
+
/*-
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
diff --git a/monop/cards.c b/monop/cards.c
index 8d3ce142..b65f0f26 100644
--- a/monop/cards.c
+++ b/monop/cards.c
@@ -1,6 +1,8 @@
+/* $NetBSD: cards.c,v 1.3 1995/03/23 08:34:35 cgd Exp $ */
+
/*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)cards.c 5.4 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: cards.c,v 1.2 1993/08/01 18:53:44 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)cards.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: cards.c,v 1.3 1995/03/23 08:34:35 cgd Exp $";
+#endif
#endif /* not lint */
# include "monop.ext"
diff --git a/monop/deck.h b/monop/deck.h
index f8857a6c..5516623b 100644
--- a/monop/deck.h
+++ b/monop/deck.h
@@ -1,6 +1,8 @@
+/* $NetBSD: deck.h,v 1.3 1995/03/23 08:34:36 cgd Exp $ */
+
/*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,8 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * from: @(#)deck.h 5.3 (Berkeley) 6/1/90
- * $Id: deck.h,v 1.2 1993/08/01 18:53:47 mycroft Exp $
+ * @(#)deck.h 8.1 (Berkeley) 5/31/93
*/
# define bool char
diff --git a/monop/execute.c b/monop/execute.c
index 6649f0ca..f4f49ab4 100644
--- a/monop/execute.c
+++ b/monop/execute.c
@@ -1,6 +1,8 @@
+/* $NetBSD: execute.c,v 1.3 1995/03/23 08:34:38 cgd Exp $ */
+
/*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)execute.c 5.5 (Berkeley) 2/28/91";*/
-static char rcsid[] = "$Id: execute.c,v 1.2 1993/08/01 18:53:43 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)execute.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: execute.c,v 1.3 1995/03/23 08:34:38 cgd Exp $";
+#endif
#endif /* not lint */
# include "monop.ext"
diff --git a/monop/getinp.c b/monop/getinp.c
index 09724128..d46a9a0f 100644
--- a/monop/getinp.c
+++ b/monop/getinp.c
@@ -1,6 +1,8 @@
+/* $NetBSD: getinp.c,v 1.3 1995/03/23 08:34:39 cgd Exp $ */
+
/*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)getinp.c 5.4 (Berkeley) 2/28/91";*/
-static char rcsid[] = "$Id: getinp.c,v 1.2 1993/08/01 18:53:42 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)getinp.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: getinp.c,v 1.3 1995/03/23 08:34:39 cgd Exp $";
+#endif
#endif /* not lint */
# include <stdio.h>
diff --git a/monop/houses.c b/monop/houses.c
index 2da11cc1..1cb4b0a3 100644
--- a/monop/houses.c
+++ b/monop/houses.c
@@ -1,6 +1,8 @@
+/* $NetBSD: houses.c,v 1.3 1995/03/23 08:34:40 cgd Exp $ */
+
/*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)houses.c 5.5 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: houses.c,v 1.2 1993/08/01 18:53:40 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)houses.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: houses.c,v 1.3 1995/03/23 08:34:40 cgd Exp $";
+#endif
#endif /* not lint */
# include "monop.ext"
diff --git a/monop/initdeck.c b/monop/initdeck.c
index f378ed6a..c2ff8310 100644
--- a/monop/initdeck.c
+++ b/monop/initdeck.c
@@ -1,6 +1,8 @@
+/* $NetBSD: initdeck.c,v 1.3 1995/03/23 08:34:43 cgd Exp $ */
+
/*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,14 +34,17 @@
*/
#ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1980 Regents of the University of California.\n\
- All rights reserved.\n";
+static char copyright[] =
+"@(#) Copyright (c) 1980, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
-/*static char sccsid[] = "from: @(#)initdeck.c 5.5 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: initdeck.c,v 1.2 1993/08/01 18:53:39 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)initdeck.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: initdeck.c,v 1.3 1995/03/23 08:34:43 cgd Exp $";
+#endif
#endif /* not lint */
# include <stdio.h>
diff --git a/monop/jail.c b/monop/jail.c
index b976b119..06055315 100644
--- a/monop/jail.c
+++ b/monop/jail.c
@@ -1,6 +1,8 @@
+/* $NetBSD: jail.c,v 1.3 1995/03/23 08:34:44 cgd Exp $ */
+
/*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)jail.c 5.3 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: jail.c,v 1.2 1993/08/01 18:53:38 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)jail.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: jail.c,v 1.3 1995/03/23 08:34:44 cgd Exp $";
+#endif
#endif /* not lint */
# include "monop.ext"
diff --git a/monop/misc.c b/monop/misc.c
index 114994e5..1a71653b 100644
--- a/monop/misc.c
+++ b/monop/misc.c
@@ -1,6 +1,8 @@
+/* $NetBSD: misc.c,v 1.4 1995/03/23 08:34:47 cgd Exp $ */
+
/*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)misc.c 5.6 (Berkeley) 3/25/93";*/
-static char rcsid[] = "$Id: misc.c,v 1.3 1993/08/07 08:27:57 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: misc.c,v 1.4 1995/03/23 08:34:47 cgd Exp $";
+#endif
#endif /* not lint */
# include "monop.ext"
diff --git a/monop/mon.dat b/monop/mon.dat
index 8d5ab4de..bfafa4c0 100644
--- a/monop/mon.dat
+++ b/monop/mon.dat
@@ -1,3 +1,5 @@
+/* $NetBSD: mon.dat,v 1.2 1995/03/23 08:34:49 cgd Exp $ */
+
/*-
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
diff --git a/monop/monop.6 b/monop/monop.6
index 43915791..5412a616 100644
--- a/monop/monop.6
+++ b/monop/monop.6
@@ -1,3 +1,5 @@
+.\" $NetBSD: monop.6,v 1.8 1995/03/23 08:34:50 cgd Exp $
+.\"
.\" Copyright (c) 1980 The Regents of the University of California.
.\" All rights reserved.
.\"
@@ -29,8 +31,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" from: @(#)monop.6 6.4 (Berkeley) 6/23/90
-.\" $Id: monop.6,v 1.7 1994/03/19 08:01:23 cgd Exp $
+.\" @(#)monop.6 6.5 (Berkeley) 3/25/93
.\"
.Dd March 25, 1993
.Dt MONOP 6
diff --git a/monop/monop.c b/monop/monop.c
index bbc20698..8e335226 100644
--- a/monop/monop.c
+++ b/monop/monop.c
@@ -1,6 +1,8 @@
+/* $NetBSD: monop.c,v 1.3 1995/03/23 08:34:52 cgd Exp $ */
+
/*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,14 +34,17 @@
*/
#ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1980 Regents of the University of California.\n\
- All rights reserved.\n";
+static char copyright[] =
+"@(#) Copyright (c) 1980, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
-/*static char sccsid[] = "from: @(#)monop.c 5.7 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: monop.c,v 1.2 1993/08/01 18:53:35 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)monop.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: monop.c,v 1.3 1995/03/23 08:34:52 cgd Exp $";
+#endif
#endif /* not lint */
# include "monop.def"
diff --git a/monop/monop.def b/monop/monop.def
index 1e063e4e..344c4f49 100644
--- a/monop/monop.def
+++ b/monop/monop.def
@@ -1,6 +1,8 @@
+/* $NetBSD: monop.def,v 1.3 1995/03/23 08:34:54 cgd Exp $ */
+
/*-
- * Copyright (c) 1980 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,8 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * from: @(#)monop.def 5.4 (Berkeley) 3/25/93
- * $Id: monop.def,v 1.2 1993/08/07 08:28:03 mycroft Exp $
+ * @(#)monop.def 5.5 (Berkeley) 5/31/93
*/
# include "monop.h"
diff --git a/monop/monop.ext b/monop/monop.ext
index a5fc616c..ea955a88 100644
--- a/monop/monop.ext
+++ b/monop/monop.ext
@@ -1,3 +1,5 @@
+/* $NetBSD: monop.ext,v 1.2 1995/03/23 08:34:58 cgd Exp $ */
+
/*-
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
diff --git a/monop/monop.h b/monop/monop.h
index 2198d7dd..1f6110c1 100644
--- a/monop/monop.h
+++ b/monop/monop.h
@@ -1,6 +1,8 @@
+/* $NetBSD: monop.h,v 1.3 1995/03/23 08:35:00 cgd Exp $ */
+
/*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,8 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * from: @(#)monop.h 5.5 (Berkeley) 6/1/90
- * $Id: monop.h,v 1.2 1993/08/01 18:53:46 mycroft Exp $
+ * @(#)monop.h 8.1 (Berkeley) 5/31/93
*/
# include <stdio.h>
diff --git a/monop/morg.c b/monop/morg.c
index b54d56a0..95708564 100644
--- a/monop/morg.c
+++ b/monop/morg.c
@@ -1,6 +1,8 @@
+/* $NetBSD: morg.c,v 1.4 1995/03/23 08:35:02 cgd Exp $ */
+
/*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)morg.c 5.4 (Berkeley) 3/25/93";*/
-static char rcsid[] = "$Id: morg.c,v 1.3 1993/08/07 08:28:05 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)morg.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: morg.c,v 1.4 1995/03/23 08:35:02 cgd Exp $";
+#endif
#endif /* not lint */
# include "monop.ext"
diff --git a/monop/pathnames.h b/monop/pathnames.h
index a1c347bd..e0cc52f2 100644
--- a/monop/pathnames.h
+++ b/monop/pathnames.h
@@ -1,6 +1,8 @@
+/* $NetBSD: pathnames.h,v 1.3 1995/03/23 08:35:03 cgd Exp $ */
+
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,8 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * from: @(#)pathnames.h 5.1 (Berkeley) 6/1/90
- * $Id: pathnames.h,v 1.2 1993/08/01 18:53:45 mycroft Exp $
+ * @(#)pathnames.h 8.1 (Berkeley) 5/31/93
*/
#define _PATH_CARDS "/usr/share/games/cards.pck"
diff --git a/monop/print.c b/monop/print.c
index e2cdad5c..eb49d1fc 100644
--- a/monop/print.c
+++ b/monop/print.c
@@ -1,6 +1,8 @@
+/* $NetBSD: print.c,v 1.3 1995/03/23 08:35:05 cgd Exp $ */
+
/*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)print.c 5.4 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: print.c,v 1.2 1993/08/01 18:53:33 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)print.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: print.c,v 1.3 1995/03/23 08:35:05 cgd Exp $";
+#endif
#endif /* not lint */
# include "monop.ext"
diff --git a/monop/prop.c b/monop/prop.c
index cb4b310a..77b1f6f1 100644
--- a/monop/prop.c
+++ b/monop/prop.c
@@ -1,6 +1,8 @@
+/* $NetBSD: prop.c,v 1.3 1995/03/23 08:35:06 cgd Exp $ */
+
/*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)prop.c 5.6 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: prop.c,v 1.2 1993/08/01 18:53:33 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)prop.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: prop.c,v 1.3 1995/03/23 08:35:06 cgd Exp $";
+#endif
#endif /* not lint */
# include "monop.ext"
diff --git a/monop/prop.dat b/monop/prop.dat
index f9fc072d..6e83098d 100644
--- a/monop/prop.dat
+++ b/monop/prop.dat
@@ -1,3 +1,5 @@
+/* $NetBSD: prop.dat,v 1.2 1995/03/23 08:35:09 cgd Exp $ */
+
/*-
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
diff --git a/monop/rent.c b/monop/rent.c
index 5c596e0f..ef915bb8 100644
--- a/monop/rent.c
+++ b/monop/rent.c
@@ -1,6 +1,8 @@
+/* $NetBSD: rent.c,v 1.3 1995/03/23 08:35:11 cgd Exp $ */
+
/*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)rent.c 5.3 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: rent.c,v 1.2 1993/08/01 18:53:32 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)rent.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: rent.c,v 1.3 1995/03/23 08:35:11 cgd Exp $";
+#endif
#endif /* not lint */
# include "monop.ext"
diff --git a/monop/roll.c b/monop/roll.c
index 5d01fe9c..ddf38a2e 100644
--- a/monop/roll.c
+++ b/monop/roll.c
@@ -1,6 +1,8 @@
+/* $NetBSD: roll.c,v 1.5 1995/03/23 08:35:13 cgd Exp $ */
+
/*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)roll.c 5.6 (Berkeley) 9/29/92";*/
-static char rcsid[] = "$Id: roll.c,v 1.4 1993/08/07 08:28:06 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)roll.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: roll.c,v 1.5 1995/03/23 08:35:13 cgd Exp $";
+#endif
#endif /* not lint */
#include <stdlib.h>
diff --git a/monop/spec.c b/monop/spec.c
index a8e39a1e..5b8f32e1 100644
--- a/monop/spec.c
+++ b/monop/spec.c
@@ -1,6 +1,8 @@
+/* $NetBSD: spec.c,v 1.3 1995/03/23 08:35:16 cgd Exp $ */
+
/*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)spec.c 5.3 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: spec.c,v 1.2 1993/08/01 18:53:30 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)spec.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: spec.c,v 1.3 1995/03/23 08:35:16 cgd Exp $";
+#endif
#endif /* not lint */
# include "monop.ext"
diff --git a/monop/trade.c b/monop/trade.c
index 9a090b61..e8207f99 100644
--- a/monop/trade.c
+++ b/monop/trade.c
@@ -1,6 +1,8 @@
+/* $NetBSD: trade.c,v 1.3 1995/03/23 08:35:19 cgd Exp $ */
+
/*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1980, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,8 +34,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)trade.c 5.5 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: trade.c,v 1.2 1993/08/01 18:53:28 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)trade.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: trade.c,v 1.3 1995/03/23 08:35:19 cgd Exp $";
+#endif
#endif /* not lint */
# include "monop.ext"
diff --git a/morse/Makefile b/morse/Makefile
index a189d968..0f28e4f8 100644
--- a/morse/Makefile
+++ b/morse/Makefile
@@ -1,5 +1,5 @@
-# from: @(#)Makefile 5.1 (Berkeley) 5/11/90
-# $Id: Makefile,v 1.2 1993/08/01 05:44:57 mycroft Exp $
+# $NetBSD: Makefile,v 1.3 1995/03/23 08:35:22 cgd Exp $
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
PROG= morse
NOMAN= noman
diff --git a/morse/morse.c b/morse/morse.c
index 46eb1a40..a9045018 100644
--- a/morse/morse.c
+++ b/morse/morse.c
@@ -1,6 +1,8 @@
+/* $NetBSD: morse.c,v 1.3 1995/03/23 08:35:24 cgd Exp $ */
+
/*
- * Copyright (c) 1988 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1988, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,14 +34,17 @@
*/
#ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1988 Regents of the University of California.\n\
- All rights reserved.\n";
+static char copyright[] =
+"@(#) Copyright (c) 1988, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
-/*static char sccsid[] = "from: @(#)morse.c 5.3 (Berkeley) 2/28/91";*/
-static char rcsid[] = "$Id: morse.c,v 1.2 1993/08/01 18:53:21 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)morse.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: morse.c,v 1.3 1995/03/23 08:35:24 cgd Exp $";
+#endif
#endif /* not lint */
#include <stdio.h>
diff --git a/number/Makefile b/number/Makefile
index 20aea694..7f20784d 100644
--- a/number/Makefile
+++ b/number/Makefile
@@ -1,5 +1,5 @@
-# from: @(#)Makefile 5.2 (Berkeley) 5/11/90
-# $Id: Makefile,v 1.3 1994/12/22 09:35:02 cgd Exp $
+# $NetBSD: Makefile,v 1.4 1995/03/23 08:35:27 cgd Exp $
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
PROG= number
MAN= number.6
diff --git a/number/number.6 b/number/number.6
index a35b1c9f..c50c1fb5 100644
--- a/number/number.6
+++ b/number/number.6
@@ -1,5 +1,7 @@
-.\" Copyright (c) 1989 The Regents of the University of California.
-.\" All rights reserved.
+.\" $NetBSD: number.6,v 1.4 1995/03/23 08:35:29 cgd Exp $
+.\"
+.\" Copyright (c) 1989, 1993, 1994
+.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
@@ -29,10 +31,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" from: @(#)number.6 6.4 (Berkeley) 6/23/90
-.\" $Id: number.6,v 1.3 1993/08/05 01:46:49 jtc Exp $
+.\" @(#)number.6 8.2 (Berkeley) 3/31/94
.\"
-.Dd June 23, 1990
+.Dd March 31, 1994
.Dt NUMBER 6
.Os
.Sh NAME
@@ -44,12 +45,18 @@
.Sh DESCRIPTION
The
.Nm number
-utility
-prints the English equivalent of the specified number to the
-standard output.
+utility prints the English equivalent of the number to the standard
+output, with each 10^3 magnitude displayed on a separate line.
If no argument is specified,
.Nm number
-reads a number from the standard input.
+reads lines from the standard input.
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl l
+Display the number on a single line.
+.El
.Sh BUGS
-.Nm Number
-doesn't understand exponents.
+Although
+.Nm number
+understand fractions, it doesn't understand exponents.
diff --git a/number/number.c b/number/number.c
index 29b8effa..509f0125 100644
--- a/number/number.c
+++ b/number/number.c
@@ -1,6 +1,8 @@
+/* $NetBSD: number.c,v 1.3 1995/03/23 08:35:30 cgd Exp $ */
+
/*
- * Copyright (c) 1988 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1988, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,23 +34,28 @@
*/
#ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1988 Regents of the University of California.\n\
- All rights reserved.\n";
+static char copyright[] =
+"@(#) Copyright (c) 1988, 1993, 1994\n\
+ The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
-/*static char sccsid[] = "from: @(#)number.c 5.1 (Berkeley) 2/28/91";*/
-static char rcsid[] = "$Id: number.c,v 1.2 1993/08/01 18:53:19 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)number.c 8.2 (Berkeley) 3/31/94";
+#else
+static char rcsid[] = "$NetBSD: number.c,v 1.3 1995/03/23 08:35:30 cgd Exp $";
+#endif
#endif /* not lint */
-#include <stdio.h>
+#include <sys/types.h>
+
#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <err.h>
-#define YES 1
-#define NO 0
-#define EOS '\0'
-#define MAXNUM 65 /* biggest number we handle */
+#define MAXNUM 65 /* Biggest number we handle. */
static char *name1[] = {
"", "one", "two", "three",
@@ -72,173 +79,219 @@ static char *name1[] = {
"novemdecillion", "vigintillion",
};
-main(argc,argv)
- int argc;
- char **argv;
+void convert __P((char *));
+int number __P((char *, int));
+void pfract __P((int));
+void toobig __P((void));
+int unit __P((int, char *));
+void usage __P((void));
+
+int lflag;
+
+int
+main(argc, argv)
+ int argc;
+ char *argv[];
{
- register int cnt;
- char line[MAXNUM * 2 + 2]; /* MAXNUM '.' MAXNUM '\0' */
+ int ch, first;
+ char line[256];
- if (argc > 1)
- for (cnt = 1;cnt < argc;++cnt) {
- convert(argv[cnt]);
- puts("...");
+ lflag = 0;
+ while ((ch = getopt(argc, argv, "l")) != EOF)
+ switch (ch) {
+ case 'l':
+ lflag = 1;
+ break;
+ case '?':
+ default:
+ usage();
}
- else
- while (fgets(line,sizeof(line),stdin)) {
+ argc -= optind;
+ argv += optind;
+
+ if (*argv == NULL)
+ for (first = 1;
+ fgets(line, sizeof(line), stdin) != NULL; first = 0) {
+ if (strchr(line, '\n') == NULL)
+ errx(1, "line too long.");
+ if (!first)
+ (void)printf("...\n");
convert(line);
- puts("...");
+ }
+ else
+ for (first = 1; *argv != NULL; first = 0, ++argv) {
+ if (!first)
+ (void)printf("...\n");
+ convert(*argv);
}
exit(0);
}
+void
convert(line)
- char *line;
+ char *line;
{
- register int len,
- ret;
- register char *C,
- *fraction;
-
- for (fraction = NULL, C = line;*C && *C != '\n';++C)
- if (!isdigit(*C))
- switch(*C) {
- case '-':
- if (C != line)
- usage(NO);
- break;
- case '.':
- if (!fraction) {
- fraction = C + 1;
- *C = EOS;
- break;
- }
- default:
- usage(NO);
+ register flen, len, rval;
+ register char *p, *fraction;
+
+ fraction = NULL;
+ for (p = line; *p != '\0' && *p != '\n'; ++p) {
+ if (isblank(*p)) {
+ if (p == line) {
+ ++line;
+ continue;
}
- *C = EOS;
+ goto badnum;
+ }
+ if (isdigit(*p))
+ continue;
+ switch (*p) {
+ case '.':
+ if (fraction != NULL)
+ goto badnum;
+ fraction = p + 1;
+ *p = '\0';
+ break;
+ case '-':
+ if (p == line)
+ break;
+ /* FALLTHROUGH */
+ default:
+badnum: errx(1, "illegal number: %s", line);
+ break;
+ }
+ }
+ *p = '\0';
+
+ if ((len = strlen(line)) > MAXNUM ||
+ fraction != NULL && (flen = strlen(fraction)) > MAXNUM)
+ errx(1, "number too large, max %d digits.", MAXNUM);
+
if (*line == '-') {
- puts("minus");
+ (void)printf("minus%s", lflag ? " " : "\n");
++line;
}
- ret = NO;
- if (len = strlen(line)) {
- if (len > MAXNUM)
- usage(YES);
- ret = unit(len,line);
- }
- if (fraction && (len = strlen(fraction))) {
- if (len > MAXNUM)
- usage(YES);
- for (C = fraction;*C;++C)
- if (*C != '0') {
- if (ret)
- puts("and");
- if (unit(len,fraction)) {
- ++ret;
- pfract(len);
+
+ rval = len > 0 ? unit(len, line) : 0;
+ if (fraction != NULL && flen != 0)
+ for (p = fraction; *p != '\0'; ++p)
+ if (*p != '0') {
+ if (rval)
+ (void)printf("%sand%s",
+ lflag ? " " : "",
+ lflag ? " " : "\n");
+ if (unit(flen, fraction)) {
+ if (lflag)
+ (void)printf(" ");
+ pfract(flen);
+ rval = 1;
}
break;
}
- }
- if (!ret)
- puts("zero.");
+ if (!rval)
+ (void)printf("zero%s", lflag ? "" : ".\n");
+ if (lflag)
+ (void)printf("\n");
}
-unit(len,C)
- register int len;
- register char *C;
+int
+unit(len, p)
+ register int len;
+ register char *p;
{
- register int off,
- ret;
+ register int off, rval;
- ret = NO;
+ rval = 0;
if (len > 3) {
if (len % 3) {
off = len % 3;
len -= off;
- if (number(C,off)) {
- ret = YES;
- printf(" %s.\n",name3[len / 3]);
+ if (number(p, off)) {
+ rval = 1;
+ (void)printf(" %s%s",
+ name3[len / 3], lflag ? " " : ".\n");
}
- C += off;
+ p += off;
}
- for (;len > 3;C += 3) {
+ for (; len > 3; p += 3) {
len -= 3;
- if (number(C,3)) {
- ret = YES;
- printf(" %s.\n",name3[len / 3]);
+ if (number(p, 3)) {
+ rval = 1;
+ (void)printf(" %s%s",
+ name3[len / 3], lflag ? " " : ".\n");
}
}
}
- if (number(C,len)) {
- puts(".");
- ret = YES;
+ if (number(p, len)) {
+ if (!lflag)
+ (void)printf(".\n");
+ rval = 1;
}
- return(ret);
+ return (rval);
}
-number(C,len)
- register char *C;
- int len;
+int
+number(p, len)
+ register char *p;
+ int len;
{
- register int val,
- ret;
+ register int val, rval;
- ret = 0;
- switch(len) {
+ rval = 0;
+ switch (len) {
case 3:
- if (*C != '0') {
- ++ret;
- printf("%s hundred",name1[*C - '0']);
+ if (*p != '0') {
+ rval = 1;
+ (void)printf("%s hundred", name1[*p - '0']);
}
- ++C;
- /*FALLTHROUGH*/
+ ++p;
+ /* FALLTHROUGH */
case 2:
- val = (C[1] - '0') + (C[0] - '0') * 10;
+ val = (p[1] - '0') + (p[0] - '0') * 10;
if (val) {
- if (ret++)
- putchar(' ');
+ if (rval)
+ (void)printf(" ");
if (val < 20)
- fputs(name1[val],stdout);
+ (void)printf("%s", name1[val]);
else {
- fputs(name2[val / 10],stdout);
+ (void)printf("%s", name2[val / 10]);
if (val % 10)
- printf("-%s",name1[val % 10]);
+ (void)printf("-%s", name1[val % 10]);
}
+ rval = 1;
}
break;
case 1:
- if (*C != '0') {
- ++ret;
- fputs(name1[*C - '0'],stdout);
+ if (*p != '0') {
+ rval = 1;
+ (void)printf("%s", name1[*p - '0']);
}
}
- return(ret);
+ return (rval);
}
+void
pfract(len)
- register int len;
+ int len;
{
- static char *pref[] = { "", "ten-", "hundred-" };
+ static char *pref[] = { "", "ten-", "hundred-" };
switch(len) {
case 1:
- puts("tenths.");
+ (void)printf("tenths.\n");
break;
case 2:
- puts("hundredths.");
+ (void)printf("hundredths.\n");
break;
default:
- printf("%s%sths.\n",pref[len % 3],name3[len / 3]);
+ (void)printf("%s%sths.\n", pref[len % 3], name3[len / 3]);
+ break;
}
}
-usage(toobig)
- int toobig;
+void
+usage()
{
- if (toobig)
- fprintf(stderr,"number: number too large, max %d digits.\n",MAXNUM);
- fputs("usage: number # ...\n",stderr);
- exit(-1);
+ (void)fprintf(stderr, "usage: number [# ...]\n");
+ exit(1);
}
diff --git a/pom/Makefile b/pom/Makefile
index ae49b458..7f251b62 100644
--- a/pom/Makefile
+++ b/pom/Makefile
@@ -1,5 +1,5 @@
-# from: @(#)Makefile 5.1 (Berkeley) 5/11/90
-# $Id: Makefile,v 1.3 1994/12/22 09:35:29 cgd Exp $
+# $NetBSD: Makefile,v 1.4 1995/03/23 08:35:33 cgd Exp $
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
PROG= pom
MAN= pom.6
diff --git a/pom/pom.6 b/pom/pom.6
index 17598fc1..3529a465 100644
--- a/pom/pom.6
+++ b/pom/pom.6
@@ -1,5 +1,7 @@
-.\" Copyright (c) 1989 The Regents of the University of California.
-.\" All rights reserved.
+.\" $NetBSD: pom.6,v 1.4 1995/03/23 08:35:35 cgd Exp $
+.\"
+.\" Copyright (c) 1989, 1993
+.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
@@ -29,10 +31,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" from: @(#)pom.6 5.2 (Berkeley) 6/23/90
-.\" $Id: pom.6,v 1.3 1993/08/05 01:46:54 jtc Exp $
+.\" @(#)pom.6 8.1 (Berkeley) 5/31/93
.\"
-.Dd June 23, 1990
+.Dd May 31, 1993
.Dt POM 6
.Os
.Sh NAME
diff --git a/pom/pom.c b/pom/pom.c
index 07198178..7b1ecc09 100644
--- a/pom/pom.c
+++ b/pom/pom.c
@@ -1,6 +1,8 @@
+/* $NetBSD: pom.c,v 1.4 1995/03/23 08:35:36 cgd Exp $ */
+
/*
- * Copyright (c) 1989 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software posted to USENET.
*
@@ -34,14 +36,17 @@
*/
#ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1989 The Regents of the University of California.\n\
- All rights reserved.\n";
+static char copyright[] =
+"@(#) Copyright (c) 1989, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
-/*static char sccsid[] = "from: @(#)pom.c 5.3 (Berkeley) 2/28/91";*/
-static char rcsid[] = "$Id: pom.c,v 1.3 1995/02/03 18:15:02 jtc Exp $";
+#if 0
+static char sccsid[] = "@(#)pom.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: pom.c,v 1.4 1995/03/23 08:35:36 cgd Exp $";
+#endif
#endif /* not lint */
/*
diff --git a/ppt/Makefile b/ppt/Makefile
index 13700cbe..580a7c1a 100644
--- a/ppt/Makefile
+++ b/ppt/Makefile
@@ -1,5 +1,5 @@
-# from: @(#)Makefile 5.1 (Berkeley) 5/11/90
-# $Id: Makefile,v 1.2 1993/08/01 05:44:46 mycroft Exp $
+# $NetBSD: Makefile,v 1.3 1995/03/23 08:35:38 cgd Exp $
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
PROG= ppt
NOMAN= noman
diff --git a/ppt/ppt.c b/ppt/ppt.c
index 67b41f21..c86c1dc0 100644
--- a/ppt/ppt.c
+++ b/ppt/ppt.c
@@ -1,6 +1,8 @@
+/* $NetBSD: ppt.c,v 1.4 1995/03/23 08:35:40 cgd Exp $ */
+
/*
- * Copyright (c) 1988 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1988, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,14 +34,17 @@
*/
#ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1988 Regents of the University of California.\n\
- All rights reserved.\n";
+static char copyright[] =
+"@(#) Copyright (c) 1988, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
-/*static char sccsid[] = "from: @(#)ppt.c 5.4 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: ppt.c,v 1.3 1993/08/01 18:53:13 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)ppt.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: ppt.c,v 1.4 1995/03/23 08:35:40 cgd Exp $";
+#endif
#endif /* not lint */
#include <stdio.h>
diff --git a/primes/Makefile b/primes/Makefile
index a410af94..0a6747f1 100644
--- a/primes/Makefile
+++ b/primes/Makefile
@@ -1,5 +1,5 @@
-# from: @(#)Makefile 5.1 (Berkeley) 5/11/90
-# $Id: Makefile,v 1.2 1993/08/01 05:44:42 mycroft Exp $
+# $NetBSD: Makefile,v 1.3 1995/03/23 08:35:43 cgd Exp $
+# @(#)Makefile 8.1 (Berkeley) 5/31/93
PROG= primes
SRCS= pattern.c pr_tbl.c primes.c
diff --git a/primes/pattern.c b/primes/pattern.c
index 50e21ab5..c770791c 100644
--- a/primes/pattern.c
+++ b/primes/pattern.c
@@ -1,6 +1,8 @@
+/* $NetBSD: pattern.c,v 1.3 1995/03/23 08:35:47 cgd Exp $ */
+
/*
- * Copyright (c) 1989 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Landon Curt Noll.
@@ -35,8 +37,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)pattern.c 5.2 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: pattern.c,v 1.2 1993/08/01 18:53:08 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)pattern.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: pattern.c,v 1.3 1995/03/23 08:35:47 cgd Exp $";
+#endif
#endif /* not lint */
/*
diff --git a/primes/pr_tbl.c b/primes/pr_tbl.c
index f6a42cfb..f92f21f3 100644
--- a/primes/pr_tbl.c
+++ b/primes/pr_tbl.c
@@ -1,6 +1,8 @@
+/* $NetBSD: pr_tbl.c,v 1.3 1995/03/23 08:35:52 cgd Exp $ */
+
/*
- * Copyright (c) 1989 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Landon Curt Noll.
@@ -35,8 +37,11 @@
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)pr_tbl.c 5.2 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: pr_tbl.c,v 1.2 1993/08/01 18:53:05 mycroft Exp $";
+#if 0
+static char sccsid[] = "@(#)pr_tbl.c 8.1 (Berkeley) 5/31/93";
+#else
+static char rcsid[] = "$NetBSD: pr_tbl.c,v 1.3 1995/03/23 08:35:52 cgd Exp $";
+#endif
#endif /* not lint */
/*
diff --git a/primes/primes.c b/primes/primes.c
index d9f27fe0..57e00731 100644
--- a/primes/primes.c
+++ b/primes/primes.c
@@ -1,6 +1,8 @@
+/* $NetBSD: primes.c,v 1.4 1995/03/23 08:35:55 cgd Exp $ */
+
/*
- * Copyright (c) 1989 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Landon Curt Noll.
@@ -35,22 +37,25 @@
*/
#ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1989 The Regents of the University of California.\n\
- All rights reserved.\n";
+static char copyright[] =
+"@(#) Copyright (c) 1989, 1993\n\
+ The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
-/*static char sccsid[] = "from: @(#)primes.c 5.4 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: primes.c,v 1.3 1994/03/01 01:07:48 cgd Exp $";
+#if 0
+static char sccsid[] = "@(#)primes.c 8.4 (Berkeley) 3/21/94";
+#else
+static char rcsid[] = "$NetBSD: primes.c,v 1.4 1995/03/23 08:35:55 cgd Exp $";
+#endif
#endif /* not lint */
/*
* primes - generate a table of primes between two values
*
- * By: Landon Curt Noll chongo@toad.com, ...!{sun,tolsoft}!hoptoad!chongo
+ * By: Landon Curt Noll chongo@toad.com, ...!{sun,tolsoft}!hoptoad!chongo
*
- * chongo <for a good prime call: 391581 * 2^216193 - 1> /\oo/\
+ * chongo <for a good prime call: 391581 * 2^216193 - 1> /\oo/\
*
* usage:
* primes [start [stop]]
@@ -59,16 +64,18 @@ static char rcsid[] = "$Id: primes.c,v 1.3 1994/03/01 01:07:48 cgd Exp $";
* the value 4294967295 (2^32-1) is assumed. If start is
* omitted, start is read from standard input.
*
- * Prints "ouch" if start or stop is bogus.
- *
* validation check: there are 664579 primes between 0 and 10^7
*/
-#include <stdio.h>
-#include <math.h>
-#include <memory.h>
#include <ctype.h>
+#include <err.h>
+#include <errno.h>
#include <limits.h>
+#include <math.h>
+#include <memory.h>
+#include <stdio.h>
+#include <stdlib.h>
+
#include "primes.h"
/*
@@ -99,197 +106,112 @@ extern ubig *pr_limit; /* largest prime in the prime array */
extern char pattern[];
extern int pattern_size; /* length of pattern array */
-#define MAX_LINE 255 /* max line allowed on stdin */
-
-char *read_num_buf(); /* read a number buffer */
-void primes(); /* print the primes in range */
-char *program; /* our name */
+void primes __P((ubig, ubig));
+ubig read_num_buf __P((void));
+void usage __P((void));
+int
main(argc, argv)
- int argc; /* arg count */
- char *argv[]; /* args */
+ int argc;
+ char *argv[];
{
- char buf[MAX_LINE+1]; /* input buffer */
- char *ret; /* return result */
- ubig start; /* where to start generating */
- ubig stop; /* don't generate at or above this value */
+ ubig start; /* where to start generating */
+ ubig stop; /* don't generate at or above this value */
+ int ch;
+ char *p;
+
+ while ((ch = getopt(argc, argv, "")) != EOF)
+ switch (ch) {
+ case '?':
+ default:
+ usage();
+ }
+ argc -= optind;
+ argv += optind;
- /*
- * parse args
- */
- program = argv[0];
start = 0;
stop = BIG;
- if (argc == 3) {
- /* convert low and high args */
- if (read_num_buf(NULL, argv[1]) == NULL) {
- fprintf(stderr, "%s: ouch\n", program);
- exit(1);
- }
- if (read_num_buf(NULL, argv[2]) == NULL) {
- fprintf(stderr, "%s: ouch\n", program);
- exit(1);
- }
- if (sscanf(argv[1], "%lu", &start) != 1) {
- fprintf(stderr, "%s: ouch\n", program);
- exit(1);
- }
- if (sscanf(argv[2], "%lu", &stop) != 1) {
- fprintf(stderr, "%s: ouch\n", program);
- exit(1);
- }
-
- } else if (argc == 2) {
- /* convert low arg */
- if (read_num_buf(NULL, argv[1]) == NULL) {
- fprintf(stderr, "%s: ouch\n", program);
- exit(1);
- }
- if (sscanf(argv[1], "%lu", &start) != 1) {
- fprintf(stderr, "%s: ouch\n", program);
- exit(1);
- }
-
- } else {
- /* read input until we get a good line */
- if (read_num_buf(stdin, buf) != NULL) {
- /* convert the buffer */
- if (sscanf(buf, "%lu", &start) != 1) {
- fprintf(stderr, "%s: ouch\n", program);
- exit(1);
- }
- } else {
- exit(0);
- }
- }
- if (start > stop) {
- fprintf(stderr, "%s: ouch\n", program);
- exit(1);
+ /*
+ * Convert low and high args. Strtoul(3) sets errno to
+ * ERANGE if the number is too large, but, if there's
+ * a leading minus sign it returns the negation of the
+ * result of the conversion, which we'd rather disallow.
+ */
+ switch (argc) {
+ case 2:
+ /* Start and stop supplied on the command line. */
+ if (argv[0][0] == '-' || argv[1][0] == '-')
+ errx(1, "negative numbers aren't permitted.");
+
+ errno = 0;
+ start = strtoul(argv[0], &p, 10);
+ if (errno)
+ err(1, "%s", argv[0]);
+ if (*p != '\0')
+ errx(1, "%s: illegal numeric format.", argv[0]);
+
+ errno = 0;
+ stop = strtoul(argv[1], &p, 10);
+ if (errno)
+ err(1, "%s", argv[1]);
+ if (*p != '\0')
+ errx(1, "%s: illegal numeric format.", argv[1]);
+ break;
+ case 1:
+ /* Start on the command line. */
+ if (argv[0][0] == '-')
+ errx(1, "negative numbers aren't permitted.");
+
+ errno = 0;
+ start = strtoul(argv[0], &p, 10);
+ if (errno)
+ err(1, "%s", argv[0]);
+ if (*p != '\0')
+ errx(1, "%s: illegal numeric format.", argv[0]);
+ break;
+ case 0:
+ start = read_num_buf();
+ break;
+ default:
+ usage();
}
+
+ if (start > stop)
+ errx(1, "start value must be less than stop value.");
primes(start, stop);
exit(0);
}
/*
- * read_num_buf - read a number buffer from a stream
- *
- * Read a number on a line of the form:
- *
- * ^[ \t]*\(+?[0-9][0-9]\)*.*$
- *
- * where ? is a 1-or-0 operator and the number is within \( \).
- *
- * If does not match the above pattern, it is ignored and a new
- * line is read. If the number is too large or small, we will
- * print ouch and read a new line.
- *
- * We have to be very careful on how we check the magnitude of the
- * input. We can not use numeric checks because of the need to
- * check values against maximum numeric values.
- *
- * This routine will return a line containing a ascii number between
- * 0 and BIG, or it will return NULL.
- *
- * If the stream is NULL then buf will be processed as if were
- * a single line stream.
- *
- * returns:
- * char * pointer to leading digit or +
- * NULL EOF or error
+ * read_num_buf --
+ * This routine returns a number n, where 0 <= n && n <= BIG.
*/
-char *
-read_num_buf(input, buf)
- FILE *input; /* input stream or NULL */
- char *buf; /* input buffer */
+ubig
+read_num_buf()
{
- static char limit[MAX_LINE+1]; /* ascii value of BIG */
- static int limit_len; /* digit count of limit */
- int len; /* digits in input (excluding +/-) */
- char *s; /* line start marker */
- char *d; /* first digit, skip +/- */
- char *p; /* scan pointer */
- char *z; /* zero scan pointer */
-
- /* form the ascii value of BIG if needed */
- if (!isascii(limit[0]) || !isdigit(limit[0])) {
- sprintf(limit, "%lu", BIG);
- limit_len = strlen(limit);
- }
-
- /*
- * the search for a good line
- */
- if (input != NULL && fgets(buf, MAX_LINE, input) == NULL) {
- /* error or EOF */
- return NULL;
- }
- do {
-
- /* ignore leading whitespace */
- for (s=buf; *s && s < buf+MAX_LINE; ++s) {
- if (!isascii(*s) || !isspace(*s)) {
- break;
- }
- }
-
- /* object if - */
- if (*s == '-') {
- fprintf(stderr, "%s: ouch for minuses\n", program);
- continue;
- }
-
- /* skip over any leading + */
- if (*s == '+') {
- d = s+1;
- } else {
- d = s;
- }
-
- /* note leading zeros */
- for (z=d; *z && z < buf+MAX_LINE; ++z) {
- if (*z != '0') {
- break;
- }
- }
-
- /* scan for the first non-digit/non-plus/non-minus */
- for (p=d; *p && p < buf+MAX_LINE; ++p) {
- if (!isascii(*p) || !isdigit(*p)) {
- break;
- }
- }
+ ubig val;
+ char *p, buf[100]; /* > max number of digits. */
- /* ignore empty lines */
- if (p == d) {
- continue;
+ for (;;) {
+ if (fgets(buf, sizeof(buf), stdin) == NULL) {
+ if (ferror(stdin))
+ err(1, "stdin");
+ exit(0);
}
- *p = '\0';
-
- /* object if too many digits */
- len = strlen(z);
- len = (len<=0) ? 1 : len;
- /* accept if digit count is below limit */
- if (len < limit_len) {
- /* we have good input */
- return s;
-
- /* reject very large numbers */
- } else if (len > limit_len) {
- fprintf(stderr, "%s: %s too big\n", program, z);
+ for (p = buf; isblank(*p); ++p);
+ if (*p == '\n' || *p == '\0')
continue;
-
- /* carefully check against near limit numbers */
- } else if (strcmp(z, limit) > 0) {
- fprintf(stderr, "%s: %s a bit too big\n", program, z);
- continue;
- }
- /* number is near limit, but is under it */
- return s;
- } while (input != NULL && fgets(buf, MAX_LINE, input) != NULL);
-
- /* error or EOF */
- return NULL;
+ 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);
+ return (val);
+ }
}
/*
@@ -307,9 +229,9 @@ primes(start, stop)
register ubig fact_lim; /* highest prime for current block */
/*
- * NetBSD has no problems with handling conversion
- * between doubles and unsigned long, so we can go
- * all the way to BIG.
+ * A number of systems can not convert double values into unsigned
+ * longs when the values are larger than the largest signed value.
+ * We don't have this problem, so we can go all the way to BIG.
*/
if (start < 3) {
start = (ubig)2;
@@ -337,8 +259,7 @@ primes(start, stop)
if (start <= *pr_limit) {
/* skip primes up to the start value */
for (p = &prime[0], factor = prime[0];
- factor < stop && p <= pr_limit;
- factor = *(++p)) {
+ factor < stop && p <= pr_limit; factor = *(++p)) {
if (factor >= start) {
printf("%u\n", factor);
}
@@ -363,8 +284,7 @@ primes(start, stop)
memcpy(table, &pattern[factor], pattern_size-factor);
/* main block pattern copies */
for (fact_lim=pattern_size-factor;
- fact_lim+pattern_size<=TABSIZE;
- fact_lim+=pattern_size) {
+ fact_lim+pattern_size<=TABSIZE; fact_lim+=pattern_size) {
memcpy(&table[fact_lim], pattern, pattern_size);
}
/* final block pattern copy */
@@ -409,3 +329,10 @@ primes(start, stop)
}
}
}
+
+void
+usage()
+{
+ (void)fprintf(stderr, "usage: primes [start [stop]]\n");
+ exit(1);
+}
diff --git a/primes/primes.h b/primes/primes.h
index 72504c75..3197d271 100644
--- a/primes/primes.h
+++ b/primes/primes.h
@@ -1,6 +1,8 @@
+/* $NetBSD: primes.h,v 1.4 1995/03/23 08:35:58 cgd Exp $ */
+
/*
- * Copyright (c) 1989 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Landon Curt Noll.
@@ -33,25 +35,20 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * from: @(#)primes.h 5.2 (Berkeley) 6/1/90
- * $Id: primes.h,v 1.3 1994/03/01 01:07:51 cgd Exp $
+ * @(#)primes.h 8.2 (Berkeley) 3/1/94
*/
/*
* primes - generate a table of primes between two values
*
- * By: Landon Curt Noll chongo@toad.com, ...!{sun,tolsoft}!hoptoad!chongo
+ * By: Landon Curt Noll chongo@toad.com, ...!{sun,tolsoft}!hoptoad!chongo
*
- * chongo <for a good prime call: 391581 * 2^216193 - 1> /\oo/\
+ * chongo <for a good prime call: 391581 * 2^216193 - 1> /\oo/\
*/
/* ubig is the type that holds a large unsigned value */
-typedef unsigned long ubig; /* must be >=32 bit unsigned value */
+typedef unsigned long ubig; /* must be >=32 bit unsigned value */
+#define BIG ULONG_MAX /* largest value will sieve */
-/*
- * sieve parameters
- */
-#define BIG ULONG_MAX /* highest value we will sieve */
-#define SEMIBIG ((ubig)LONG_MAX) /* highest signed value */
-#define NEG_SEMIBIG ((ubig)LONG_MIN) /* lowest signed value */
-#define TABSIZE 256*1024 /* bytes in sieve table (must be > 3*5*7*11) */
+/* bytes in sieve table (must be > 3*5*7*11) */
+#define TABSIZE 256*1024