- put the game description in the manpage, showing The Wumpus some damn respect by making at least a .Bl list of pits, bats, and the wump. - remove wump.info, instructions(), and pathnames.h - pledge a simple "stdio"
Jan Index: Makefile =================================================================== RCS file: /cvs/src/games/wump/Makefile,v retrieving revision 1.5 diff -u -p -r1.5 Makefile --- Makefile 23 May 2002 18:43:00 -0000 1.5 +++ Makefile 30 Nov 2015 13:43:14 -0000 @@ -3,8 +3,4 @@ PROG= wump MAN= wump.6 -beforeinstall: - ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 \ - ${.CURDIR}/wump.info ${DESTDIR}/usr/share/games - .include <bsd.prog.mk> Index: pathnames.h =================================================================== RCS file: pathnames.h diff -N pathnames.h --- pathnames.h 3 Jun 2003 03:01:42 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,35 +0,0 @@ -/* $OpenBSD: pathnames.h,v 1.3 2003/06/03 03:01:42 millert 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 - * 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. 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. - * - * @(#)pathnames.h 8.1 (Berkeley) 5/31/93 - */ - -#define _PATH_PAGER "/usr/bin/more" -#define _PATH_WUMPINFO "/usr/share/games/wump.info" Index: wump.6 =================================================================== RCS file: /cvs/src/games/wump/wump.6,v retrieving revision 1.9 diff -u -p -r1.9 wump.6 --- wump.6 31 May 2007 19:19:19 -0000 1.9 +++ wump.6 30 Nov 2015 13:43:14 -0000 @@ -58,6 +58,74 @@ Your quest is to find and shoot the evil the cave without running into any pits or using up your limited supply of arrows. .Pp +While wandering through the cave you'll notice that, while there are tunnels +everywhere, there are some mysterious quirks to the cave topology, including +some tunnels that go from one room to another, but not necessarily back! +Also, most pesky of all are the rooms that are home to large numbers of bats, +which, upon being disturbed, will en masse grab you and move you to another +portion of the cave (including those housing bottomless pits, sure +death for unwary explorers). +.Pp +Fortunately, you're not going into the cave without any weapons or tools, +and in fact your biggest aids are your senses; you can often smell the +rather odiferous Wumpus up to +.Em two +rooms away, and you can always feel the drafts created by the occasional +bottomless pit and hear the rustle of the bats in caves they might be +sleeping within. +.Pp +To kill the wumpus, you'll need to shoot it with one of your magic arrows. +Fortunately, you don't have to be in the same room as the creature, and can +instead shoot the arrow from as far as three or four rooms away! +.Pp +When you shoot an arrow, you do so by typing in a list of rooms that you'd +like it to travel to. +If at any point in its travels it cannot find a tunnel to the room you +specify from the room it's in, it will instead randomly fly down one of the +tunnels, possibly, if you're real unlucky, even flying back into the room +you're in and hitting you! +.Pp +The game has the following hazards for intrepid adventurers +to wend their way through: +.Bl -tag -width Wumpus +.It Pits +If you fall into one of the bottomless pits, +you find yourself slung back out on the far side of the Earth +and in very poor shape to continue your quest since you're dead. +.It Bats +As with any other cave, the Wumpus cave has bats in residence. +These are a bit more potent, however, +and if you stumble into one of their rooms +they will rush up and carry you elsewhere in the cave. +.It Wumpus +If you happen to walk into the room the Wumpus is in you'll find +that he has quite an appetite for young adventurous humans! +Not recommended. +.El +.Pp +The Wumpus, by the way, is not bothered by the hazards +since he has sucker feet and is too big for the bats to lift. +If you try to shoot him and miss, +there's also a chance that he'll up and move himself into another room, +though by nature the Wumpus is a sedentary creature. +.Pp +Each turn you may either move or shoot a crooked arrow. +Moving is done simply by specifying +.Sq m +for move and the number of the room +that you'd like to move down a tunnel towards. +Shooting is done similarly; indicate that you'd like to +shoot one of your magic arrows with an +.Sq s +for shoot, then list a set of connected room numbers +through which the deadly shaft should fly! +.Pp +If a tunnel does not exist between two consecutive rooms +in the arrow's path, the arrow will flail about +and randomly pick an existing tunnel to continue through. +You might just end up shooting yourself in the foot if you're not careful! +On the other hand, if you shoot the Wumpus you've WON! +.Pp The options are as follows: .Bl -tag -width indent .It Fl a Ar arrows @@ -85,30 +153,3 @@ another room. Beware, too many tunnels in a small cave can easily cause it to collapse! The default cave room has three tunnels to other rooms. .El -.Pp -While wandering through the cave you'll notice that, while there are tunnels -everywhere, there are some mysterious quirks to the cave topology, including -some tunnels that go from one room to another, but not necessarily back! -Also, most pesky of all are the rooms that are home to large numbers of bats, -which, upon being disturbed, will en masse grab you and move you to another -portion of the cave (including those housing bottomless pits, sure -death for unwary explorers). -.Pp -Fortunately, you're not going into the cave without any weapons or tools, -and in fact your biggest aids are your senses; you can often smell the -rather odiferous Wumpus up to -.Em two -rooms away, and you can always feel the drafts created by the occasional -bottomless pit and hear the rustle of the bats in caves they might be -sleeping within. -.Pp -To kill the wumpus, you'll need to shoot it with one of your magic arrows. -Fortunately, you don't have to be in the same room as the creature, and can -instead shoot the arrow from as far as three or four rooms away! -.Pp -When you shoot an arrow, you do so by typing in a list of rooms that you'd -like it to travel to. -If at any point in its travels it cannot find a tunnel to the room you -specify from the room it's in, it will instead randomly fly down one of the -tunnels, possibly, if you're real unlucky, even flying back into the room -you're in and hitting you! Index: wump.c =================================================================== RCS file: /cvs/src/games/wump/wump.c,v retrieving revision 1.27 diff -u -p -r1.27 wump.c --- wump.c 30 Nov 2015 09:00:02 -0000 1.27 +++ wump.c 30 Nov 2015 13:43:15 -0000 @@ -49,7 +49,6 @@ #include <string.h> #include <time.h> #include <unistd.h> -#include "pathnames.h" /* some defines to spec out what our wumpus cave should look like */ @@ -108,7 +107,6 @@ void dodecahedral_cave_init(void); int gcd(int, int); int getans(const char *); void initialize_things_in_cave(void); -void instructions(void); int int_compare(const void *, const void *); /* void jump(int); */ void kill_wump(void); @@ -135,7 +133,7 @@ main(int argc, char *argv[]) { int c; - if (pledge("stdio rpath proc exec", NULL) == -1) + if (pledge("stdio", NULL) == -1) err(1, "pledge"); #ifdef DEBUG @@ -222,11 +220,6 @@ main(int argc, char *argv[]) errx(1, "the wumpus refused to enter the cave, claiming it was too dangerous!"); - instructions(); - - if (pledge("stdio", NULL) == -1) - err(1, "pledge"); - if (oldstyle) dodecahedral_cave_init(); else @@ -860,51 +853,6 @@ int int_compare(const void *a, const void *b) { return(*(const int *)a < *(const int *)b ? -1 : 1); -} - -void -instructions(void) -{ - const char *pager; - pid_t pid; - int status; - int fd; - - /* - * read the instructions file, if needed, and show the user how to - * play this game! - */ - if (!getans("Instructions? (y-n) ")) - return; - - if ((fd = open(_PATH_WUMPINFO, O_RDONLY)) == -1) { - (void)printf( -"Sorry, but the instruction file seems to have disappeared in a\n\ -puff of greasy black smoke! (poof)\n"); - return; - } - - if (!isatty(1)) - pager = "/bin/cat"; - else { - if (!(pager = getenv("PAGER")) || (*pager == 0)) - pager = _PATH_PAGER; - } - switch (pid = fork()) { - case 0: /* child */ - if (dup2(fd, 0) == -1) - err(1, "dup2"); - (void)execl(_PATH_BSHELL, "sh", "-c", pager, (char *)NULL); - err(1, "exec sh -c %s", pager); - /* NOT REACHED */ - case -1: - err(1, "fork"); - /* NOT REACHED */ - default: - (void)waitpid(pid, &status, 0); - close(fd); - break; - } } void Index: wump.info =================================================================== RCS file: wump.info diff -N wump.info --- wump.info 31 Jan 1998 19:20:23 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,43 +0,0 @@ -Welcome to the game of Hunt the Wumpus. - -The Wumpus typically lives in a cave of twenty rooms, where each room -is connected by three tunnels to the other rooms in the cavern. Caves -may vary, however, depending on options specified when starting the game. -The cave may contain one-way passages. - -The game has the following hazards for intrepid adventurers to wend their -way through: - - Pits -- If you fall into one of the bottomless pits, you find yourself - slung back out on the far side of the Earth and in very poor - shape to continue your quest since you're dead. - - Bats -- As with any other cave, the Wumpus cave has bats in residence. - These are a bit more potent, however, and if you stumble into - one of their rooms they will rush up and carry you elsewhere in - the cave. - - Wumpus -- If you happen to walk into the room the Wumpus is in you'll find - that he has quite an appetite for young adventurous humans! Not - recommended. - -The Wumpus, by the way, is not bothered by the hazards since he has sucker -feet and is too big for the bats to lift. If you try to shoot him and miss, -there's also a chance that he'll up and move himself into another room, -though by nature the Wumpus is a sedentary creature. - -Each turn you may either move or shoot a crooked arrow. Moving is done -simply by specifying "m" for move and the number of the room that you'd -like to move down a tunnel towards. Shooting is done similarly; indicate -that you'd like to shoot one of your magic arrows with an "s" for shoot, -then list a set of connected room numbers through which the deadly shaft -should fly! - -If a tunnel does not exist between two consecutive rooms in the arrow's -path, the arrow will flail about and randomly pick an existing tunnel -to continue through. You might just end up shooting yourself in the -foot if you're not careful! On the other hand, if you shoot the Wumpus -you've WON! - -Good luck. -