diff options
Diffstat (limited to 'larn')
-rw-r--r-- | larn/COPYRIGHT | 2 | ||||
-rw-r--r-- | larn/Fixed.Bugs | 2 | ||||
-rw-r--r-- | larn/Makefile | 14 | ||||
-rw-r--r-- | larn/README | 2 | ||||
-rw-r--r-- | larn/bill.c | 266 | ||||
-rw-r--r-- | larn/config.c | 2 | ||||
-rw-r--r-- | larn/create.c | 2 | ||||
-rw-r--r-- | larn/data.c | 9 | ||||
-rw-r--r-- | larn/diag.c | 2 | ||||
-rw-r--r-- | larn/display.c | 2 | ||||
-rw-r--r-- | larn/fortune.c | 138 | ||||
-rw-r--r-- | larn/global.c | 2 | ||||
-rw-r--r-- | larn/header.h | 5 | ||||
-rw-r--r-- | larn/help.c | 2 | ||||
-rw-r--r-- | larn/io.c | 2 | ||||
-rw-r--r-- | larn/larn.6 | 13 | ||||
-rw-r--r-- | larn/main.c | 2 | ||||
-rw-r--r-- | larn/monster.c | 2 | ||||
-rw-r--r-- | larn/moreobj.c | 2 | ||||
-rw-r--r-- | larn/movem.c | 2 | ||||
-rw-r--r-- | larn/nap.c | 2 | ||||
-rw-r--r-- | larn/object.c | 2 | ||||
-rw-r--r-- | larn/pathnames.h | 5 | ||||
-rw-r--r-- | larn/regen.c | 2 | ||||
-rw-r--r-- | larn/savelev.c | 2 | ||||
-rw-r--r-- | larn/scores.c | 2 | ||||
-rw-r--r-- | larn/signal.c | 2 | ||||
-rw-r--r-- | larn/store.c | 9 | ||||
-rw-r--r-- | larn/tok.c | 2 |
29 files changed, 281 insertions, 220 deletions
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. */ @@ -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 */ /* @@ -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. */ @@ -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. */ |