new upstream

git-svn-id: file:///srv/svn/joey/trunk/src/packages/bsdgames@10080 a4a2c43b-8ac3-0310-8836-e0e880c912e2
This commit is contained in:
joey
2004-02-14 21:35:37 +00:00
parent 26fb70d304
commit a02c126403
224 changed files with 5624 additions and 2217 deletions

47
COPYING
View File

@@ -102,11 +102,11 @@ These terms also apply to "hunt/Makeconfig", which is derived from the
hunt "Makefile.inc" distributed by NetBSD. hunt "Makefile.inc" distributed by NetBSD.
The files "backgammon/backgammon/backlocal.h", "countmail/countmail", The files "backgammon/backgammon/backlocal.h", "countmail/countmail",
"hack/extern.h", "robots/auto.c", "sail/display.h" and "dm/utmpentry.c", "dm/utmpentry.h", "hack/extern.h", "robots/auto.c",
"sail/restart.h" have a similar licence, but copyright is held by the "sail/display.h", "sail/restart.h" and the game "dab" have a similar
NetBSD Foundation: licence, but copyright is held by the NetBSD Foundation:
Copyright (c) 1997, 1998, 1999, 2001 The NetBSD Foundation, Inc. Copyright (c) 1997, 1998, 1999, 2001, 2002, 2003 The NetBSD Foundation, Inc.
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
@@ -137,6 +137,32 @@ NetBSD Foundation:
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
In the case of "dab/dab.6", the copyright is held by Thomas Klausner:
Copyright (c) 2003 Thomas Klausner.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
In the case of "adventure/extern.h" the copyright is held by Christos In the case of "adventure/extern.h" the copyright is held by Christos
Zoulas: Zoulas:
@@ -361,7 +387,7 @@ insofar as they get compiled into the games; note that the include
files are probably irrelevant for this purpose as it is unlikely they files are probably irrelevant for this purpose as it is unlikely they
are significant enough to make any binary a derived work). are significant enough to make any binary a derived work).
Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003 Joseph Samuel Myers. Copyright (c) 1997-2004 Joseph Samuel Myers.
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
@@ -400,16 +426,15 @@ qualify for copyright; but if not, then the terms given above apply
(and, of course, running the test command gives an identical output (and, of course, running the test command gives an identical output
file to which you could apply your own copyright). file to which you could apply your own copyright).
The files "bsd-games.lsm", "ChangeLog.0", "THANKS", "INSTALL", The files "bsd-games.lsm", "ChangeLog.0", "THANKS", "INSTALL" and
"README", "TODO", "boggle/README.linux", "fortune/README.linux", and "README" are still significantly derived from files in the original
"hunt/README.linux" are still significantly derived from files in the bsd-games package for Linux by Curt Olson and Andy Tefft. It is
original bsd-games package for Linux by Curt Olson and Andy Tefft. It expected that the following terms will apply to these files, and to
is expected that the following terms will apply to these files, and to
the compilation copyright on the package as a whole; ***this has yet the compilation copyright on the package as a whole; ***this has yet
to be confirmed with Andy Tefft***: to be confirmed with Andy Tefft***:
Copyright (c) 1993 Curt Olson, Andy Tefft. Copyright (c) 1993 Curt Olson, Andy Tefft.
Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003 Joseph Samuel Myers. Copyright (c) 1997-2004 Joseph Samuel Myers.
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without

245
ChangeLog
View File

@@ -1,3 +1,248 @@
2004-02-13 Joseph S. Myers <jsm@polyomino.org.uk>
* NEWS, bsd-games.lsm, bsd-games-non-free.lsm: Update.
* morse/morse.c: Update from NetBSD CVS.
* morse/morse.c: Encode and decode more characters. Don't put
commas after every character. Don't encode whitespace as "...".
Don't fail decoding across a 1024-byte boundary. Mark end of
message appropriately. From OpenBSD but with punctuation taken
from ITU-T Recommendation F.1 (03/98).
* tests/morse.testsent, tests/morse.testsentd: New tests.
* tests/morse.SOS, tests/morse.foo, tests/morse.sos: Update.
* tests/morse.test: Update.
2004-02-11 Joseph S. Myers <jsm@polyomino.org.uk>
* tests/pom.2003fm1, tests/pom.2003fm2, tests/pom.2003fq1,
tests/pom.2003fq2, tests/pom.2003lq1, tests/pom.2003lq2,
tests/pom.2003nm1, tests/pom.2003nm2, tests/pom.2003ph1,
tests/pom.2003ph2, tests/pom.2003ph3, tests/pom.2003ph4,
tests/pom.2003ph5, tests/pom.2003ph6, tests/pom.2003ph7,
tests/pom.2003ph8: New tests.
* tests/pom.test: Update.
2004-02-10 Joseph S. Myers <jsm@polyomino.org.uk>
* primes/primes.6: Update from NetBSD CVS.
2004-02-09 Joseph S. Myers <jsm@polyomino.org.uk>
* configure: Ask for a documentation directory if building trek or
rogue.
* Makeconfig.in (DOCDIR): Define.
* substfiles2: Add trek/trek.6.
* trek/trek.6: Rename to trek/trek.6.in.
* trek/trek.6.in: Mark documentation directory for substitution.
* rogue/Makefrag, trek/Makefrag: Install USD documents.
* INSTALL, PACKAGING, README: Update.
2004-02-08 Joseph S. Myers <jsm@polyomino.org.uk>
* backgammon/backgammon/main.c, backgammon/teachgammon/teach.c,
cribbage/cribbage.h, dm/dm.c, fortune/unstr/unstr.c,
hunt/hunt/hunt.c, hunt/hunt/otto.c, hunt/huntd/faketalk.c,
hunt/huntd/hunt.h, phantasia/Makefile.bsd, rain/rain.c,
worms/worms.c: Update from NetBSD CVS.
* rain/rain.c, worms/worms.c: Hide the cursor with curs_set(0).
From OpenBSD.
* tests/factor.8675309, tests/factor.6172538568: New tests (from
NetBSD src/regress).
* tests/factor.test: Update.
* boggle/README.linux, dm/README.linux, fortune/README.linux,
hunt/README.linux, trek/README.linux: Remove.
* README: Move information from those files to here.
* INSTALL: Update.
* COPYING: Update.
* factor/Makefile.bsd, factor/factor.6, factor/factor.c,
primes/Makefile.bsd, primes/primes.6: Update from NetBSD CVS.
* TODO: Update.
* substscr: Explicitly set execute permissions from those of
source file.
* primes/primes.6: Separate manpage from that of factor.
* primes/Makefrag: Update.
* factor/factor.6: Change to be a manpage for factor only.
* factor/factor.c: Only use Pollard p-1 if remaining factor isn't
prime. Correct comment. Increase base if p-1 algorithm reaches
1.
* tests/factor.2147483647111311, tests/factor.99999999999991: New
tests.
* tests/factor.test: Update.
Bugs reported by David A Bagley <bagleyd@tux.org>.
* countmail/countmail.6, phantasia/fight.c, phantasia/io.c,
sail/extern.h, sail/misc.c, snake/snake/snake.c: Update from
NetBSD CVS.
2004-01-27 Joseph S. Myers <jsm@polyomino.org.uk>
* dab/.cvsignore: New file.
* Makeconfig.in: Add STRLCPY_DEFS and GETPROGNAME_DEFS.
* arithmetic/Makefrag, fortune/fortune/Makefrag, rogue/Makefrag:
Use them.
* dm/utmpentry.c, dm/utmpentry.h: New from NetBSD CVS of
usr.bin/who.
* COPYING: Update.
* dm/dm.c: Follow NetBSD in use of this utmp handling.
* dm/Makefrag: Update.
* exec.objs: Update.
* lib/getprogname.c: New file.
* include/stdlib.h: Update.
* configure: Check for getprogname.
* arithmetic/arithmetic.c, fortune/fortune/fortune.c: Follow
NetBSD in use of getprogname().
* exec.objs: Update.
* adventure/extern.h, adventure/main.c, arithmetic/arithmetic.c,
atc/extern.h, atc/input.c, backgammon/backgammon/backlocal.h,
backgammon/backgammon/move.c, backgammon/common_source/back.h,
backgammon/teachgammon/tutor.h, banner/banner.c,
battlestar/battlestar.c, battlestar/extern.h, battlestar/fly.c,
battlestar/init.c, battlestar/parse.c, bcd/bcd.c,
boggle/boggle/bog.c, boggle/boggle/extern.h, boggle/boggle/mach.c,
boggle/boggle/prtable.c, boggle/boggle/timer.c, caesar/caesar.c,
canfield/canfield/canfield.c, canfield/cfscores/cfscores.c,
cribbage/crib.c, cribbage/cribbage.h, dm/dm.c, fish/fish.c,
fortune/fortune/fortune.c, fortune/unstr/unstr.c, gomoku/gomoku.h,
gomoku/main.c, gomoku/pickmove.c, hack/def.func_tab.h,
hack/extern.h, hack/hack.apply.c, hack/hack.do.c, hack/hack.h,
hack/hack.invent.c, hack/hack.main.c, hack/hack.shk.c,
hack/hack.vault.c, hack/hack.zap.c, hangman/hangman.h,
hunt/hunt/hunt.c, hunt/hunt/otto.c, hunt/hunt/playit.c,
hunt/huntd/driver.c, hunt/huntd/execute.c, hunt/huntd/expl.c,
hunt/huntd/faketalk.c, hunt/huntd/hunt.h, hunt/huntd/makemaze.c,
hunt/huntd/shots.c, hunt/huntd/talk_ctl.h, mille/mille.h,
mille/table.c, mille/varpush.c, monop/cards.c, monop/execute.c,
monop/getinp.c, monop/houses.c, monop/malloc.c, monop/monop.c,
monop/monop.def, monop/monop.ext, monop/monop.h, monop/morg.c,
monop/print.c, monop/prop.c, monop/trade.c, morse/morse.c,
number/number.c, pig/pig.c, pom/pom.c, ppt/ppt.c, primes/primes.c,
quiz/quiz.c, quiz/quiz.h, quiz/rxp.c, rain/rain.c,
random/random.c, robots/auto.c, robots/main.c, robots/robots.h,
robots/score.c, rogue/main.c, rogue/rogue.h, sail/extern.h,
sail/pl_1.c, sail/sync.c, snake/snake/snake.c,
snake/snscore/snscore.c, tetris/input.h, tetris/scores.c,
tetris/scores.h, tetris/screen.c, tetris/screen.h,
tetris/tetris.c, tetris/tetris.h, trek/compkl.c, trek/computer.c,
trek/dumpgame.c, trek/getpar.c, trek/getpar.h, trek/main.c,
trek/torped.c, trek/trek.h, worm/worm.c, worms/worms.c,
wump/wump.c: Update from NetBSD CVS.
* adventure/extern.h, adventure/main.c, arithmetic/arithmetic.c,
atc/extern.h, atc/input.c, backgammon/backgammon/backlocal.h,
backgammon/backgammon/move.c, backgammon/common_source/back.h,
backgammon/teachgammon/tutor.h, banner/banner.c,
battlestar/battlestar.c, battlestar/extern.h, battlestar/fly.c,
battlestar/init.c, battlestar/parse.c, bcd/bcd.c,
boggle/boggle/bog.c, boggle/boggle/extern.h, boggle/boggle/mach.c,
boggle/boggle/prtable.c, boggle/boggle/timer.c, caesar/caesar.c,
canfield/canfield/canfield.c, canfield/cfscores/cfscores.c,
cribbage/crib.c, cribbage/cribbage.h, dm/dm.c, fish/fish.c,
fortune/fortune/fortune.c, fortune/unstr/unstr.c, gomoku/gomoku.h,
gomoku/main.c, hack/def.func_tab.h, hack/extern.h,
hack/hack.apply.c, hack/hack.do.c, hack/hack.h,
hack/hack.invent.c, hack/hack.main.c, hack/hack.shk.c,
hack/hack.vault.c, hack/hack.zap.c, hangman/hangman.h,
hunt/hunt/hunt.c, hunt/hunt/otto.c, hunt/hunt/playit.c,
hunt/huntd/driver.c, hunt/huntd/execute.c, hunt/huntd/expl.c,
hunt/huntd/faketalk.c, hunt/huntd/hunt.h, hunt/huntd/makemaze.c,
hunt/huntd/shots.c, hunt/huntd/talk_ctl.h, mille/mille.h,
mille/table.c, mille/varpush.c, monop/cards.c, monop/execute.c,
monop/getinp.c, monop/houses.c, monop/monop.c, monop/monop.def,
monop/monop.ext, monop/monop.h, monop/morg.c, monop/print.c,
monop/prop.c, monop/trade.c, monop/malloc.c, morse/morse.c,
number/number.c, pig/pig.c, pom/pom.c, ppt/ppt.c, primes/primes.c,
quiz/quiz.c, quiz/quiz.h, quiz/rxp.c, rain/rain.c,
random/random.c, robots/auto.c, robots/main.c, robots/robots.h,
robots/score.c, rogue/main.c, rogue/rogue.h, snake/snake/snake.c,
snake/snscore/snscore.c, tetris/input.h, tetris/scores.c,
tetris/scores.h, tetris/screen.c, tetris/screen.h,
tetris/tetris.c, tetris/tetris.h, trek/compkl.c, trek/computer.c,
trek/dumpgame.c, trek/getpar.c, trek/getpar.h, trek/main.c,
trek/torped.c, trek/trek.h, worm/worm.c, worms/worms.c,
wump/wump.c: Remove uses of __P.
* THANKS: Mention David A Bagley.
* sail/pl_1.c (child): Use int for wait status.
* gomoku/gomoku.h, robots/robots.h, sail/extern.h, sail/misc.c,
sail/sync.c: Adjust system header includes.
* fortune/fortune/fortune.6.in: Update substitution for path to
fortunes directory.
* cribbage/crib.c, cribbage/cribbage.h, cribbage/io.c,
dab/Makefile.bsd, monop/misc.c, monop/monop.def, monop/monop.ext:
Update from NetBSD CVS.
2004-01-26 Joseph S. Myers <jsm@polyomino.org.uk>
* sail/main.c: Reorder includes to match NetBSD.
* cribbage/cribbage.h, cribbage/crib.c, cribbage/io.c: Rename
receive_int to receive_intr.
* hack/hack.pri.c: Fix typo in merge from NetBSD.
* configure: Consistently use balanced parentheses in case
statements.
2004-01-25 Joseph S. Myers <jsm@polyomino.org.uk>
* monop/misc.c, monop/monop.def, monop/monop.ext: Rename yn to
yncoms.
* cribbage/cribbage.h, cribbage/crib.c, cribbage/io.c: Rename rint
to receive_int.
* fortune/fortune/fortune.c: Add test for __CYGWIN__.
* configure: Test for sig_t.
* include/signal.h: Use it.
Cygwin issues reported by David A Bagley <bagleyd@tux.org>.
2004-01-16 Joseph S. Myers <jsm@polyomino.org.uk>
* wtf/acronyms, wtf/acronyms.comp: Update from NetBSD CVS.
2004-01-14 Joseph S. Myers <jsm@polyomino.org.uk>
* wtf/acronyms, wtf/acronyms.comp: Update from NetBSD CVS.
2004-01-04 Joseph S. Myers <jsm@polyomino.org.uk>
* COPYING: Note that TODO no longer contains anything from the
original bsd-games 1.3.
* phantasia/phantasia.6, wtf/acronyms, wtf/acronyms.comp: Update
from NetBSD CVS.
2004-01-02 Joseph S. Myers <jsm@polyomino.org.uk>
* atc/atc.6.in, backgammon/backgammon/main.c,
backgammon/teachgammon/data.c, caesar/caesar.c,
fortune/datfiles/fortunes, fortune/datfiles/fortunes2,
fortune/fortune/fortune.c, hack/hack.options.c, phantasia/main.c,
phantasia/misc.c, rogue/Makefile.bsd, rogue/rogue.h,
wargames/wargames.6, worm/worm.6, wtf/acronyms: Update from NetBSD
CVS.
* dab: New directory from NetBSD CVS.
* COPYING, INSTALL, README, bsd-games.lsm, Makeconfig.in,
configure, exec.libs, exec.objs: Update.
* dab/Makefrag: New file.
2003-12-18 Joseph S. Myers <jsm@polyomino.org.uk> 2003-12-18 Joseph S. Myers <jsm@polyomino.org.uk>
* Version 2.15. * Version 2.15.

20
INSTALL
View File

@@ -23,17 +23,15 @@ the bsd-games-non-free package unpacks conventionally into a directory
of its own. It can be built separately from bsd-games, or in the same of its own. It can be built separately from bsd-games, or in the same
source directory: to do the latter, move those files and directories source directory: to do the latter, move those files and directories
that are in bsd-games-non-free but not bsd-games into the that are in bsd-games-non-free but not bsd-games into the
bsd-games-VERSION directory before building. If you are building bsd-games-VERSION directory before building.
bsd-games, cd to boggle and decide if you want -DNEW_STYLE or not --
see boggle/README.linux for more information. If you are in a hurry,
don't worry about it ... it really is more of an aesthetic thing.
Prerequisites Prerequisites
============= =============
You need the following to build this distribution: You need the following to build this distribution:
* GCC (the C compiler only - other languages not needed). * GCC (the C and C++ compilers only - other languages not needed; C++
only needed for dab).
* glibc 2.3 or later. Older versions will not work (at least for * glibc 2.3 or later. Older versions will not work (at least for
hunt) since they lack the <ifaddrs.h> header. hunt) since they lack the <ifaddrs.h> header.
@@ -161,13 +159,7 @@ Building and installation
this or a later version, and a new one created with the correct this or a later version, and a new one created with the correct
permissions. permissions.
10. You may wish to do something with the BSD Users' Supplementary 10. "make distclean" will restore the source directory to the original
Documents for trek and rogue, in trek/USD.doc/trek.me and
rogue/USD.doc/rogue.me. You can look at them on a text terminal
with "nroff -me" (piped to your pager), or format in PostScript
for printing with "groff -me -Tps".
11. "make distclean" will restore the source directory to the original
unpacked state. The automatically generated dependency files unpacked state. The automatically generated dependency files
include paths to system headers, including those in gcc's internal include paths to system headers, including those in gcc's internal
header directory: if you have changed your compiler or library header directory: if you have changed your compiler or library
@@ -180,10 +172,6 @@ Building and installation
Further information Further information
=================== ===================
Some subdirectories have README.linux files. If you are still having
trouble with a program, check this file first -- it may contain some
helpful hints, or information about further configuration options.
See TODO for information on what needs to be improved in this package; See TODO for information on what needs to be improved in this package;
you may want to volunteer for some of the things in there. you may want to volunteer for some of the things in there.

View File

@@ -1,6 +1,6 @@
# Makeconfig.in - configuration included in Makefiles after substitution. # Makeconfig.in - configuration included in Makefiles after substitution.
# #
# Copyright (c) 1997, 1998, 1999, 2000, 2003 Joseph Samuel Myers. # Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004 Joseph Samuel Myers.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@@ -50,6 +50,8 @@ MAN8DIR := @man8dir@
MAN5DIR := @man5dir@ MAN5DIR := @man5dir@
# Constant data (arch-independent) # Constant data (arch-independent)
SHAREDIR := @sharedir@ SHAREDIR := @sharedir@
# Miscellaneous documentation
DOCDIR := @docdir@
# Variable data # Variable data
VARLIBDIR := @varlibdir@ VARLIBDIR := @varlibdir@
# Directory for hidden games (dm) # Directory for hidden games (dm)
@@ -83,12 +85,17 @@ HIDE_GAME := @hidegame@
# Compilation details # Compilation details
CC := @cc@ CC := @cc@
CXX := @cxx@
OPTIMIZE := @optimize_flags@ OPTIMIZE := @optimize_flags@
WARNING := @warning_flags@ WARNING := @warning_flags@
CXX_WARNING := @cxx_warning_flags@
CFLAGS := $(OPTIMIZE) $(WARNING) @other_cflags@ CFLAGS := $(OPTIMIZE) $(WARNING) @other_cflags@
CXXFLAGS := $(OPTIMIZE) $(CXX_WARNING) @other_cflags@
LDFLAGS := @other_ldflags@ LDFLAGS := @other_ldflags@
FGETLN_DEFS := @fgetln_defs@ FGETLN_DEFS := @fgetln_defs@
GETLOADAVG_DEFS := @getloadavg_defs@ GETLOADAVG_DEFS := @getloadavg_defs@
STRLCPY_DEFS := @strlcpy_defs@
GETPROGNAME_DEFS := @getprogname_defs@
NCURSES_LIB := @ncurses_lib@ NCURSES_LIB := @ncurses_lib@
NCURSES_INCS := @ncurses_includes@ NCURSES_INCS := @ncurses_includes@
OPENSSL_LIB := @openssl_lib@ OPENSSL_LIB := @openssl_lib@

View File

@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.20 2002/06/16 22:24:00 itojun Exp $ # $NetBSD: Makefile,v 1.21 2003/12/26 17:59:13 christos Exp $
# @(#)Makefile 8.3 (Berkeley) 7/24/94 # @(#)Makefile 8.3 (Berkeley) 7/24/94
# Missing: ching dungeon warp # Missing: ching dungeon warp
@@ -6,8 +6,8 @@
# Don't belong: xneko xroach # Don't belong: xneko xroach
SUBDIR= adventure arithmetic atc backgammon banner battlestar bcd boggle \ SUBDIR= adventure arithmetic atc backgammon banner battlestar bcd boggle \
caesar canfield countmail cribbage dm factor fish fortune gomoku hack \ caesar canfield countmail cribbage dab dm factor fish fortune gomoku \
hangman hunt larn mille monop morse number phantasia pig pom ppt \ hack hangman hunt larn mille monop morse number phantasia pig pom ppt \
primes quiz rain random robots rogue sail snake tetris trek wargames \ primes quiz rain random robots rogue sail snake tetris trek wargames \
worm worms wtf wump worm worms wtf wump

16
NEWS
View File

@@ -11,6 +11,22 @@ changes in installation instructions. Packagers should also reread
the PACKAGING file each version (or do a diff between the old and new the PACKAGING file each version (or do a diff between the old and new
versions of the package and read that). versions of the package and read that).
Version 2.16 (2004-02-13)
============
* Updated from NetBSD CVS of 2004-02-12. Includes a new game, dab
(Dots and Boxes), written in C++.
* Supplementary documentation for trek and rogue now installed
automatically (in a configurable directory).
* Some changes for portability to Cygwin, thanks to David A Bagley
<bagleyd@tux.org>; more portability issues remain.
* Various improvements to morse from OpenBSD.
* Some bugs fixed, some backlogged.
Version 2.15 (2003-12-18) Version 2.15 (2003-12-18)
============ ============

View File

@@ -50,12 +50,7 @@ may wish to provide a security-hardened system by giving each setgid
game its own group so bugs in one do not affect others. game its own group so bugs in one do not affect others.
You may wish to include auxiliary documentation for users, such as the You may wish to include auxiliary documentation for users, such as the
BSD Users' Supplementary Documents for trek and rogue AUTHORS and THANKS files and the year 2000 statement YEAR2000.
(trek/USD.doc/trek.me and rogue/USD.doc/rogue.me, or formatted
versions thereof), the AUTHORS and THANKS files, and the year 2000
statement YEAR2000. Note that the trek manpage contains a reference
to /usr/doc/trek, which should be updated to point to where you put
trek.me or a formatted version.
Assuming you distribute source for your package (I do not believe any Assuming you distribute source for your package (I do not believe any
of the games have licences requiring this), and separate your patches of the games have licences requiring this), and separate your patches

30
README
View File

@@ -21,8 +21,7 @@ The games are mostly not enhanced from the NetBSD versions, but many
bugs are fixed. bugs are fixed.
For installation instructions and details of prerequisites, see the For installation instructions and details of prerequisites, see the
file "INSTALL". Some games have "README.linux" files you may wish to file "INSTALL".
read.
The statement of year 2000 issues associated with bsd-games and The statement of year 2000 issues associated with bsd-games and
bsd-games-non-free is in the file "YEAR2000". bsd-games-non-free is in the file "YEAR2000".
@@ -50,6 +49,7 @@ caesar: reads fortunes from the game fortune, also some internet posts
canfield: curses-based solitaire canfield: curses-based solitaire
countmail: tell you how much new mail you have countmail: tell you how much new mail you have
cribbage: cribbage cribbage: cribbage
dab: dots and boxes
dm: dungeon master, regulates games playing dm: dungeon master, regulates games playing
factor: factor a number factor: factor a number
fish: go fish fish: go fish
@@ -103,6 +103,32 @@ with the workings of any particular program, whereas you will be if
you have been tracing and fixing a bug. The GCC info manual contains you have been tracing and fixing a bug. The GCC info manual contains
a discussion of how to produce good bug reports. a discussion of how to produce good bug reports.
Notes on specific games:
boggle: by default this game compiles with certain Linux improvements;
if you want the original BSD behaviour, remove -DNEW_STYLE from the
boggle_boggle_DEFS in boggle/boggle/Makefrag. Defining NEW_STYLE will
provide a more intuitive way of quitting or playing a new game after
time has run out.
dm: the "dungeon master", a program that allows you to control when
users can play games. (Note that this does not control any private
copies of games they may have.) I do not claim that this program is
actually useful, but it is included in bsd-games since it is in
NetBSD. Add -DLOG to the DEFS in dm/Makefrag if you want logging of
games playing (not regularly tested).
fortune: Another enhanced version is available from
<ftp://ibiblio.org/pub/Linux/games/amusements/fortune/fortune-mod-9708.tar.gz>.
unstr is not installed by default. If you want to install it,
uncomment the relevant lines (installation command and definition of
fortune_unstr_DIRS) in fortune/unstr/Makefrag before doing the top
level "make install".
hunt: may well be unreliable or broken in various ways. There is some
local configuration possible in hunt/Makeconfig but changing this may
well break things.
Joseph S. Myers Joseph S. Myers
jsm@polyomino.org.uk jsm@polyomino.org.uk

4
THANKS
View File

@@ -12,6 +12,10 @@ in this list.
For recent work (since 1.3), thanks to: For recent work (since 1.3), thanks to:
David A Bagley <bagleyd@tux.org>
For work towards portability to Cygwin.
Joey Hess <joeyh@debian.org> Joey Hess <joeyh@debian.org>
For the Debian patches, which covered what was needed to make the games For the Debian patches, which covered what was needed to make the games

2
TODO
View File

@@ -47,8 +47,6 @@ those. The issues listed there are not included in this list.
has some; Paul Janzen is adding FreeBSD changes to has some; Paul Janzen is adding FreeBSD changes to
OpenBSD, so they may reach me that way. OpenBSD, so they may reach me that way.
1998-09-04 - dm should not access the utmp file directly.
1998-09-11 - Move building of more files in which configuration 1998-09-11 - Move building of more files in which configuration
variables are substituted from the configure script into variables are substituted from the configure script into
the Makefiles. the Makefiles.

View File

@@ -1,4 +1,4 @@
/* $NetBSD: extern.h,v 1.9 1998/09/13 15:21:37 hubertf Exp $ */ /* $NetBSD: extern.h,v 1.10 2004/01/27 20:30:28 jsm Exp $ */
/* /*
* Copyright (c) 1997 Christos Zoulas. All rights reserved. * Copyright (c) 1997 Christos Zoulas. All rights reserved.
@@ -32,99 +32,99 @@
#include <string.h> #include <string.h>
/* crc.c */ /* crc.c */
void crc_start __P((void)); void crc_start(void);
unsigned long crc __P((const char *, int)); unsigned long crc(const char *, int);
/* done.c */ /* done.c */
int score __P((void)); int score(void);
void done __P((int)) __attribute__((__noreturn__)); void done(int) __attribute__((__noreturn__));
void die __P((int)); void die(int);
/* init.c */ /* init.c */
void init __P((void)); void init(void);
char *decr __P((int, int, int, int, int)); char *decr(int, int, int, int, int);
void linkdata __P((void)); void linkdata(void);
void trapdel __P((int)); void trapdel(int);
void startup __P((void)); void startup(void);
/* io.c */ /* io.c */
void getin __P((char **, char **)); void getin(char **, char **);
int yes __P((int, int, int)); int yes(int, int, int);
int yesm __P((int, int, int)); int yesm(int, int, int);
int next __P((void)); int next(void);
void rdata __P((void)); void rdata(void);
int rnum __P((void)); int rnum(void);
void rdesc __P((int)); void rdesc(int);
void rtrav __P((void)); void rtrav(void);
#ifdef DEBUG #ifdef DEBUG
void twrite __P((int)); void twrite(int);
#endif #endif
void rvoc __P((void)); void rvoc(void);
void rlocs __P((void)); void rlocs(void);
void rdflt __P((void)); void rdflt(void);
void rliq __P((void)); void rliq(void);
void rhints __P((void)); void rhints(void);
void rspeak __P((int)); void rspeak(int);
void mspeak __P((int)); void mspeak(int);
struct text; struct text;
void speak __P((const struct text *)); void speak(const struct text *);
void pspeak __P((int, int)); void pspeak(int, int);
/* save.c */ /* save.c */
int save __P((const char *)); int save(const char *);
int restore __P((const char *)); int restore(const char *);
/* subr.c */ /* subr.c */
int toting __P((int)); int toting(int);
int here __P((int)); int here(int);
int at __P((int)); int at(int);
int liq2 __P((int)); int liq2(int);
int liq __P((void)); int liq(void);
int liqloc __P((int)); int liqloc(int);
int bitset __P((int, int)); int bitset(int, int);
int forced __P((int)); int forced(int);
int dark __P((void)); int dark(void);
int pct __P((int)); int pct(int);
int fdwarf __P((void)); int fdwarf(void);
int march __P((void)); int march(void);
int mback __P((void)); int mback(void);
int specials __P((void)); int specials(void);
int trbridge __P((void)); int trbridge(void);
void badmove __P((void)); void badmove(void);
void bug __P((int)) __attribute__((__noreturn__)); void bug(int) __attribute__((__noreturn__));
void checkhints __P((void)); void checkhints(void);
int trsay __P((void)); int trsay(void);
int trtake __P((void)); int trtake(void);
int dropper __P((void)); int dropper(void);
int trdrop __P((void)); int trdrop(void);
int tropen __P((void)); int tropen(void);
int trkill __P((void)); int trkill(void);
int trtoss __P((void)); int trtoss(void);
int trfeed __P((void)); int trfeed(void);
int trfill __P((void)); int trfill(void);
void closing __P((void)); void closing(void);
void caveclose __P((void)); void caveclose(void);
/* vocab.c */ /* vocab.c */
void dstroy __P((int)); void dstroy(int);
void juggle __P((int)); void juggle(int);
void move __P((int, int)); void move(int, int);
int put __P((int, int, int)); int put(int, int, int);
void carry __P((int, int)); void carry(int, int);
void drop __P((int, int)); void drop(int, int);
int vocab __P((const char *, int, int)); int vocab(const char *, int, int);
/* These three used to be functions in vocab.c */ /* These three used to be functions in vocab.c */
#define copystr(src, dest) strcpy((dest), (src)) #define copystr(src, dest) strcpy((dest), (src))
#define weq(str1, str2) (!strncmp((str1), (str2), 5)) #define weq(str1, str2) (!strncmp((str1), (str2), 5))
#define length(str) (strlen((str)) + 1) #define length(str) (strlen((str)) + 1)
void prht __P((void)); void prht(void);
/* wizard.c */ /* wizard.c */
void datime __P((int *, int *)); void datime(int *, int *);
void poof __P((void)); void poof(void);
int Start __P((void)); int Start(void);
int wizard __P((void)); int wizard(void);
void ciao __P((void)); void ciao(void);
int ran __P((int)); int ran(int);

View File

@@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.17 2003/08/07 09:36:51 agc Exp $ */ /* $NetBSD: main.c,v 1.18 2004/01/27 20:30:28 jsm Exp $ */
/*- /*-
* Copyright (c) 1991, 1993 * Copyright (c) 1991, 1993
@@ -44,7 +44,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/2/93"; static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/2/93";
#else #else
__RCSID("$NetBSD: main.c,v 1.17 2003/08/07 09:36:51 agc Exp $"); __RCSID("$NetBSD: main.c,v 1.18 2004/01/27 20:30:28 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@@ -59,7 +59,7 @@ __RCSID("$NetBSD: main.c,v 1.17 2003/08/07 09:36:51 agc Exp $");
#include "hdr.h" #include "hdr.h"
#include "extern.h" #include "extern.h"
int main __P((int, char **)); int main(int, char **);
int int
main(argc, argv) main(argc, argv)

View File

@@ -1,6 +1,6 @@
# Makefrag - makefile fragment for arithmetic # Makefrag - makefile fragment for arithmetic
# #
# Copyright (c) 1997, 1998 Joseph Samuel Myers. # Copyright (c) 1997, 1998, 2004 Joseph Samuel Myers.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@@ -26,6 +26,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE. # SUCH DAMAGE.
arithmetic_DEFS := $(GETPROGNAME_DEFS)
arithmetic_DIRS := $(GAMESDIR) $(MAN6DIR) arithmetic_DIRS := $(GAMESDIR) $(MAN6DIR)
arithmetic_all: arithmetic/arithmetic arithmetic/arithmetic.6 arithmetic_all: arithmetic/arithmetic arithmetic/arithmetic.6

View File

@@ -1,4 +1,4 @@
/* $NetBSD: arithmetic.c,v 1.19 2003/08/07 09:36:52 agc Exp $ */ /* $NetBSD: arithmetic.c,v 1.20 2004/01/27 20:30:28 jsm Exp $ */
/* /*
* Copyright (c) 1989, 1993 * Copyright (c) 1989, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)arithmetic.c 8.1 (Berkeley) 5/31/93"; static char sccsid[] = "@(#)arithmetic.c 8.1 (Berkeley) 5/31/93";
#else #else
__RCSID("$NetBSD: arithmetic.c,v 1.19 2003/08/07 09:36:52 agc Exp $"); __RCSID("$NetBSD: arithmetic.c,v 1.20 2004/01/27 20:30:28 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@@ -84,14 +84,14 @@ __RCSID("$NetBSD: arithmetic.c,v 1.19 2003/08/07 09:36:52 agc Exp $");
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
int getrandom __P((int, int, int)); int getrandom(int, int, int);
void intr __P((int)) __attribute__((__noreturn__)); void intr(int) __attribute__((__noreturn__));
int main __P((int, char *[])); int main(int, char *[]);
int opnum __P((int)); int opnum(int);
void penalise __P((int, int, int)); void penalise(int, int, int);
int problem __P((void)); int problem(void);
void showstats __P((int)); void showstats(int);
void usage __P((void)) __attribute__((__noreturn__)); void usage(void) __attribute__((__noreturn__));
const char keylist[] = "+-x/"; const char keylist[] = "+-x/";
const char defaultkeys[] = "+-"; const char defaultkeys[] = "+-";
@@ -102,8 +102,6 @@ int nright, nwrong;
time_t qtime; time_t qtime;
#define NQUESTS 20 #define NQUESTS 20
extern char *__progname; /* from crt0.o */
/* /*
* Select keys from +-x/ to be asked addition, subtraction, multiplication, * Select keys from +-x/ to be asked addition, subtraction, multiplication,
* and division problems. More than one key may be given. The default is * and division problems. More than one key may be given. The default is
@@ -390,6 +388,6 @@ void
usage() usage()
{ {
(void)fprintf(stderr, "Usage: %s [-o +-x/] [-r range]\n", (void)fprintf(stderr, "Usage: %s [-o +-x/] [-r range]\n",
__progname); getprogname());
exit(1); exit(1);
} }

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: atc.6,v 1.19 2003/08/07 09:36:53 agc Exp $ .\" $NetBSD: atc.6,v 1.21 2004/01/01 16:31:37 wiz Exp $
.\" .\"
.\" Copyright (c) 1990, 1993 .\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved. .\" The Regents of the University of California. All rights reserved.
@@ -34,7 +34,7 @@
.\" .\"
.\" Copyright (c) 1986 Ed James. All rights reserved. .\" Copyright (c) 1986 Ed James. All rights reserved.
.\" .\"
.Dd May 31, 1993 .Dd January 1, 2004
.Dt ATC 6 .Dt ATC 6
.Os .Os
.Sh NAME .Sh NAME
@@ -112,7 +112,6 @@ Suspending a game is not permitted.
If you get a talk message, tough. If you get a talk message, tough.
When was the last time an Air Traffic Controller got called away to the phone? When was the last time an Air Traffic Controller got called away to the phone?
.Sh THE DISPLAY .Sh THE DISPLAY
.Pp
Depending on the terminal you run Depending on the terminal you run
.Nm .Nm
on, the screen will be divided into 4 areas. on, the screen will be divided into 4 areas.

View File

@@ -1,4 +1,4 @@
/* $NetBSD: extern.h,v 1.10 2003/08/07 09:36:53 agc Exp $ */ /* $NetBSD: extern.h,v 1.11 2004/01/27 20:30:28 jsm Exp $ */
/*- /*-
* Copyright (c) 1990, 1993 * Copyright (c) 1990, 1993
@@ -58,81 +58,81 @@ extern struct termios tty_start, tty_new;
extern DISPLACEMENT displacement[MAXDIR]; extern DISPLACEMENT displacement[MAXDIR];
int addplane __P((void)); int addplane(void);
void append __P((LIST *, PLANE *)); void append(LIST *, PLANE *);
void check_adir __P((int, int, int)); void check_adir(int, int, int);
void check_edge __P((int, int)); void check_edge(int, int);
void check_edir __P((int, int, int)); void check_edir(int, int, int);
void check_line __P((int, int, int, int)); void check_line(int, int, int, int);
void check_linepoint __P((int, int)); void check_linepoint(int, int);
void check_point __P((int, int)); void check_point(int, int);
int checkdefs __P((void)); int checkdefs(void);
int compar __P((const void *, const void *)); int compar(const void *, const void *);
void delete __P((LIST *, PLANE *)); void delete(LIST *, PLANE *);
int dir_deg __P((int)); int dir_deg(int);
int dir_no __P((char)); int dir_no(char);
void done_screen __P((void)); void done_screen(void);
void draw_all __P((void)); void draw_all(void);
void draw_line __P((WINDOW *, int, int, int, int, const char *)); void draw_line(WINDOW *, int, int, int, int, const char *);
void erase_all __P((void)); void erase_all(void);
int getAChar __P((void)); int getAChar(void);
int getcommand __P((void)); int getcommand(void);
int gettoken __P((void)); int gettoken(void);
void init_gr __P((void)); void init_gr(void);
void ioaddstr __P((int, const char *)); void ioaddstr(int, const char *);
void ioclrtobot __P((void)); void ioclrtobot(void);
void ioclrtoeol __P((int)); void ioclrtoeol(int);
void ioerror __P((int, int, const char *)); void ioerror(int, int, const char *);
void iomove __P((int)); void iomove(int);
int list_games __P((void)); int list_games(void);
int log_score __P((int)); int log_score(int);
void log_score_quit __P((int)) __attribute__((__noreturn__)); void log_score_quit(int) __attribute__((__noreturn__));
void loser __P((const PLANE *, const char *)) __attribute__((__noreturn__)); void loser(const PLANE *, const char *) __attribute__((__noreturn__));
int main __P((int, char *[])); int main(int, char *[]);
char name __P((const PLANE *)); char name(const PLANE *);
int next_plane __P((void)); int next_plane(void);
void noise __P((void)); void noise(void);
int number __P((char)); int number(char);
void open_score_file __P((void)); void open_score_file(void);
void planewin __P((void)); void planewin(void);
int pop __P((void)); int pop(void);
void push __P((int, int)); void push(int, int);
void quit __P((int)); void quit(int);
int read_file __P((const char *)); int read_file(const char *);
void redraw __P((void)); void redraw(void);
void rezero __P((void)); void rezero(void);
void setup_screen __P((const C_SCREEN *)); void setup_screen(const C_SCREEN *);
int too_close __P((const PLANE *p1, const PLANE *p2, int)); int too_close(const PLANE *p1, const PLANE *p2, int);
void update __P((int)); void update(int);
int yyerror __P((const char *)); int yyerror(const char *);
int yylex __P((void)); int yylex(void);
#ifndef YYEMPTY #ifndef YYEMPTY
int yyparse __P((void)); int yyparse(void);
#endif #endif
const char *Left __P((char)); const char *Left(char);
const char *Right __P((char)); const char *Right(char);
const char *airport __P((char)); const char *airport(char);
const char *beacon __P((char)); const char *beacon(char);
const char *benum __P((char)); const char *benum(char);
const char *circle __P((char)); const char *circle(char);
const char *climb __P((char)); const char *climb(char);
const char *command __P((const PLANE *)); const char *command(const PLANE *);
const char *default_game __P((void)); const char *default_game(void);
const char *delayb __P((char)); const char *delayb(char);
const char *descend __P((char)); const char *descend(char);
const char *ex_it __P((char)); const char *ex_it(char);
PLANE *findplane __P((int)); PLANE *findplane(int);
const char *ignore __P((char)); const char *ignore(char);
const char *left __P((char)); const char *left(char);
const char *mark __P((char)); const char *mark(char);
PLANE *newplane __P((void)); PLANE *newplane(void);
const char *okay_game __P((const char *)); const char *okay_game(const char *);
const char *rel_dir __P((char)); const char *rel_dir(char);
const char *right __P((char)); const char *right(char);
const char *setalt __P((char)); const char *setalt(char);
const char *setplane __P((char)); const char *setplane(char);
const char *setrelalt __P((char)); const char *setrelalt(char);
const char *timestr __P((int)); const char *timestr(int);
const char *to_dir __P((char)); const char *to_dir(char);
const char *turn __P((char)); const char *turn(char);
const char *unmark __P((char)); const char *unmark(char);

View File

@@ -1,4 +1,4 @@
/* $NetBSD: input.c,v 1.15 2003/08/07 09:36:54 agc Exp $ */ /* $NetBSD: input.c,v 1.16 2004/01/27 20:30:28 jsm Exp $ */
/*- /*-
* Copyright (c) 1990, 1993 * Copyright (c) 1990, 1993
@@ -46,7 +46,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)input.c 8.1 (Berkeley) 5/31/93"; static char sccsid[] = "@(#)input.c 8.1 (Berkeley) 5/31/93";
#else #else
__RCSID("$NetBSD: input.c,v 1.15 2003/08/07 09:36:54 agc Exp $"); __RCSID("$NetBSD: input.c,v 1.16 2004/01/27 20:30:28 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@@ -67,7 +67,7 @@ typedef struct {
int token; int token;
int to_state; int to_state;
const char *str; const char *str;
const char *(*func) __P((char)); const char *(*func)(char);
} RULE; } RULE;
typedef struct { typedef struct {
@@ -229,7 +229,7 @@ int
getcommand() getcommand()
{ {
int c, i, done; int c, i, done;
const char *s, *(*func) __P((char)); const char *s, *(*func)(char);
PLANE *pp; PLANE *pp;
rezero(); rezero();

View File

@@ -1,4 +1,4 @@
/* $NetBSD: backlocal.h,v 1.1 1997/10/10 08:59:35 lukem Exp $ */ /* $NetBSD: backlocal.h,v 1.2 2004/01/27 20:30:28 jsm Exp $ */
/*- /*-
* Copyright (c) 1997 The NetBSD Foundation, Inc. * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -36,13 +36,13 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
void dble __P((void)); void dble(void);
int dblgood __P((void)); int dblgood(void);
int eval __P((void)); int eval(void);
int freemen __P((int)); int freemen(int);
void movcmp __P((void)); void movcmp(void);
void move __P((int)); void move(int);
int movegood __P((void)); int movegood(void);
void pickmove __P((void)); void pickmove(void);
int trapped __P((int, int)); int trapped(int, int);
void trymove __P((int, int)); void trymove(int, int);

View File

@@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.18 2003/08/07 09:36:56 agc Exp $ */ /* $NetBSD: main.c,v 1.20 2004/02/08 22:23:50 jsm Exp $ */
/* /*
* Copyright (c) 1980, 1993 * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
#else #else
__RCSID("$NetBSD: main.c,v 1.18 2003/08/07 09:36:56 agc Exp $"); __RCSID("$NetBSD: main.c,v 1.20 2004/02/08 22:23:50 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */

View File

@@ -1,4 +1,4 @@
/* $NetBSD: move.c,v 1.7 2003/08/07 09:36:56 agc Exp $ */ /* $NetBSD: move.c,v 1.8 2004/01/27 20:30:28 jsm Exp $ */
/* /*
* Copyright (c) 1980, 1993 * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93"; static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93";
#else #else
__RCSID("$NetBSD: move.c,v 1.7 2003/08/07 09:36:56 agc Exp $"); __RCSID("$NetBSD: move.c,v 1.8 2004/01/27 20:30:28 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@@ -83,13 +83,13 @@ static int cg[5]; /* candidate finish position */
static int race; /* game reduced to a race */ static int race; /* game reduced to a race */
static int bcomp __P((struct BOARD *, struct BOARD *)); static int bcomp(struct BOARD *, struct BOARD *);
static struct BOARD *bsave __P((void)); static struct BOARD *bsave(void);
static void binsert __P((struct BOARD *)); static void binsert(struct BOARD *);
static void boardcopy __P((struct BOARD *)); static void boardcopy(struct BOARD *);
static void makefree __P((struct BOARD *)); static void makefree(struct BOARD *);
static void mvcheck __P((struct BOARD *, struct BOARD *)); static void mvcheck(struct BOARD *, struct BOARD *);
static struct BOARD *nextfree __P((void)); static struct BOARD *nextfree(void);
void void

View File

@@ -1,4 +1,4 @@
/* $NetBSD: back.h,v 1.13 2003/08/07 09:36:56 agc Exp $ */ /* $NetBSD: back.h,v 1.14 2004/01/27 20:30:28 jsm Exp $ */
/* /*
* Copyright (c) 1980, 1993 * Copyright (c) 1980, 1993
@@ -129,57 +129,57 @@ extern int curc; /* column position of cursor */
extern int begscr; /* 'beginning' of screen extern int begscr; /* 'beginning' of screen
(not including board) */ (not including board) */
int addbuf __P((int)); int addbuf(int);
void backone __P((int)); void backone(int);
void bsect __P((int, int, int, int)); void bsect(int, int, int, int);
void buflush __P((void)); void buflush(void);
int canhit __P((int, int)); int canhit(int, int);
int checkd __P((int)); int checkd(int);
int checkmove __P((int)); int checkmove(int);
void clear __P((void)); void clear(void);
void clend __P((void)); void clend(void);
void cline __P((void)); void cline(void);
int count __P((void)); int count(void);
void curmove __P((int, int)); void curmove(int, int);
int dotable __P((char, int)); int dotable(char, int);
void errexit __P((const char *)) __attribute__((__noreturn__)); void errexit(const char *) __attribute__((__noreturn__));
void fancyc __P((int)); void fancyc(int);
void fboard __P((void)); void fboard(void);
void fixcol __P((int, int, int, int, int)); void fixcol(int, int, int, int, int);
void fixpos __P((int, int, int, int, int)); void fixpos(int, int, int, int, int);
void fixtty __P((struct termios *)); void fixtty(struct termios *);
void getarg __P((char ***)); void getarg(char ***);
int getcaps __P((const char *)); int getcaps(const char *);
void getmove __P((void)); void getmove(void);
void getout __P((int)) __attribute__((__noreturn__)); void getout(int) __attribute__((__noreturn__));
void gwrite __P((void)); void gwrite(void);
void init __P((void)); void init(void);
int last __P((void)); int last(void);
int main __P((int, char *[])); int main(int, char *[]);
int makmove __P((int)); int makmove(int);
int movallow __P((void)); int movallow(void);
void movback __P((int)); void movback(int);
void moverr __P((int)); void moverr(int);
int movokay __P((int)); int movokay(int);
void newline __P((void)); void newline(void);
void newpos __P((void)); void newpos(void);
void nexturn __P((void)); void nexturn(void);
void norec __P((const char *)) __attribute__((__noreturn__)); void norec(const char *) __attribute__((__noreturn__));
void odds __P((int, int, int)); void odds(int, int, int);
void proll __P((void)); void proll(void);
int quit __P((void)); int quit(void);
int readc __P((void)); int readc(void);
void recover __P((const char *)); void recover(const char *);
void refresh __P((void)); void refresh(void);
void roll __P((void)); void roll(void);
int rsetbrd __P((void)); int rsetbrd(void);
void save __P((int)); void save(int);
int text __P((const char *const *)); int text(const char *const *);
void wrboard __P((void)); void wrboard(void);
void wrbsub __P((void)); void wrbsub(void);
void wrhit __P((int)); void wrhit(int);
void wrint __P((int)); void wrint(int);
void writec __P((char)); void writec(char);
void writel __P((const char *)); void writel(const char *);
void wrscore __P((void)); void wrscore(void);
int yorn __P((char)); int yorn(char);

View File

@@ -1,4 +1,4 @@
/* $NetBSD: data.c,v 1.6 2003/08/07 09:36:58 agc Exp $ */ /* $NetBSD: data.c,v 1.7 2004/01/01 15:59:09 jsm Exp $ */
/* /*
* Copyright (c) 1980, 1993 * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)data.c 8.1 (Berkeley) 5/31/93"; static char sccsid[] = "@(#)data.c 8.1 (Berkeley) 5/31/93";
#else #else
__RCSID("$NetBSD: data.c,v 1.6 2003/08/07 09:36:58 agc Exp $"); __RCSID("$NetBSD: data.c,v 1.7 2004/01/01 15:59:09 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */

View File

@@ -1,4 +1,4 @@
/* $NetBSD: teach.c,v 1.14 2003/08/07 09:36:58 agc Exp $ */ /* $NetBSD: teach.c,v 1.15 2004/02/08 22:23:50 jsm Exp $ */
/* /*
* Copyright (c) 1980, 1993 * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)teach.c 8.1 (Berkeley) 5/31/93"; static char sccsid[] = "@(#)teach.c 8.1 (Berkeley) 5/31/93";
#else #else
__RCSID("$NetBSD: teach.c,v 1.14 2003/08/07 09:36:58 agc Exp $"); __RCSID("$NetBSD: teach.c,v 1.15 2004/02/08 22:23:50 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */

View File

@@ -1,4 +1,4 @@
/* $NetBSD: tutor.h,v 1.7 2003/08/07 09:36:59 agc Exp $ */ /* $NetBSD: tutor.h,v 1.8 2004/01/27 20:30:28 jsm Exp $ */
/* /*
* Copyright (c) 1980, 1993 * Copyright (c) 1980, 1993
@@ -62,7 +62,7 @@ extern const char *const stragy[];
extern const struct situatn test[]; extern const struct situatn test[];
int brdeq __P((const int *, const int *)); int brdeq(const int *, const int *);
void clrest __P((void)); void clrest(void);
void leave __P((void)) __attribute__((__noreturn__)); void leave(void) __attribute__((__noreturn__));
void tutor __P((void)) __attribute__((__noreturn__)); void tutor(void) __attribute__((__noreturn__));

View File

@@ -1,4 +1,4 @@
/* $NetBSD: banner.c,v 1.11 2003/08/07 09:36:59 agc Exp $ */ /* $NetBSD: banner.c,v 1.12 2004/01/27 20:30:28 jsm Exp $ */
/* /*
* Copyright (c) 1980, 1993, 1994 * Copyright (c) 1980, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993, 1994\n\
#if 0 #if 0
static char sccsid[] = "@(#)banner.c 8.4 (Berkeley) 4/29/95"; static char sccsid[] = "@(#)banner.c 8.4 (Berkeley) 4/29/95";
#else #else
__RCSID("$NetBSD: banner.c,v 1.11 2003/08/07 09:36:59 agc Exp $"); __RCSID("$NetBSD: banner.c,v 1.12 2004/01/27 20:30:28 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@@ -1026,7 +1026,7 @@ int debug, i, j, linen, max, nchars, pc, term, trace, x, y;
int width = DWIDTH; /* -w option: scrunch letters to 80 columns */ int width = DWIDTH; /* -w option: scrunch letters to 80 columns */
int main __P((int, char *[])); int main(int, char *[]);
int int
main(argc, argv) main(argc, argv)

View File

@@ -1,4 +1,4 @@
/* $NetBSD: battlestar.c,v 1.13 2003/08/07 09:37:00 agc Exp $ */ /* $NetBSD: battlestar.c,v 1.14 2004/01/27 20:30:29 jsm Exp $ */
/* /*
* Copyright (c) 1983, 1993 * Copyright (c) 1983, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)battlestar.c 8.2 (Berkeley) 4/28/95"; static char sccsid[] = "@(#)battlestar.c 8.2 (Berkeley) 4/28/95";
#else #else
__RCSID("$NetBSD: battlestar.c,v 1.13 2003/08/07 09:37:00 agc Exp $"); __RCSID("$NetBSD: battlestar.c,v 1.14 2004/01/27 20:30:29 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@@ -52,7 +52,7 @@ __RCSID("$NetBSD: battlestar.c,v 1.13 2003/08/07 09:37:00 agc Exp $");
#include "extern.h" #include "extern.h"
int main __P((int, char *[])); int main(int, char *[]);
int int
main(argc, argv) main(argc, argv)

View File

@@ -1,4 +1,4 @@
/* $NetBSD: extern.h,v 1.29 2003/08/07 09:37:02 agc Exp $ */ /* $NetBSD: extern.h,v 1.30 2004/01/27 20:30:29 jsm Exp $ */
/* /*
* Copyright (c) 1983, 1993 * Copyright (c) 1983, 1993
@@ -328,60 +328,60 @@ extern const struct objs nightobjs[];
#define DEFAULT_SAVE_FILE ".Bstar" #define DEFAULT_SAVE_FILE ".Bstar"
void bury __P((void)); void bury(void);
int card __P((const char *, int)); int card(const char *, int);
void chime __P((void)); void chime(void);
void convert __P((int)); void convert(int);
void crash __P((void)); void crash(void);
int cypher __P((void)); int cypher(void);
void die __P((void)) __attribute__((__noreturn__)); void die(void) __attribute__((__noreturn__));
void diesig __P((int)) __attribute__((__noreturn__)); void diesig(int) __attribute__((__noreturn__));
void dig __P((void)); void dig(void);
void dooropen __P((void)); void dooropen(void);
int draw __P((void)); int draw(void);
void drink __P((void)); void drink(void);
int drive __P((void)); int drive(void);
int drop __P((const char *)); int drop(const char *);
int eat __P((void)); int eat(void);
int fight __P((int, int)); int fight(int, int);
int follow __P((void)); int follow(void);
char *getcom __P((char *, int, const char *, const char *)); char *getcom(char *, int, const char *, const char *);
char *getword __P((char *, char *, int)); char *getword(char *, char *, int);
int give __P((void)); int give(void);
void initialize __P((const char *)); void initialize(const char *);
int jump __P((void)); int jump(void);
void kiss __P((void)); void kiss(void);
int land __P((void)); int land(void);
int launch __P((void)); int launch(void);
void light __P((void)); void light(void);
void live __P((void)) __attribute__((__noreturn__)); void live(void) __attribute__((__noreturn__));
void love __P((void)); void love(void);
int moveplayer __P((int, int)); int moveplayer(int, int);
void murder __P((void)); void murder(void);
void news __P((void)); void news(void);
void newway __P((int)); void newway(int);
void open_score_file __P((void)); void open_score_file(void);
void parse __P((void)); void parse(void);
void post __P((char)); void post(char);
void printobjs __P((void)); void printobjs(void);
int put __P((void)); int put(void);
int puton __P((void)); int puton(void);
const char *rate __P((void)); const char *rate(void);
void ravage __P((void)); void ravage(void);
void restore __P((const char *)); void restore(const char *);
int ride __P((void)); int ride(void);
void save __P((const char *)); void save(const char *);
char *save_file_name __P((const char *, size_t)); char *save_file_name(const char *, size_t);
int shoot __P((void)); int shoot(void);
int take __P((unsigned int[])); int take(unsigned int[]);
int takeoff __P((void)); int takeoff(void);
int throw __P((const char *)); int throw(const char *);
const char *truedirec __P((int, char)); const char *truedirec(int, char);
int ucard __P((const unsigned int *)); int ucard(const unsigned int *);
int use __P((void)); int use(void);
int visual __P((void)); int visual(void);
int wearit __P((void)); int wearit(void);
void whichway __P((struct room)); void whichway(struct room);
void wordinit __P((void)); void wordinit(void);
void writedes __P((void)); void writedes(void);
int zzz __P((void)); int zzz(void);

View File

@@ -1,4 +1,4 @@
/* $NetBSD: fly.c,v 1.11 2003/08/07 09:37:02 agc Exp $ */ /* $NetBSD: fly.c,v 1.12 2004/01/27 20:30:29 jsm Exp $ */
/* /*
* Copyright (c) 1983, 1993 * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)fly.c 8.2 (Berkeley) 4/28/95"; static char sccsid[] = "@(#)fly.c 8.2 (Berkeley) 4/28/95";
#else #else
__RCSID("$NetBSD: fly.c,v 1.11 2003/08/07 09:37:02 agc Exp $"); __RCSID("$NetBSD: fly.c,v 1.12 2004/01/27 20:30:29 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@@ -52,13 +52,13 @@ int ourclock = 120; /* time for all the flights in the game */
static char cross = 0; static char cross = 0;
static sig_t oldsig; static sig_t oldsig;
static void blast __P((void)); static void blast(void);
static void endfly __P((void)); static void endfly(void);
static void moveenemy __P((int)); static void moveenemy(int);
static void notarget __P((void)); static void notarget(void);
static void screen __P((void)); static void screen(void);
static void succumb __P((int)); static void succumb(int);
static void target __P((void)); static void target(void);
static void static void
succumb(dummy) succumb(dummy)

View File

@@ -1,4 +1,4 @@
/* $NetBSD: init.c,v 1.13 2003/08/07 09:37:02 agc Exp $ */ /* $NetBSD: init.c,v 1.14 2004/01/27 20:30:29 jsm Exp $ */
/* /*
* Copyright (c) 1983, 1993 * Copyright (c) 1983, 1993
@@ -34,15 +34,15 @@
#if 0 #if 0
static char sccsid[] = "@(#)init.c 8.4 (Berkeley) 4/30/95"; static char sccsid[] = "@(#)init.c 8.4 (Berkeley) 4/30/95";
#else #else
__RCSID("$NetBSD: init.c,v 1.13 2003/08/07 09:37:02 agc Exp $"); __RCSID("$NetBSD: init.c,v 1.14 2004/01/27 20:30:29 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
#include "extern.h" #include "extern.h"
static int checkout __P((const char *)); static int checkout(const char *);
static const char *getutmp __P((void)); static const char *getutmp(void);
static int wizard __P((const char *)); static int wizard(const char *);
void void
initialize(filename) initialize(filename)

View File

@@ -1,4 +1,4 @@
/* $NetBSD: parse.c,v 1.13 2003/08/07 09:37:03 agc Exp $ */ /* $NetBSD: parse.c,v 1.14 2004/01/27 20:30:29 jsm Exp $ */
/* /*
* Copyright (c) 1983, 1993 * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)parse.c 8.2 (Berkeley) 4/28/95"; static char sccsid[] = "@(#)parse.c 8.2 (Berkeley) 4/28/95";
#else #else
__RCSID("$NetBSD: parse.c,v 1.13 2003/08/07 09:37:03 agc Exp $"); __RCSID("$NetBSD: parse.c,v 1.14 2004/01/27 20:30:29 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@@ -44,9 +44,9 @@ __RCSID("$NetBSD: parse.c,v 1.13 2003/08/07 09:37:03 agc Exp $");
#define HASHMUL 81 #define HASHMUL 81
#define HASHMASK (HASHSIZE - 1) #define HASHMASK (HASHSIZE - 1)
static int hash __P((const char *)); static int hash(const char *);
static void install __P((struct wlist *)); static void install(struct wlist *);
static struct wlist *lookup __P((const char *)); static struct wlist *lookup(const char *);
static struct wlist *hashtab[HASHSIZE]; static struct wlist *hashtab[HASHSIZE];

View File

@@ -1,4 +1,4 @@
/* $NetBSD: bcd.c,v 1.12 2003/08/07 09:37:04 agc Exp $ */ /* $NetBSD: bcd.c,v 1.13 2004/01/27 20:30:29 jsm Exp $ */
/* /*
* Copyright (c) 1989, 1993 * Copyright (c) 1989, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)bcd.c 8.2 (Berkeley) 3/20/94"; static char sccsid[] = "@(#)bcd.c 8.2 (Berkeley) 3/20/94";
#else #else
__RCSID("$NetBSD: bcd.c,v 1.12 2003/08/07 09:37:04 agc Exp $"); __RCSID("$NetBSD: bcd.c,v 1.13 2004/01/27 20:30:29 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@@ -124,8 +124,8 @@ const u_short holes[256] = {
*/ */
#define bit(w,i) ((w)&(1<<(i))) #define bit(w,i) ((w)&(1<<(i)))
int main __P((int, char *[])); int main(int, char *[]);
void printcard __P((unsigned char *)); void printcard(unsigned char *);
int int
main(argc, argv) main(argc, argv)

View File

@@ -1,36 +0,0 @@
README.linux for boggle
=======================
I grabbed this game from comp.sources.games/volume4. This game is now
merged with the NetBSD version.
If you wish to use a different dictionary, you can set
boggle_mkdict_DICTSRC in mkdict/Makefrag.
By default, this game compiles with certain Linux improvements; if you
want the original BSD behaviour, remove -DNEW_STYLE from the
boggle_boggle_DEFS in boggle/Makefrag. Defining NEW_STYLE will
provide a more intuitive way of quitting or playing a new game after
time has run out.
NOTE: You may wish to remove -DNEW_STYLE if you plan on using the post
game word lookup feature. Press <ESC>, type a word, and bog will
display where it is located. If NEW_STYLE is defined, it might be
easy to accidently start typing the word with out pressing <ESC>
first. This would start a new game, and you would never be able to
know where that word was located. :(
Thanks to Andrew Kuchling. (See ../Credits for his email address.)
Curt Olson
curt@sledge.mn.org
Boggle is under the BSD licence, thanks to Paul Janzen for checking
this with the original author.
Local Variables:
mode: text
End:

View File

@@ -1,4 +1,4 @@
/* $NetBSD: bog.c,v 1.17 2003/08/07 09:37:05 agc Exp $ */ /* $NetBSD: bog.c,v 1.18 2004/01/27 20:30:29 jsm Exp $ */
/*- /*-
* Copyright (c) 1993 * Copyright (c) 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)bog.c 8.2 (Berkeley) 5/4/95"; static char sccsid[] = "@(#)bog.c 8.2 (Berkeley) 5/4/95";
#else #else
__RCSID("$NetBSD: bog.c,v 1.17 2003/08/07 09:37:05 agc Exp $"); __RCSID("$NetBSD: bog.c,v 1.18 2004/01/27 20:30:29 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@@ -57,8 +57,8 @@ __RCSID("$NetBSD: bog.c,v 1.17 2003/08/07 09:37:05 agc Exp $");
#include "bog.h" #include "bog.h"
#include "extern.h" #include "extern.h"
static int compar __P((const void *, const void *)); static int compar(const void *, const void *);
int main __P((int, char *[])); int main(int, char *[]);
struct dictindex dictindex[26]; struct dictindex dictindex[26];

View File

@@ -1,4 +1,4 @@
/* $NetBSD: extern.h,v 1.7 2003/08/07 09:37:05 agc Exp $ */ /* $NetBSD: extern.h,v 1.8 2004/01/27 20:30:29 jsm Exp $ */
/*- /*-
* Copyright (c) 1993 * Copyright (c) 1993
@@ -33,39 +33,39 @@
#include <time.h> #include <time.h>
void addword __P((const char *)); void addword(const char *);
void badword __P((void)); void badword(void);
char *batchword __P((FILE *)); char *batchword(FILE *);
void checkdict __P((void)); void checkdict(void);
int checkword __P((const char *, int, int *)); int checkword(const char *, int, int *);
void cleanup __P((void)); void cleanup(void);
void delay __P((int)); void delay(int);
long dictseek __P((FILE *, long, int)); long dictseek(FILE *, long, int);
void findword __P((void)); void findword(void);
void flushin __P((FILE *)); void flushin(FILE *);
char *getline __P((char *)); char *getline(char *);
void getword __P((char *)); void getword(char *);
int help __P((void)); int help(void);
int inputch __P((void)); int inputch(void);
int loaddict __P((FILE *)); int loaddict(FILE *);
int loadindex __P((const char *)); int loadindex(const char *);
void newgame __P((const char *)); void newgame(const char *);
char *nextword __P((FILE *)); char *nextword(FILE *);
FILE *opendict __P((const char *)); FILE *opendict(const char *);
void playgame __P((void)); void playgame(void);
void prompt __P((const char *)); void prompt(const char *);
void prtable __P((const char *const [], void prtable(const char *const [],
int, int, int, void (*)(const char *const [], int), int (*)(const char *const [], int))); int, int, int, void (*)(const char *const [], int), int (*)(const char *const [], int));
void putstr __P((const char *)); void putstr(const char *);
void redraw __P((void)); void redraw(void);
void results __P((void)); void results(void);
int setup __P((int, time_t)); int setup(int, time_t);
void showboard __P((const char *)); void showboard(const char *);
void showstr __P((const char *, int)); void showstr(const char *, int);
void showword __P((int)); void showword(int);
void starttime __P((void)); void starttime(void);
void startwords __P((void)); void startwords(void);
void stoptime __P((void)); void stoptime(void);
int timerch __P((void)); int timerch(void);
void usage __P((void)) __attribute__((__noreturn__)); void usage(void) __attribute__((__noreturn__));
int validword __P((const char *)); int validword(const char *);

View File

@@ -1,4 +1,4 @@
/* $NetBSD: mach.c,v 1.12 2003/08/07 09:37:05 agc Exp $ */ /* $NetBSD: mach.c,v 1.13 2004/01/27 20:30:29 jsm Exp $ */
/*- /*-
* Copyright (c) 1993 * Copyright (c) 1993
@@ -37,7 +37,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)mach.c 8.1 (Berkeley) 6/11/93"; static char sccsid[] = "@(#)mach.c 8.1 (Berkeley) 6/11/93";
#else #else
__RCSID("$NetBSD: mach.c,v 1.12 2003/08/07 09:37:05 agc Exp $"); __RCSID("$NetBSD: mach.c,v 1.13 2004/01/27 20:30:29 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@@ -73,14 +73,14 @@ extern int usedbits, wordpath[];
extern time_t start_t; extern time_t start_t;
extern int debug; extern int debug;
static void cont_catcher __P((int)); static void cont_catcher(int);
static int prwidth __P((const char *const [], int)); static int prwidth(const char *const [], int);
static void prword __P((const char *const [], int)); static void prword(const char *const [], int);
static void stop_catcher __P((int)); static void stop_catcher(int);
static void tty_cleanup __P((void)); static void tty_cleanup(void);
static int tty_setup __P((void)); static int tty_setup(void);
static void tty_showboard __P((const char *)); static void tty_showboard(const char *);
static void winch_catcher __P((int)); static void winch_catcher(int);
/* /*
* Do system dependent initialization * Do system dependent initialization

View File

@@ -1,4 +1,4 @@
/* $NetBSD: prtable.c,v 1.7 2003/08/07 09:37:05 agc Exp $ */ /* $NetBSD: prtable.c,v 1.8 2004/01/27 20:30:29 jsm Exp $ */
/*- /*-
* Copyright (c) 1993 * Copyright (c) 1993
@@ -36,7 +36,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: prtable.c,v 1.7 2003/08/07 09:37:05 agc Exp $"); __RCSID("$NetBSD: prtable.c,v 1.8 2004/01/27 20:30:29 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include <curses.h> #include <curses.h>
@@ -45,7 +45,7 @@ __RCSID("$NetBSD: prtable.c,v 1.7 2003/08/07 09:37:05 agc Exp $");
#define NCOLS 5 #define NCOLS 5
static int get_maxlen __P((const char *const [], int, int (*)(const char *const *, int))); static int get_maxlen(const char *const [], int, int (*)(const char *const *, int));
/* /*
* Routine to print a table * Routine to print a table
@@ -66,8 +66,8 @@ void
prtable(base, num, d_cols, width, prentry, length) prtable(base, num, d_cols, width, prentry, length)
const char *const base[]; const char *const base[];
int num, d_cols, width; int num, d_cols, width;
void (*prentry) __P((const char *const [], int)); void (*prentry)(const char *const [], int);
int (*length) __P((const char *const [], int)); int (*length)(const char *const [], int);
{ {
int c, j; int c, j;
int a, b, cols, loc, maxlen, nrows, z; int a, b, cols, loc, maxlen, nrows, z;
@@ -117,7 +117,7 @@ static int
get_maxlen(base, num, length) get_maxlen(base, num, length)
const char *const base[]; const char *const base[];
int num; int num;
int (*length) __P((const char *const *, int)); int (*length)(const char *const *, int);
{ {
int i, len, max; int i, len, max;

View File

@@ -1,4 +1,4 @@
/* $NetBSD: timer.c,v 1.8 2003/08/07 09:37:06 agc Exp $ */ /* $NetBSD: timer.c,v 1.9 2004/01/27 20:30:29 jsm Exp $ */
/*- /*-
* Copyright (c) 1993 * Copyright (c) 1993
@@ -37,7 +37,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)timer.c 8.2 (Berkeley) 2/22/94"; static char sccsid[] = "@(#)timer.c 8.2 (Berkeley) 2/22/94";
#else #else
__RCSID("$NetBSD: timer.c,v 1.8 2003/08/07 09:37:06 agc Exp $"); __RCSID("$NetBSD: timer.c,v 1.9 2004/01/27 20:30:29 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@@ -54,7 +54,7 @@ __RCSID("$NetBSD: timer.c,v 1.8 2003/08/07 09:37:06 agc Exp $");
#include "bog.h" #include "bog.h"
#include "extern.h" #include "extern.h"
static int waitch __P((int)); static int waitch(int);
extern int tlimit; extern int tlimit;
extern time_t start_t; extern time_t start_t;

View File

@@ -1,17 +1,17 @@
Begin4 Begin4
Title: bsd-games Title: bsd-games
Version: 2.15 Version: 2.16
Entered-date: 2003-12-18 Entered-date: 2004-02-13
Description: Port of most of the games from NetBSD-current. Games Description: Port of most of the games from NetBSD-current. Games
included: adventure arithmetic atc backgammon banner battlestar included: adventure arithmetic atc backgammon banner battlestar
bcd boggle caesar canfield countmail cribbage dm factor fish fortune bcd boggle caesar canfield countmail cribbage dab dm factor fish
gomoku hack hangman hunt mille monop morse number phantasia pig pom fortune gomoku hack hangman hunt mille monop morse number phantasia
ppt primes quiz rain random robots sail snake tetris trek wargames pig pom ppt primes quiz rain random robots sail snake tetris trek
worm worms wtf wump. wargames worm worms wtf wump.
Keywords: games, NetBSD Keywords: games, NetBSD
Maintained-by: jsm@polyomino.org.uk (Joseph S. Myers) Maintained-by: jsm@polyomino.org.uk (Joseph S. Myers)
Primary-site: ibiblio.org /pub/Linux/games Primary-site: ibiblio.org /pub/Linux/games
bsd-games-2.15.tar.gz bsd-games-2.16.tar.gz
Alternate-site: tsx-11.mit.edu /pub/linux/sources/usr.games Alternate-site: tsx-11.mit.edu /pub/linux/sources/usr.games
Original-site: ftp.netbsd.org /pub/NetBSD/NetBSD-current/tar_files/src Original-site: ftp.netbsd.org /pub/NetBSD/NetBSD-current/tar_files/src
games.tar.gz games.tar.gz

View File

@@ -1,4 +1,4 @@
/* $NetBSD: caesar.c,v 1.12 2003/08/07 09:37:07 agc Exp $ */ /* $NetBSD: caesar.c,v 1.14 2004/01/27 20:30:29 jsm Exp $ */
/* /*
* Copyright (c) 1989, 1993 * Copyright (c) 1989, 1993
@@ -47,7 +47,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)caesar.c 8.1 (Berkeley) 5/31/93"; static char sccsid[] = "@(#)caesar.c 8.1 (Berkeley) 5/31/93";
#else #else
__RCSID("$NetBSD: caesar.c,v 1.12 2003/08/07 09:37:07 agc Exp $"); __RCSID("$NetBSD: caesar.c,v 1.14 2004/01/27 20:30:29 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@@ -76,8 +76,8 @@ double stdf[26] = {
}; };
int main __P((int, char *[])); int main(int, char *[]);
void printit __P((const char *)) __attribute__((__noreturn__)); void printit(const char *) __attribute__((__noreturn__));
int int
main(argc, argv) main(argc, argv)

View File

@@ -1,4 +1,4 @@
/* $NetBSD: canfield.c,v 1.18 2003/08/07 09:37:07 agc Exp $ */ /* $NetBSD: canfield.c,v 1.19 2004/01/27 20:30:29 jsm Exp $ */
/* /*
* Copyright (c) 1980, 1993 * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)canfield.c 8.1 (Berkeley) 5/31/93"; static char sccsid[] = "@(#)canfield.c 8.1 (Berkeley) 5/31/93";
#else #else
__RCSID("$NetBSD: canfield.c,v 1.18 2003/08/07 09:37:07 agc Exp $"); __RCSID("$NetBSD: canfield.c,v 1.19 2004/01/27 20:30:29 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@@ -198,53 +198,53 @@ bool startedgame = FALSE, infullgame = FALSE;
time_t acctstart; time_t acctstart;
int dbfd = -1; int dbfd = -1;
void askquit __P((int)); void askquit(int);
void cleanup __P((int)) __attribute__((__noreturn__)); void cleanup(int) __attribute__((__noreturn__));
void cleanupboard __P((void)); void cleanupboard(void);
void clearabovemovebox __P((void)); void clearabovemovebox(void);
void clearbelowmovebox __P((void)); void clearbelowmovebox(void);
void clearmsg __P((void)); void clearmsg(void);
void clearstat __P((void)); void clearstat(void);
void destinerror __P((void)); void destinerror(void);
bool diffcolor __P((const struct cardtype *, const struct cardtype *)); bool diffcolor(const struct cardtype *, const struct cardtype *);
void dumberror __P((void)); void dumberror(void);
bool finish __P((void)); bool finish(void);
void fndbase __P((struct cardtype **, int, int)); void fndbase(struct cardtype **, int, int);
void getcmd __P((int, int, const char *)); void getcmd(int, int, const char *);
void initall __P((void)); void initall(void);
void initdeck __P((struct cardtype *[])); void initdeck(struct cardtype *[]);
void initgame __P((void)); void initgame(void);
void instruct __P((void)); void instruct(void);
int main __P((void)); int main(void);
void makeboard __P((void)); void makeboard(void);
void movebox __P((void)); void movebox(void);
void movecard __P((void)); void movecard(void);
void movetofound __P((struct cardtype **, int)); void movetofound(struct cardtype **, int);
void movetotalon __P((void)); void movetotalon(void);
bool notempty __P((const struct cardtype *)); bool notempty(const struct cardtype *);
void printbottombettingbox __P((void)); void printbottombettingbox(void);
void printbottominstructions __P((void)); void printbottominstructions(void);
void printcard __P((int, int, const struct cardtype *)); void printcard(int, int, const struct cardtype *);
void printrank __P((int, int, const struct cardtype *, bool)); void printrank(int, int, const struct cardtype *, bool);
void printtopbettingbox __P((void)); void printtopbettingbox(void);
void printtopinstructions __P((void)); void printtopinstructions(void);
bool rankhigher __P((const struct cardtype *, int)); bool rankhigher(const struct cardtype *, int);
bool ranklower __P((const struct cardtype *, const struct cardtype *)); bool ranklower(const struct cardtype *, const struct cardtype *);
void removecard __P((int, int)); void removecard(int, int);
int samesuit __P((const struct cardtype *, int)); int samesuit(const struct cardtype *, int);
void showcards __P((void)); void showcards(void);
void showstat __P((void)); void showstat(void);
void shuffle __P((struct cardtype *[])); void shuffle(struct cardtype *[]);
void simpletableau __P((struct cardtype **, int)); void simpletableau(struct cardtype **, int);
void startgame __P((void)); void startgame(void);
void suspend __P((void)); void suspend(void);
bool tabok __P((const struct cardtype *, int)); bool tabok(const struct cardtype *, int);
void tabprint __P((int, int)); void tabprint(int, int);
void tabtotab __P((int, int)); void tabtotab(int, int);
void transit __P((struct cardtype **, struct cardtype **)); void transit(struct cardtype **, struct cardtype **);
void updatebettinginfo __P((void)); void updatebettinginfo(void);
void usedstock __P((void)); void usedstock(void);
void usedtalon __P((void)); void usedtalon(void);
/* /*
* The following procedures print the board onto the screen using the * The following procedures print the board onto the screen using the

View File

@@ -1,4 +1,4 @@
/* $NetBSD: cfscores.c,v 1.11 2003/08/07 09:37:08 agc Exp $ */ /* $NetBSD: cfscores.c,v 1.12 2004/01/27 20:30:29 jsm Exp $ */
/* /*
* Copyright (c) 1983, 1993 * Copyright (c) 1983, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)cfscores.c 8.1 (Berkeley) 5/31/93"; static char sccsid[] = "@(#)cfscores.c 8.1 (Berkeley) 5/31/93";
#else #else
__RCSID("$NetBSD: cfscores.c,v 1.11 2003/08/07 09:37:08 agc Exp $"); __RCSID("$NetBSD: cfscores.c,v 1.12 2004/01/27 20:30:29 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@@ -66,8 +66,8 @@ struct betinfo {
int dbfd; int dbfd;
int main __P((int, char *[])); int main(int, char *[]);
void printuser __P((const struct passwd *, int)); void printuser(const struct passwd *, int);
int int
main(argc, argv) main(argc, argv)

86
configure vendored
View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# configure - home-grown configuration script for bsd-games. # configure - home-grown configuration script for bsd-games.
# #
# Copyright (c) 1997, 1998, 1999, 2000, 2003 Joseph Samuel Myers. # Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004 Joseph Samuel Myers.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@@ -56,10 +56,10 @@ ask () {
read input read input
fi fi
case "$input" in case "$input" in
'') ('')
input="$default" input="$default"
;; ;;
*) (*)
;; ;;
esac esac
eval $query_var=\"\$input\" eval $query_var=\"\$input\"
@@ -73,13 +73,13 @@ ask_yn () {
ask "$1" $2 $3 ask "$1" $2 $3
eval answer=\$$2 eval answer=\$$2
case "$answer" in case "$answer" in
[yY]*) ([yY]*)
answer=y answer=y
;; ;;
[nN]*) ([nN]*)
answer=n answer=n
;; ;;
*) (*)
answer= answer=
echo "Please answer y or n" echo "Please answer y or n"
;; ;;
@@ -242,6 +242,13 @@ else
subst_vars="$subst_vars man5dir" subst_vars="$subst_vars man5dir"
fi fi
if building_in trek || building_in rogue; then
ask "Directory for miscellaneous documentation" docdir /usr/share/doc/bsd-games
else
docdir=
subst_vars="$subst_vars docdir"
fi
# The paths for data are as per the FHS. If a future version removes the # The paths for data are as per the FHS. If a future version removes the
# games ghettoes of /usr/games, /var/games, etc., then a subdirectory for # games ghettoes of /usr/games, /var/games, etc., then a subdirectory for
# this package (/usr/share/bsdgames, /var/state/bsdgames, etc.) would be # this package (/usr/share/bsdgames, /var/state/bsdgames, etc.) would be
@@ -289,12 +296,12 @@ use_dot_so=
while test x$use_dot_so = x; do while test x$use_dot_so = x; do
ask "Use .so or symlinks for manpages" use_dot_so .so ask "Use .so or symlinks for manpages" use_dot_so .so
case "$use_dot_so" in case "$use_dot_so" in
.so) (.so)
;; ;;
syml*) (syml*)
use_dot_so=symlinks use_dot_so=symlinks
;; ;;
*) (*)
use_dot_so= use_dot_so=
echo "Please answer \`.so\' or \`symlinks\'" echo "Please answer \`.so\' or \`symlinks\'"
;; ;;
@@ -317,13 +324,19 @@ subst_vars="$subst_vars install_script"
echo echo
echo "It is presumed in some places by the Makefiles that the compiler" echo "It is presumed in some places by the Makefiles that the compiler"
echo "will be some form of gcc." echo "will be some form of gcc."
ask "Compiler" cc gcc ask "C compiler" cc gcc
if building_in dab; then
ask "C++ compiler" cxx g++
fi
ask "Optimize flags" optimize_flags "-g -O2" ask "Optimize flags" optimize_flags "-g -O2"
echo echo
echo "The default warning flags should give a compile with few warnings." echo "The default warning flags should give a compile with few warnings."
# -Wbad-function-cast and -Wshadow give lots of warnings that are basically # -Wbad-function-cast and -Wshadow give lots of warnings that are basically
# harmless. # harmless.
ask "Compiler warning flags" warning_flags "-Wall -W -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-align -Wcast-qual -Wwrite-strings" ask "C compiler warning flags" warning_flags "-Wall -W -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-align -Wcast-qual -Wwrite-strings"
if building_in dab; then
ask "C++ compiler warning flags" cxx_warning_flags "-Wall -W -Wpointer-arith -Wcast-align -Wcast-qual -Wwrite-strings"
fi
echo echo
echo "You probably want the default here, or could use -lncurses_g for" echo "You probably want the default here, or could use -lncurses_g for"
echo "debugging ncurses. Use -lcurses -ltermcap if you want to try that," echo "debugging ncurses. Use -lcurses -ltermcap if you want to try that,"
@@ -409,6 +422,29 @@ main(void)
} }
EOF EOF
check_func sig_t <<EOF
#include <signal.h>
sig_t s;
int
main(void)
{
return 0;
}
EOF
check_func getprogname <<EOF
#include <stdlib.h>
int
main(void)
{
const char *n = getprogname();
return 0;
}
EOF
echo "#endif /* !defined(LINUX_BSD_GAMES_H) */" >>include/bsd-games.h echo "#endif /* !defined(LINUX_BSD_GAMES_H) */" >>include/bsd-games.h
@@ -630,7 +666,25 @@ EOF
for dir in $make_dirs; do for dir in $make_dirs; do
udir=$(slashdot_to_under $dir) udir=$(slashdot_to_under $dir)
eval clean_$udir= eval clean_$udir=
cat >>GNUmakefile <<EOF if [ $dir = dab ]; then
cat >>GNUmakefile <<EOF
include $dir/Makefrag
$dir/%.o: $dir/%.cc
\$(CXX) \$(CXXFLAGS) \$(${udir}_CXXFLAGS) \$(${udir}_DEFS) \$(BASE_INCS) -I$dir \$(${udir}_INCS) -c \$< -o \$@
$dir/%.ii: $dir/%.cc
\$(CXX) \$(CXXFLAGS) \$(${udir}_CXXFLAGS) \$(${udir}_DEFS) \$(BASE_INCS) -I$dir \$(${udir}_INCS) -E \$< -o \$@
$dir/%.s: $dir/%.cc
\$(CXX) \$(CXXFLAGS) \$(${udir}_CXXFLAGS) \$(${udir}_DEFS) \$(BASE_INCS) -I$dir \$(${udir}_INCS) -S -fverbose-asm \$< -o \$@
$dir/%.d: $dir/%.cc
./mkdep \$< \$@ \$(CXX) \$(CXXFLAGS) \$(${udir}_CXXFLAGS) \$(${udir}_DEFS) \$(BASE_INCS) -I$dir \$(${udir}_INCS)
EOF
else
cat >>GNUmakefile <<EOF
include $dir/Makefrag include $dir/Makefrag
$dir/%.o: $dir/%.c $dir/%.o: $dir/%.c
@@ -646,6 +700,7 @@ $dir/%.d: $dir/%.c
./mkdep \$< \$@ \$(CC) \$(CFLAGS) \$(${udir}_CFLAGS) \$(${udir}_DEFS) \$(BASE_INCS) -I$dir \$(${udir}_INCS) ./mkdep \$< \$@ \$(CC) \$(CFLAGS) \$(${udir}_CFLAGS) \$(${udir}_DEFS) \$(BASE_INCS) -I$dir \$(${udir}_INCS)
EOF EOF
fi
done done
# This temporary file is needed because we don't know whether the last # This temporary file is needed because we don't know whether the last
@@ -687,13 +742,18 @@ while read prog objs; do
eval $obj_dep_var=y eval $obj_dep_var=y
fi fi
done done
if [ $dir = dab ]; then
ccvar=CXX
else
ccvar=CC
fi
cat >>GNUmakefile <<EOF cat >>GNUmakefile <<EOF
ifneq (\$(nodep),true) ifneq (\$(nodep),true)
include $deps_to_inc include $deps_to_inc
endif endif
$exec: $nobjs $exec: $nobjs
\$(CC) \$(LDFLAGS) \$^ $libs \$(BASE_LIBS) -o \$@ \$($ccvar) \$(LDFLAGS) \$^ $libs \$(BASE_LIBS) -o \$@
EOF EOF
done <exec.objs.tmp done <exec.objs.tmp

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: countmail.6,v 1.9 2003/07/26 17:31:47 salo Exp $ .\" $NetBSD: countmail.6,v 1.10 2004/02/08 00:31:16 jsm Exp $
.\" .\"
.\" Copyright (c) 1997 Matthew R. Green .\" Copyright (c) 1997 Matthew R. Green
.\" All rights reserved. .\" All rights reserved.

View File

@@ -1,4 +1,4 @@
/* $NetBSD: crib.c,v 1.17 2003/08/07 09:37:09 agc Exp $ */ /* $NetBSD: crib.c,v 1.19 2004/01/27 20:30:29 jsm Exp $ */
/*- /*-
* Copyright (c) 1980, 1993 * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)crib.c 8.1 (Berkeley) 5/31/93"; static char sccsid[] = "@(#)crib.c 8.1 (Berkeley) 5/31/93";
#else #else
__RCSID("$NetBSD: crib.c,v 1.17 2003/08/07 09:37:09 agc Exp $"); __RCSID("$NetBSD: crib.c,v 1.19 2004/01/27 20:30:29 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@@ -56,7 +56,7 @@ __RCSID("$NetBSD: crib.c,v 1.17 2003/08/07 09:37:09 agc Exp $");
#include "cribcur.h" #include "cribcur.h"
#include "pathnames.h" #include "pathnames.h"
int main __P((int, char *[])); int main(int, char *[]);
int int
main(argc, argv) main(argc, argv)
@@ -107,7 +107,7 @@ main(argc, argv)
} }
initscr(); initscr();
(void)signal(SIGINT, rint); (void)signal(SIGINT, receive_intr);
cbreak(); cbreak();
noecho(); noecho();

View File

@@ -1,4 +1,4 @@
/* $NetBSD: cribbage.h,v 1.9 2003/08/07 09:37:09 agc Exp $ */ /* $NetBSD: cribbage.h,v 1.12 2004/02/08 22:23:50 jsm Exp $ */
/* /*
* Copyright (c) 1980, 1993 * Copyright (c) 1980, 1993
@@ -57,56 +57,56 @@ extern BOOLEAN playing; /* currently playing game */
extern char explan[]; /* string for explanation */ extern char explan[]; /* string for explanation */
void addmsg __P((const char *, ...)) void addmsg(const char *, ...)
__attribute__((__format__(__printf__, 1, 2))); __attribute__((__format__(__printf__, 1, 2)));
int adjust __P((const CARD [], CARD)); int adjust(const CARD [], CARD);
int anymove __P((const CARD [], int, int)); int anymove(const CARD [], int, int);
int anysumto __P((const CARD [], int, int, int)); int anysumto(const CARD [], int, int, int);
void bye __P((void)); void bye(void);
int cchose __P((const CARD [], int, int)); int cchose(const CARD [], int, int);
void cdiscard __P((BOOLEAN)); void cdiscard(BOOLEAN);
int chkscr __P((int *, int)); int chkscr(int *, int);
int comphand __P((const CARD [], const char *)); int comphand(const CARD [], const char *);
void cremove __P((CARD, CARD [], int)); void cremove(CARD, CARD [], int);
int cut __P((BOOLEAN, int)); int cut(BOOLEAN, int);
int deal __P((int)); int deal(int);
void discard __P((BOOLEAN)); void discard(BOOLEAN);
void do_wait __P((void)); void do_wait(void);
void endmsg __P((void)); void endmsg(void);
int eq __P((CARD, CARD)); int eq(CARD, CARD);
int fifteens __P((const CARD [], int)); int fifteens(const CARD [], int);
void game __P((void)); void game(void);
void gamescore __P((void)); void gamescore(void);
char *getline __P((void)); char *getline(void);
int getuchar __P((void)); int getuchar(void);
int incard __P((CARD *)); int incard(CARD *);
int infrom __P((const CARD [], int, const char *)); int infrom(const CARD [], int, const char *);
void instructions __P((void)); void instructions(void);
int is_one __P((CARD, const CARD [], int)); int is_one(CARD, const CARD [], int);
void makeboard __P((void)); void makeboard(void);
void makedeck __P((CARD [])); void makedeck(CARD []);
void makeknown __P((const CARD [], int)); void makeknown(const CARD [], int);
void msg __P((const char *, ...)) void msg(const char *, ...)
__attribute__((__format__(__printf__, 1, 2))); __attribute__((__format__(__printf__, 1, 2)));
int msgcard __P((CARD, BOOLEAN)); int msgcard(CARD, BOOLEAN);
int msgcrd __P((CARD, BOOLEAN, const char *, BOOLEAN)); int msgcrd(CARD, BOOLEAN, const char *, BOOLEAN);
int number __P((int, int, const char *)); int number(int, int, const char *);
int numofval __P((const CARD [], int, int)); int numofval(const CARD [], int, int);
int pairuns __P((const CARD [], int)); int pairuns(const CARD [], int);
int peg __P((BOOLEAN)); int peg(BOOLEAN);
int pegscore __P((CARD, const CARD [], int, int)); int pegscore(CARD, const CARD [], int, int);
int playhand __P((BOOLEAN)); int playhand(BOOLEAN);
int plyrhand __P((const CARD [], const char *)); int plyrhand(const CARD [], const char *);
void prcard __P((WINDOW *, int, int, CARD, BOOLEAN)); void prcard(WINDOW *, int, int, CARD, BOOLEAN);
void prcrib __P((BOOLEAN, BOOLEAN)); void prcrib(BOOLEAN, BOOLEAN);
void prhand __P((const CARD [], int, WINDOW *, BOOLEAN)); void prhand(const CARD [], int, WINDOW *, BOOLEAN);
void printcard __P((WINDOW *, int, CARD, BOOLEAN)); void printcard(WINDOW *, int, CARD, BOOLEAN);
void prpeg __P((int, int, BOOLEAN)); void prpeg(int, int, BOOLEAN);
void prtable __P((int)); void prtable(int);
int readchar __P((void)); int readchar(void);
void rint __P((int)) __attribute__((__noreturn__)); void receive_intr(int) __attribute__((__noreturn__));
int score __P((BOOLEAN)); int score(BOOLEAN);
int scorehand __P((const CARD [], CARD, int, BOOLEAN, BOOLEAN)); int scorehand(const CARD [], CARD, int, BOOLEAN, BOOLEAN);
void shuffle __P((CARD [])); void shuffle(CARD []);
void sorthand __P((CARD [], int)); void sorthand(CARD [], int);
void wait_for __P((int)); void wait_for(int);

View File

@@ -1,4 +1,4 @@
/* $NetBSD: io.c,v 1.16 2003/08/07 09:37:10 agc Exp $ */ /* $NetBSD: io.c,v 1.17 2004/01/26 09:58:35 jsm Exp $ */
/*- /*-
* Copyright (c) 1980, 1993 * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 5/31/93"; static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 5/31/93";
#else #else
__RCSID("$NetBSD: io.c,v 1.16 2003/08/07 09:37:10 agc Exp $"); __RCSID("$NetBSD: io.c,v 1.17 2004/01/26 09:58:35 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@@ -582,7 +582,7 @@ getline()
} }
void void
rint(signo) receive_intr(signo)
int signo __attribute__((__unused__)); int signo __attribute__((__unused__));
{ {
bye(); bye();

6
dab/.cvsignore Normal file
View File

@@ -0,0 +1,6 @@
a.out
*.d
*.ii
*.s
*.d.tmp
dab

12
dab/Makefile.bsd Normal file
View File

@@ -0,0 +1,12 @@
# $NetBSD: Makefile,v 1.3 2004/01/05 15:35:59 christos Exp $
WARNS=2
DPADD+=${LIBCURSES} ${LIBTERMCAP} ${LIBM}
LDADD+=-lcurses -ltermcap -lm
PROG_CXX=dab
MAN=dab.6
SRCS=algor.cc board.cc main.cc human.cc box.cc player.cc gamescreen.cc \
ttyscrn.cc random.cc
.include <bsd.prog.mk>

36
dab/Makefrag Normal file
View File

@@ -0,0 +1,36 @@
# Makefrag - makefile fragment for banner
#
# Copyright (c) 2004 Joseph Samuel Myers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
dab_DIRS := $(GAMESDIR) $(MAN6DIR)
dab_all: dab/dab dab/dab.6
dab_install: dab_all
$(INSTALL_BINARY) dab/dab $(INSTALL_PREFIX)$(GAMESDIR)/dab
$(HIDE_GAME) dab
$(INSTALL_MANUAL) dab/dab.6

314
dab/algor.cc Normal file
View File

@@ -0,0 +1,314 @@
/* $NetBSD: algor.cc,v 1.1 2003/12/27 01:16:55 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
/*
* algor.C: Computer algorithm
*/
#include "defs.h"
RCSID("$NetBSD: algor.cc,v 1.1 2003/12/27 01:16:55 christos Exp $")
#include "algor.h"
#include "board.h"
#include "box.h"
#include "random.h"
ALGOR::ALGOR(const char c) : PLAYER(c)
{
#ifdef notyet
// Single Edges = (x + y) * 2
_edge1 = (_b.nx() * _b.ny()) * 2;
// Shared Edges = (x * (y - 1)) + ((x - 1) * y)
_edge2 = (_b.nx() * (_b.ny() - 1)) + ((_b.nx() - 1) * _b.ny());
// Maximum Edges filled before closure = x * y * 2
_maxedge = _b.nx() * _b.ny() * 2;
#endif
}
// Find the first closure, i.e. a box that has 3 edges
int ALGOR::find_closure(size_t& y, size_t& x, int& dir, BOARD& b)
{
RANDOM rdy(b.ny()), rdx(b.nx());
for (y = rdy(); y < b.ny(); y = rdy()) {
rdx.clear();
for (x = rdx(); x < b.nx(); x = rdx()) {
BOX box(y, x, b);
if (box.count() == 3) {
for (dir = BOX::first; dir < BOX::last; dir++)
if (!box.isset(dir))
return 1;
b.abort("find_closure: 3 sided box[%d,%d] has no free sides",
y, x);
}
}
}
return 0;
}
#if 0
size_t ALGOR::find_single()
{
size_t ne;
// Find the number of single edges in use
for (size_t x = 0; x < b.nx(); x++) {
BOX tbox(0, x, b);
ne += tbox.isset(BOX::top);
BOX bbox(b.ny() - 1, x, b);
ne += bbox.isset(BOX::bottom);
}
for (size_t y = 0; y < _b.ny(); y++) {
BOX lbox(y, 0, b);
ne += lbox.isset(BOX::left);
BOX rbox(y,_b.nx() - 1, b);
ne += rbox.isset(BOX::right);
}
return ne;
}
#endif
// Count a closure, by counting all boxes that we can close in the current
// move
size_t ALGOR::count_closure(size_t& y, size_t& x, int& dir, BOARD& b)
{
size_t i = 0;
size_t tx, ty;
int tdir, mv;
while (find_closure(ty, tx, tdir, b)) {
if (i == 0) {
// Mark the beginning of the closure
x = tx;
y = ty;
dir = tdir;
}
if ((mv = b.domove(ty, tx, tdir, getWho())) == -1)
b.abort("count_closure: Invalid move (%d, %d, %d)", y, x, dir);
else
i += mv;
}
return i;
}
/*
* Find the largest closure, by closing all possible closures.
* return the number of boxes closed in the maximum closure,
* and the first box of the maximum closure in (x, y, dir)
*/
int ALGOR::find_max_closure(size_t& y, size_t& x, int& dir, const BOARD& b)
{
BOARD nb(b);
int tdir, maxdir = -1;
size_t nbox, maxbox = 0;
size_t tx, ty, maxx = ~0, maxy = ~0;
while ((nbox = count_closure(ty, tx, tdir, nb)) != 0)
if (nbox > maxbox) {
// This closure is better, update max
maxbox = nbox;
maxx = tx;
maxy = ty;
maxdir = tdir;
}
// Return the max found
y = maxy;
x = maxx;
dir = maxdir;
return maxbox;
}
// Find if a turn does not result in a capture on the given box
// and return the direction if found.
int ALGOR::try_good_turn(BOX& box, size_t y, size_t x, int& dir, BOARD& b)
{
// Sanity check; we must have a good box
if (box.count() >= 2)
b.abort("try_good_turn: box[%d,%d] has more than 2 sides occupied",
y, x);
// Make sure we don't make a closure in an adjacent box.
// We use a random direction to randomize the game
RANDOM rd(BOX::last);
for (dir = rd(); dir < BOX::last; dir = rd())
if (!box.isset(dir)) {
size_t by = y + BOX::edges[dir].y;
size_t bx = x + BOX::edges[dir].x;
if (!b.bounds(by, bx))
return 1;
BOX nbox(by, bx, b);
if (nbox.count() < 2)
return 1;
}
return 0;
}
// Try to find a turn that does not result in an opponent closure, and
// return it in (x, y, dir); if not found return 0.
int ALGOR::find_good_turn(size_t& y, size_t& x, int& dir, const BOARD& b)
{
BOARD nb(b);
RANDOM rdy(b.ny()), rdx(b.nx());
for (y = rdy(); y < b.ny(); y = rdy()) {
rdx.clear();
for (x = rdx(); x < b.nx(); x = rdx()) {
BOX box(y, x, nb);
if (box.count() < 2 && try_good_turn(box, y, x, dir, nb))
return 1;
}
}
return 0;
}
// On a box with 2 edges, return the first or the last free edge, depending
// on the order specified
int ALGOR::try_bad_turn(BOX& box, size_t& y, size_t& x, int& dir, BOARD& b,
int last)
{
if (4 - box.count() <= last)
b.abort("try_bad_turn: Called at [%d,%d] for %d with %d",
y, x, last, box.count());
for (dir = BOX::first; dir < BOX::last; dir++)
if (!box.isset(dir)) {
if (!last)
return 1;
else
last--;
}
return 0;
}
// Find a box that has 2 edges and return the first free edge of that
// box or the last free edge of that box
int ALGOR::find_bad_turn(size_t& y, size_t& x, int& dir, BOARD& b, int last)
{
RANDOM rdy(b.ny()), rdx(b.nx());
for (y = rdy(); y < b.ny(); y = rdy()) {
rdx.clear();
for (x = rdx(); x < b.nx(); x = rdx()) {
BOX box(y, x, b);
if ((4 - box.count()) > last &&
try_bad_turn(box, y, x, dir, b, last))
return 1;
}
}
return 0;
}
int ALGOR::find_min_closure1(size_t& y, size_t& x, int& dir, const BOARD& b,
int last)
{
BOARD nb(b);
int tdir, mindir = -1, xdir, mv;
// number of boxes per closure
size_t nbox, minbox = nb.nx() * nb.ny() + 1;
size_t tx, ty, minx = ~0, miny = ~0;
while (find_bad_turn(ty, tx, tdir, nb, last)) {
// Play a bad move that would cause the opponent's closure
if ((mv = nb.domove(ty, tx, tdir, getWho())) != 0)
b.abort("find_min_closure1: Invalid move %d (%d, %d, %d)", mv,
ty, tx, tdir);
// Count the opponent's closure
if ((nbox = count_closure(y, x, xdir, nb)) == 0)
b.abort("find_min_closure1: no closure found");
if (nbox <= minbox) {
// This closure has fewer boxes
minbox = nbox;
minx = tx;
miny = ty;
mindir = tdir;
}
}
y = miny;
x = minx;
dir = mindir;
return minbox;
}
// Search for the move that makes the opponent close the least number of
// boxes; returns 1 if a move found, 0 otherwise
int ALGOR::find_min_closure(size_t& y, size_t& x, int& dir, const BOARD& b)
{
size_t x1, y1;
int dir1;
int count = b.ny() * b.nx() + 1, count1;
for (size_t i = 0; i < 3; i++)
if (count > (count1 = find_min_closure1(y1, x1, dir1, b, i))) {
count = count1;
y = y1;
x = x1;
dir = dir1;
}
return (size_t) count != b.ny() * b.nx() + 1;
}
// Return a move in (y, x, dir)
void ALGOR::play(const BOARD& b, size_t& y, size_t& x, int& dir)
{
// See if we can close the largest closure available
if (find_max_closure(y, x, dir, b))
return;
#ifdef notyet
size_t sgl = find_single();
size_t dbl = find_double();
#endif
// See if we can play an edge without giving the opponent a box
if (find_good_turn(y, x, dir, b))
return;
// Too bad, find the move that gives the opponent the fewer boxes
if (find_min_closure(y, x, dir, b))
return;
}

86
dab/algor.h Normal file
View File

@@ -0,0 +1,86 @@
/* $NetBSD: algor.h,v 1.1.1.1 2003/12/26 17:57:03 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
/*
* algor.h: Computer's algorithm
*/
#ifndef _H_ALGOR
#define _H_ALGOR
#include "player.h"
class BOARD;
class BOX;
class ALGOR : public PLAYER {
public:
ALGOR(const char c);
// Return a proposed move in (y, x, dir)
void play(const BOARD& b, size_t& y, size_t& x, int& dir);
private:
// Closure searches
int find_closure(size_t& y, size_t& x, int& dir, BOARD& b);
int find_max_closure(size_t& y, size_t& x, int& dir, const BOARD& b);
int find_min_closure1(size_t& y, size_t& x, int& dir, const BOARD& b,
int last);
int find_min_closure(size_t& y, size_t& x, int& dir, const BOARD& b);
// Move searches
int find_good_turn(size_t& y, size_t& x, int& dir, const BOARD& b);
int find_bad_turn(size_t& y, size_t& x, int& dir, BOARD& b, int last);
// Move Attempts
int try_bad_turn(BOX& box, size_t& y, size_t& x, int& dir, BOARD& b,
int last);
int try_good_turn(BOX& box, size_t y, size_t x, int& dir, BOARD& b);
// Utils
size_t count_closure(size_t& y, size_t& x, int& dir, BOARD& b);
#ifdef notyet
size_t find_single(void);
#endif
size_t _edge1;
size_t _edge2;
size_t _maxedge;
};
#endif

260
dab/board.cc Normal file
View File

@@ -0,0 +1,260 @@
/* $NetBSD: board.cc,v 1.1 2003/12/27 01:16:55 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
/*
* board.C: Board manipulations
*/
#include "defs.h"
RCSID("$NetBSD: board.cc,v 1.1 2003/12/27 01:16:55 christos Exp $")
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "board.h"
#include "gamescreen.h"
#include "box.h"
#include "player.h"
BOARD::BOARD(size_t y, size_t x, GAMESCREEN* scrn) :
_ny(y),
_nx(x),
_scrn(scrn)
{
_ty = 2 * _ny + 1;
_tx = 2 * _nx + 1;
_b = new int*[_ty];
for (y = 0; y < _ty; y++)
_b[y] = new int[_tx];
init();
}
BOARD::BOARD(const BOARD& b) :
_ty(b._ty),
_tx(b._tx),
_ny(b._ny),
_nx(b._nx),
_scrn(NULL)
{
_b = new int*[_ty];
for (size_t y = 0; y < _ty; y++) {
_b[y] = new int[_tx];
(void) memcpy(_b[y], b._b[y], _tx * sizeof(int));
}
}
BOARD::~BOARD()
{
size_t y;
for (y = 0; y < _ty; y++)
delete[] _b[y];
delete[] _b;
}
// Clear all boxes and reset state for a new game
void BOARD::init(void)
{
size_t x, y;
for (y = 0; y < _ny; y++)
for (x = 0; x < _nx; x++) {
BOX box(y, x, *this);
box.reset();
}
}
/*
* Make a move for player with initial 'c', adding an edge at box(x, y)
* and the specified direction.
* returns:
* -1: Invalid move
* n: Number of closures n E [0..2]
*/
int BOARD::domove(size_t y, size_t x, int dir, char c)
{
int closed = 0;
// Check if out of bounds
if (!bounds(y, x))
return -1;
BOX box1(y, x, *this);
// Check if the edge is already there
if (box1.isset(dir))
return -1;
box1.set(dir);
if (box1.count() == 4) {
// New box; name it and count it
box1.name() = c;
closed++;
}
box1.paint();
// Check other box
x += BOX::edges[dir].x;
y += BOX::edges[dir].y;
if (bounds(y, x)) {
BOX box2(y, x, *this);
if (box2.count() == 4) {
box2.name() = c;
box2.paint();
closed++;
}
}
return closed;
}
// Return true if the board is full
int BOARD::full(void) const
{
for (size_t y = 0; y < _ny; y++)
for (size_t x = 0; x < _nx; x++) {
BOX box(y, x, (BOARD&) *this);
if (box.count() != 4)
return 0;
}
return 1;
}
// Return if the coordinates are within bounds; we don't check for < 0,
// since size_t is unsigned
int BOARD::bounds(size_t y, size_t x) const
{
return x < _nx && y < _ny;
}
// Paint all boxes, effectively redrawing the board
void BOARD::paint(void) const
{
for (size_t y = 0; y < _ny; y++)
for (size_t x = 0; x < _nx; x++) {
BOX box(y, x, (BOARD&) *this);
box.paint();
}
}
// Clear the screen
void BOARD::clean(void) const
{
if (!_scrn)
return;
_scrn->clean();
}
// Move cursor to x, y
void BOARD::setpos(size_t y, size_t x) const
{
if (!_scrn)
return;
_scrn->moveto(y, x);
_scrn->redraw();
}
// Return character indicating move
int BOARD::getmove(void) const
{
if (!_scrn)
return 'q';
_scrn->redraw();
return _scrn->getinput();
}
// Ring the bell
void BOARD::bell(void) const
{
if (!_scrn)
return;
_scrn->bell();
}
// Post the score in the current game for player i
void BOARD::score(size_t i, const PLAYER& p)
{
if (_scrn == NULL)
return;
_scrn->score(i, p);
}
// Post the number of games won for player i
void BOARD::games(size_t i, const PLAYER& p)
{
if (_scrn == NULL)
return;
_scrn->games(i, p);
}
// Post the total score for player i
void BOARD::total(size_t i, const PLAYER& p)
{
if (_scrn == NULL)
return;
_scrn->total(i, p);
}
// Post the total score for player i
void BOARD::ties(const PLAYER& p)
{
if (_scrn == NULL)
return;
_scrn->ties(p);
}
// Internal algorithm error; post and abort
void BOARD::abort(const char* s, ...) const
{
for (size_t i = 0; i < _ny; i++)
fprintf(stderr, "\n");
va_list ap;
fprintf(stderr, "Algorithm internal error: ");
va_start(ap, s);
vfprintf(stderr, s, ap);
va_end(ap);
fprintf(stderr, "\n");
::abort();
}

92
dab/board.h Normal file
View File

@@ -0,0 +1,92 @@
/* $NetBSD: board.h,v 1.1.1.1 2003/12/26 17:57:03 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
/*
* board.h: Board functions
*/
#ifndef _H_BOARD
#define _H_BOARD
#include <stdlib.h>
class GAMESCREEN;
class PLAYER;
class BOARD {
public:
// Constructors and destructor
BOARD(size_t y, size_t x, GAMESCREEN* scrn);// For the main screen
BOARD(const BOARD& b); // For scratch screens
~BOARD();
// member access
size_t nx(void) const { return _nx; }
size_t ny(void) const { return _ny; }
size_t tx(void) const { return _tx; }
size_t ty(void) const { return _ty; }
GAMESCREEN* getScrn(void) const { return _scrn; }
int& data(size_t y, size_t x) { return _b[y][x]; }
// Computing
int domove(size_t y, size_t x, int dir, char c); // Play move
void init(void); // Initialize a new game
int full(void) const; // True if no more moves
int bounds(size_t y, size_t x) const; // True if in bounds
// Screen updates
void paint(void) const; // Redraw screen
void clean(void) const; // Clear screen
void setpos(size_t y, size_t x) const; // move cursor to pos
int getmove(void) const; // Return move
void bell(void) const; // Beep!
void score(size_t i, const PLAYER& p); // Post score
void games(size_t i, const PLAYER& p); // Post games
void total(size_t i, const PLAYER& p); // Post totals
void ties(const PLAYER& p); // Post ties
void abort(const char *s, ...) const; // Algorithm error
private:
size_t _ty, _tx; // number of symbols in x and y dimension
size_t _ny, _nx; // number of boxes in the x and y dimension
int** _b; // board array of symbols
GAMESCREEN* _scrn; // screen access, if we have one
};
#endif

157
dab/box.cc Normal file
View File

@@ -0,0 +1,157 @@
/* $NetBSD: box.cc,v 1.1 2003/12/27 01:16:55 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
/*
* box.C: Box computations
*/
#include "defs.h"
RCSID("$NetBSD: box.cc,v 1.1 2003/12/27 01:16:55 christos Exp $")
#include "box.h"
#include "board.h"
#include "gamescreen.h"
#include <curses.h>
const POINT BOX::edges[BOX::last] =
{ { 0, -1 }, { 0, 1 }, { -1, 0 }, { 1, 0 } };
const POINT BOX::corners[BOX::last] =
{ { -1, -1 }, { -1, 1 }, { 1, -1 }, { 1, 1 } };
const int BOX::syms[BOX::last] =
{ GAMESCREEN::GS_HLINE, GAMESCREEN::GS_HLINE,
GAMESCREEN::GS_VLINE, GAMESCREEN::GS_VLINE };
BOX::BOX(size_t py, size_t px, BOARD& b) :
_b(b)
{
_centery = py * 2 + 1;
_centerx = px * 2 + 1;
}
void BOX::addcorner(size_t y, size_t x)
{
char sym;
_b.getScrn()->moveto(y, x);
if (x == 0) {
if (y == 0)
sym = GAMESCREEN::GS_ULCORNER;
else if (y == _b.ty() - 1)
sym = GAMESCREEN::GS_LLCORNER;
else
sym = GAMESCREEN::GS_LTEE;
} else if (x == _b.tx() - 1) {
if (y == 0)
sym = GAMESCREEN::GS_URCORNER;
else if (y == _b.ty() - 1)
sym = GAMESCREEN::GS_LRCORNER;
else
sym = GAMESCREEN::GS_RTEE;
} else if (y == 0)
sym = GAMESCREEN::GS_TTEE;
else if (y == _b.ty() - 1)
sym = GAMESCREEN::GS_BTEE;
else
sym = GAMESCREEN::GS_PLUS;
_b.getScrn()->addedge(sym);
}
// Paint a box
void BOX::paint(void)
{
int e;
if (_b.getScrn() == NULL)
return;
_b.getScrn()->moveto(_centery, _centerx);
_b.getScrn()->addsym(name());
for (e = BOX::first; e < BOX::last; e++) {
addcorner(_centery + corners[e].y, _centerx + corners[e].x);
_b.getScrn()->moveto(_centery + edges[e].y, _centerx + edges[e].x);
_b.getScrn()->addedge(edge((EDGE) e));
}
_b.getScrn()->redraw();
}
// Return the name
int& BOX::name(void)
{
return _b.data(_centery, _centerx);
}
// Set an edge
void BOX::set(int e)
{
_b.data(_centery + edges[e].y, _centerx + edges[e].x) = syms[e];
}
// Clear an edge
void BOX::clr(int e)
{
_b.data(_centery + edges[e].y, _centerx + edges[e].x) = ' ';
}
// Test an edge
int BOX::isset(int e) const
{
return _b.data(_centery + edges[e].y, _centerx + edges[e].x) != ' ';
}
// Return the edge
int& BOX::edge(int e)
{
return _b.data(_centery + edges[e].y, _centerx + edges[e].x);
}
// Count the number of edges set in the box
int BOX::count(void) const
{
int cnt = 0;
for (int e = BOX::first; e < BOX::last; e++)
cnt += isset((EDGE) e);
return cnt;
}
// Clear the box
void BOX::reset(void)
{
for (int e = BOX::first; e < BOX::last; e++)
clr((EDGE) e);
name() = ' ';
}

100
dab/box.h Normal file
View File

@@ -0,0 +1,100 @@
/* $NetBSD: box.h,v 1.1.1.1 2003/12/26 17:57:03 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
/*
* box.C: Single box utilities; A box is an entity with four edges, four
* corners, and a center that maps directly to a board
*/
#ifndef _H_BOX
#define _H_BOX
#include <stdlib.h>
class BOARD;
class POINT {
public:
int x;
int y;
};
class BOX {
public:
enum EDGE {
first = 0,
top = 0,
bottom = 1,
left = 2,
right = 3,
last = 4,
};
BOX(size_t py, size_t px, BOARD& b);
void reset(void); // Clear a box
void paint(void); // Paint a box
// Member access
int& name(void);
int& edge(int e);
// Edge maniputations
void set(int e);
void clr(int e);
int isset(int e) const;
int count(void) const; // Count the number of edges in use
// Useful constants
// Relative coordinates of the edges from the center of the box.
static const POINT edges[BOX::last];
// Relative coordinates of the corners from the center of the box.
static const POINT corners[BOX::last];
// Character symbols of the four edges
static const int syms[BOX::last];
private:
void addcorner(size_t y, size_t x); // add a corner character
size_t _centerx; // Coordinates of the center in board units
size_t _centery;
BOARD& _b; // The board we refer to
};
#endif

110
dab/dab.6 Normal file
View File

@@ -0,0 +1,110 @@
.\" $NetBSD: dab.6,v 1.1.1.1 2003/12/26 17:57:04 christos Exp $
.\"
.\" Copyright (c) 2003 Thomas Klausner.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. The name of the author may not be used to endorse or promote products
.\" derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd December 24, 2003
.Dt DAB 6
.Os
.Sh NAME
.Nm dab
.Nd Dots and Boxes game
.Sh SYNOPSIS
.Nm
.Op Fl aw
.Op Fl n Ar ngames
.Op Fl p Ao Ar c|h Ac Ns Ao Ar c|h Ac
.Op Ar xdim Oo Ar ydim Oc
.Sh DESCRIPTION
.Nm
is a game where each player tries to complete the most
boxes.
A turn consists of putting one border of a box; the player
setting the fourth and final border of a box gets the
point for the box and has another turn.
.Pp
The keys used are the vi keys:
.Ic k
for up,
.Ic j
for down,
.Ic h
for left, and
.Ic l
for right.
To switch between even and odd rows, use one of the following
keys:
.Ic u
.Pq diagonal right up ,
.Ic y
.Pq diagonal left up ,
.Ic b
.Pq diagonal left down ,
.Ic n
.Pq diagonal right down ;
.Aq Ic space
sets a new border,
.Ic CTRL-L
and
.Ic CTRL-R
redraw the screen, and
.Ic q
quits the game.
.Pp
Support options are:
.Bl -tag -width XXnXngamesXXXXX
.It Fl a
Don't use the alternate character set.
.It Fl n Ar ngames
.Ar ngames
games will be played.
.Pq Especially useful in Fl p Ar cc No mode.
.It Fl p Ao Ar c|h Ac Ns Ao Ar c|h Ac
Select which of the two players is a human
or a computer.
The first argument is the first player;
.Ic c
stands for computer and
.Ic h
for human.
.It Fl w
Wait for a character press between games.
.El
.Pp
.Ar xdim
and
.Ar ydim
define the size of the board in the x and y
dimensions.
.Sh AUTHORS
.An Christos Zoulas
.Aq christos@NetBSD.org
.Sh SEE ALSO
.Rs
.%A Elwyn R. Berlekamp
.%T The Dots and Boxes Game: Sophisticated Child's Play
.%D 2000
.%I A K Peters
.%O http://www.akpeters.com/book.asp?bID=111
.Re

51
dab/defs.h Normal file
View File

@@ -0,0 +1,51 @@
/* $NetBSD: defs.h,v 1.1.1.1 2003/12/26 17:57:03 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
/*
* defs.h: Macro defines
*/
#ifndef _H_DEFS
#define _H_DEFS
#include <stdlib.h>
#define RCSID(id) \
static const char *rcsid(const char* x) { return x ? rcsid(id) : x; }
#endif

50
dab/gamescreen.cc Normal file
View File

@@ -0,0 +1,50 @@
/* $NetBSD: gamescreen.cc,v 1.1 2003/12/27 01:16:55 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
/*
* gamescreen.C: Common screen functions
*/
#include "defs.h"
RCSID("$NetBSD: gamescreen.cc,v 1.1 2003/12/27 01:16:55 christos Exp $")
#include "gamescreen.h"
// Nothing to do
GAMESCREEN::~GAMESCREEN()
{
}

79
dab/gamescreen.h Normal file
View File

@@ -0,0 +1,79 @@
/* $NetBSD: gamescreen.h,v 1.1.1.1 2003/12/26 17:57:03 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
/*
* screen.h: Screen base class
*/
#ifndef _H_GAMESCREEN
#define _H_GAMESCREEN
#include <stdlib.h>
class PLAYER;
class GAMESCREEN {
public:
enum EDGE {
GS_HLINE,
GS_VLINE,
GS_ULCORNER,
GS_URCORNER,
GS_LLCORNER,
GS_LRCORNER,
GS_LTEE,
GS_RTEE,
GS_TTEE,
GS_BTEE,
GS_PLUS
};
virtual ~GAMESCREEN();
virtual void clean(void) = 0; // Clear screen
virtual void moveto(size_t y, size_t x) = 0; // Move to x, y
virtual void addsym(const int sym) = 0; // Add character symbol
virtual void addedge(const int sym) = 0; // Add character symbol
virtual void redraw(void) = 0; // Refresh
virtual int getinput(void) = 0; // Get user input
virtual void bell(void) = 0; // Beep
virtual void score(size_t p, const PLAYER& p) = 0; // Post current score
virtual void games(size_t p, const PLAYER& p) = 0; // Post games won
virtual void total(size_t p, const PLAYER& p) = 0; // Post total score
virtual void ties(const PLAYER& p) = 0; // Post tie games
};
#endif

151
dab/human.cc Normal file
View File

@@ -0,0 +1,151 @@
/* $NetBSD: human.cc,v 1.1 2003/12/27 01:16:55 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
/*
* human.C: Human interface for dots, using rogue-like keys.
*/
#include "defs.h"
RCSID("$NetBSD: human.cc,v 1.1 2003/12/27 01:16:55 christos Exp $")
#include "human.h"
#include "board.h"
#include "box.h"
#define CONTROL(a) ((a) & 037)
HUMAN::HUMAN(const char c) :
PLAYER(c),
_curx(0),
_cury(1)
{
}
void HUMAN::play(const BOARD& b, size_t& y, size_t& x, int& dir)
{
int mv;
b.setpos(_cury, _curx);
for (;;) {
switch (mv = b.getmove()) {
case 'h': case 'H':
_curx -= 2;
break;
case 'l': case 'L':
_curx += 2;
break;
case 'k': case 'K':
_cury -= 2;
break;
case 'j': case 'J':
_cury += 2;
break;
case 'u': case 'U':
_curx += 1;
_cury -= 1;
break;
case 'y': case 'Y':
_curx -= 1;
_cury -= 1;
break;
case 'b': case 'B':
_curx -= 1;
_cury += 1;
break;
case 'n': case 'N':
_curx += 1;
_cury += 1;
break;
case 'q': case 'Q':
exit(0);
case CONTROL('L'): case CONTROL('R'):
b.clean();
b.paint();
break;
case ' ':
{
x = _curx / 2;
y = _cury / 2;
if (_cury & 1) {
if (_curx == 0)
dir = BOX::left;
else {
x--;
dir = BOX::right;
}
}
if (_curx & 1) {
if (_cury == 0)
dir = BOX::top;
else {
y--;
dir = BOX::bottom;
}
}
}
return;
default:
break;
}
// We add 2 before the comparison to avoid underflow
if ((2 + _curx) - (_curx & 1) < 2)
_curx = (b.nx() * 2) + (_curx & 1);
if (_curx >= (b.nx() * 2) + 1)
_curx = (_curx & 1);
if ((2 + _cury) - (_cury & 1) < 2)
_cury = (b.ny() * 2) + (_cury & 1);
if (_cury >= (b.ny() * 2) + 1)
_cury = (_cury & 1);
b.setpos(_cury, _curx);
}
}

59
dab/human.h Normal file
View File

@@ -0,0 +1,59 @@
/* $NetBSD: human.h,v 1.1.1.1 2003/12/26 17:57:03 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
/*
* human.h: Human input interface
*/
#ifndef _H_HUMAN
#define _H_HUMAN
#include <stdlib.h>
#include "player.h"
class BOARD;
class HUMAN : public PLAYER {
public:
HUMAN(const char c);
// Return move in y, x, and dir
void play(const BOARD& b, size_t& y, size_t& x, int& dir);
private:
size_t _curx, _cury; // Current cursor position
};
#endif

196
dab/main.cc Normal file
View File

@@ -0,0 +1,196 @@
/* $NetBSD: main.cc,v 1.2 2003/12/28 17:53:48 thorpej Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
/*
* main.C: Main dots program
*/
#include "defs.h"
RCSID("$NetBSD: main.cc,v 1.2 2003/12/28 17:53:48 thorpej Exp $")
#include <iostream>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <err.h>
#include "algor.h"
#include "board.h"
#include "human.h"
#include "ttyscrn.h"
// Print the command line usage
static void usage(char* pname)
{
char* p = strrchr(pname, '/');
if (p)
p++;
else
p = pname;
std::cerr << "Usage: " << p
<< " [-w] [-p <c|h><c|h>] [-n <ngames>] [<ydim> [<xdim>]]" << std::endl;
}
// Play a single game
static void play(BOARD& b, PLAYER* p[2])
{
// Initialize
b.init();
p[0]->init();
p[1]->init();
b.paint();
// Alternate turns between players, scoring each turn
for (size_t i = 0;; i = (i + 1) & 1) {
b.score(i, *p[i]);
if (!p[i]->domove(b)) {
// No more moves, game over
break;
}
b.score(i, *p[i]);
}
// Find who won
p[0]->wl(p[1]->getScore());
p[1]->wl(p[0]->getScore());
// Post scores
b.score(0, *p[0]);
b.score(1, *p[1]);
// Post totals
b.total(0, *p[0]);
b.total(1, *p[1]);
// Post games
b.games(0, *p[0]);
b.games(1, *p[1]);
// Post ties
b.ties(*p[0]);
}
int main(int argc, char** argv)
{
size_t ny, nx, nn = 1, wt = 0;
const char* nc = "ch";
int c;
int acs = 1;
while ((c = getopt(argc, argv, "awp:n:")) != -1)
switch (c) {
case 'a':
acs = 0;
break;
case 'w':
wt++;
break;
case 'p':
nc = optarg;
break;
case 'n':
nn = atoi(optarg);
break;
default:
usage(argv[0]);
return 1;
}
// Get the size of the board if specified
switch (argc - optind) {
case 0:
ny = nx = 3;
break;
case 1:
ny = nx = atoi(argv[optind]);
break;
case 2:
nx = atoi(argv[optind]);
ny = atoi(argv[optind+1]);
break;
default:
usage(argv[0]);
return 1;
}
PLAYER* p[2];
// Allocate players
for (size_t i = 0; i < 2; i++) {
char n = nc[1] == nc[0] ? i + '0' : nc[i];
switch (nc[i]) {
case 'c':
p[i] = new ALGOR(n);
break;
case 'h':
p[i] = new HUMAN(n);
break;
default:
usage(argv[0]);
return 1;
}
}
GAMESCREEN *sc = TTYSCRN::create(acs, ny, nx);
if (sc == NULL)
::errx(1, "Dimensions too large for current screen.");
BOARD b(ny, nx, sc);
// Play games
while (nn--) {
play(b, p);
if (wt)
b.getmove();
}
if (wt == 0)
b.getmove();
// Cleanup
delete sc;
delete p[0];
delete p[1];
return 0;
}

98
dab/player.cc Normal file
View File

@@ -0,0 +1,98 @@
/* $NetBSD: player.cc,v 1.1 2003/12/27 01:16:55 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
/*
* player.C: Player base class
*/
#include "defs.h"
RCSID("$NetBSD: player.cc,v 1.1 2003/12/27 01:16:55 christos Exp $")
#include "board.h"
#include "player.h"
PLAYER::PLAYER(char who) :
_who(who),
_score(0),
_total(0),
_games(0),
_ties(0)
{
}
void PLAYER::init(void)
{
_score = 0;
}
void PLAYER::wl(size_t sc)
{
_total += _score;
_games += sc < _score;
_ties += sc == _score;
}
int PLAYER::domove(BOARD& b)
{
size_t y, x;
int dir;
int score;
for (;;) {
if (b.full())
return 0;
play(b, y, x, dir);
switch (score = b.domove(y, x, dir, _who)) {
case 0:
// No closure
return 1;
case -1:
// Not a valid move
b.bell();
break;
default:
// Closure, play again
_score += score;
break;
}
}
}

76
dab/player.h Normal file
View File

@@ -0,0 +1,76 @@
/* $NetBSD: player.h,v 1.1.1.1 2003/12/26 17:57:03 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
/*
* player.h: Player base class
*/
#ifndef _H_PLAYER
#define _H_PLAYER
class BOARD;
#include <stdlib.h>
class PLAYER {
public:
PLAYER(char who);
virtual void play(const BOARD& b, size_t& y, size_t& x, int& dir) = 0;
// Helper functions
void init(void);
int domove(BOARD& b);
// Member access
char getWho(void) const { return _who; }
// Display
size_t getScore(void) const { return _score; }
size_t getTotal(void) const { return _total; }
size_t getGames(void) const { return _games; }
size_t getTies(void) const { return _ties; }
void wl(size_t sc);
private:
char _who;
size_t _score;
size_t _total;
size_t _games;
size_t _ties;
};
#endif

86
dab/random.cc Normal file
View File

@@ -0,0 +1,86 @@
/* $NetBSD: random.cc,v 1.2 2003/12/28 17:49:10 thorpej Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
/*
* random.C: Randomizer for the dots program
*/
#include "defs.h"
RCSID("$NetBSD: random.cc,v 1.2 2003/12/28 17:49:10 thorpej Exp $")
#include <time.h>
#include <string.h>
#include "random.h"
RANDOM::RANDOM(size_t ns) :
_bs(ns)
{
_bm = new char[(_bs >> 3) + 1];
clear();
}
RANDOM::~RANDOM()
{
delete[] _bm;
}
// Reinitialize
void RANDOM::clear(void)
{
_nv = 0;
::srand48(::time(NULL));
(void) ::memset(_bm, 0, (_bs >> 3) + 1);
}
// Return the next random value
size_t RANDOM::operator() (void)
{
// No more values
if (_nv == _bs)
return _bs;
for (;;) {
size_t r = ::lrand48();
size_t z = r % _bs;
if (!isset(z)) {
set(z);
_nv++;
return z;
}
}
}

73
dab/random.h Normal file
View File

@@ -0,0 +1,73 @@
/* $NetBSD: random.h,v 1.2 2003/12/28 17:49:10 thorpej Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
/*
* random.h: Randomizer; returns a random sequence of values from [0..fx)
* returning each value exactly once. After fx calls it returns fx.
*/
#ifndef _H_RANDOM
#define _H_RANDOM
#include <stdlib.h>
class RANDOM {
public:
// Constructor and destructor
RANDOM(size_t fx);
~RANDOM();
size_t operator () (void); // Next random
void clear(void); // Reset
private:
int isset(size_t z) {
return (_bm[z >> 3] & (1 << (z & 7))) != 0;
}
void set(size_t z) {
_bm[z >> 3] |= (1 << (z & 7));
}
char* _bm; // Bitmap indicating the numbers used
size_t _nv; // Number of values returned so far
size_t _bs; // Maximum value
};
#endif

57
dab/test.cc Normal file
View File

@@ -0,0 +1,57 @@
/* $NetBSD: test.cc,v 1.1 2003/12/27 01:16:55 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
/*
* test.C: Test program for randomizer
*/
#include "defs.h"
RCSID("$NetBSD: test.cc,v 1.1 2003/12/27 01:16:55 christos Exp $")
#include <iostream>
#include "random.h"
int
main(void)
{
RANDOM rd(10);
for (size_t x = rd(); x < 10; x = rd())
std::cout << "x=" << x << std::endl;
return 0;
}

235
dab/ttyscrn.cc Normal file
View File

@@ -0,0 +1,235 @@
/* $NetBSD: ttyscrn.cc,v 1.2 2003/12/27 18:24:51 martin Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
/*
* ttyscrn.C: Curses screen implementation for dots
*/
#include "defs.h"
RCSID("$NetBSD: ttyscrn.cc,v 1.2 2003/12/27 18:24:51 martin Exp $")
#include <stdio.h>
#include <curses.h>
#include <sys/ioctl.h>
#include "player.h"
#include "ttyscrn.h"
void TTYSCRN::clean(void)
{
clear();
}
void TTYSCRN::moveto(size_t y, size_t x)
{
move(y + TTYSCRN::offsy, x + TTYSCRN::offsx);
}
void TTYSCRN::addsym(const int sym)
{
addch(sym);
}
void TTYSCRN::addedge(const int sym)
{
int nsym;
#ifdef A_ALTCHARSET
if (_acs) {
switch (sym) {
case GS_HLINE:
nsym = ACS_HLINE;
break;
case GS_VLINE:
nsym = ACS_VLINE;
break;
case GS_ULCORNER:
nsym = ACS_ULCORNER;
break;
case GS_URCORNER:
nsym = ACS_URCORNER;
break;
case GS_LLCORNER:
nsym = ACS_LLCORNER;
break;
case GS_LRCORNER:
nsym = ACS_LRCORNER;
break;
case GS_LTEE:
nsym = ACS_LTEE;
break;
case GS_RTEE:
nsym = ACS_RTEE;
break;
case GS_TTEE:
nsym = ACS_TTEE;
break;
case GS_BTEE:
nsym = ACS_BTEE;
break;
case GS_PLUS:
nsym = ACS_PLUS;
break;
case ' ':
addsym(' ');
return;
default:
::abort();
}
attron(A_ALTCHARSET);
addch(nsym);
attroff(A_ALTCHARSET);
return;
}
#endif
switch (sym) {
case GS_HLINE:
nsym = '-';
break;
case GS_VLINE:
nsym = '|';
break;
case GS_ULCORNER:
nsym = '.';
break;
case GS_URCORNER:
nsym = '.';
break;
case GS_LLCORNER:
nsym = '.';
break;
case GS_LRCORNER:
nsym = '.';
break;
case GS_LTEE:
nsym = '.';
break;
case GS_RTEE:
nsym = '.';
break;
case GS_TTEE:
nsym = '.';
break;
case GS_BTEE:
nsym = '.';
break;
case GS_PLUS:
nsym = '+';
break;
case ' ':
addsym(' ');
return;
default:
::abort();
}
addsym(nsym);
}
void TTYSCRN::redraw(void)
{
refresh();
doupdate();
}
void TTYSCRN::bell(void)
{
putc('\007', stdout);
}
int TTYSCRN::getinput(void)
{
return getch();
}
void TTYSCRN::score(size_t s, const PLAYER& p)
{
mvwprintw(stdscr, _sy + s + TTYSCRN::offsscore, _sx, "S %c:%5zd", p.getWho(),
p.getScore());
}
void TTYSCRN::total(size_t s, const PLAYER& p)
{
mvwprintw(stdscr, _sy + s + TTYSCRN::offstotal, _sx, "T %c:%5zd", p.getWho(),
p.getTotal());
}
void TTYSCRN::games(size_t s, const PLAYER& p)
{
mvwprintw(stdscr, _sy + s + TTYSCRN::offsgames, _sx, "G %c:%5zd", p.getWho(),
p.getGames());
}
void TTYSCRN::ties(const PLAYER& p)
{
mvwprintw(stdscr, _sy + TTYSCRN::offsties, _sx, "G =:%5zd", p.getTies());
}
TTYSCRN* TTYSCRN::create(int acs, size_t y, size_t x)
{
int tx, ty;
initscr();
tx = getmaxx(stdscr);
ty = getmaxy(stdscr);
if (tx == ERR || ty == ERR || (size_t)tx < x * 2 + TTYSCRN::offsx + 12
|| (size_t)ty < y * 2 + TTYSCRN::offsy) {
endwin();
return NULL;
}
cbreak();
noecho();
TTYSCRN* that = new TTYSCRN;
that->_tx = tx;
that->_ty = ty;
that->_sx = tx - 12;
that->_sy = TTYSCRN::offsy;
that->_acs = acs;
return that;
}
TTYSCRN::~TTYSCRN(void)
{
nocbreak();
echo();
endwin();
}

81
dab/ttyscrn.h Normal file
View File

@@ -0,0 +1,81 @@
/* $NetBSD: ttyscrn.h,v 1.2 2003/12/28 17:49:10 thorpej Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
/*
* ttyscrn.h: Curses based screen for dots
*/
#ifndef _H_TTYSCRN
#define _H_TTYSCRN
#include "gamescreen.h"
class TTYSCRN : public GAMESCREEN {
public:
// Constructor that can fail
static TTYSCRN* create(int acs, size_t y, size_t x);
~TTYSCRN();
// Screen virtuals
void clean(void);
void moveto(size_t y, size_t x);
void addsym(const int sym);
void addedge(const int sym);
void redraw(void);
void bell(void);
int getinput(void);
void score(size_t s, const PLAYER& p);
void games(size_t s, const PLAYER& p);
void total(size_t s, const PLAYER& p);
void ties(const PLAYER& p);
private:
enum {
offsx = 2, // board x offset from top left corner
offsy = 2, // board y offset from top left corner
offsscore = 0, // score y offset from top of the board
offstotal = 3, // total y offset from top of the board
offsgames = 6, // games y offset from top of the board
offsties = 8 // ties y offset from top of the board
};
size_t _sx, _sy; // board size
size_t _tx, _ty; // tty size
int _acs; // do we want acs?
};
#endif

6
debian/changelog vendored
View File

@@ -1,3 +1,9 @@
bsdgames (2.16-1) unstable; urgency=low
* New upstream release.
-- Joey Hess <joeyh@debian.org> Sat, 14 Feb 2004 16:34:08 -0500
bsdgames (2.15-1) unstable; urgency=low bsdgames (2.15-1) unstable; urgency=low
* New upstream release. * New upstream release.

2
debian/control vendored
View File

@@ -15,7 +15,7 @@ Description: a collection of classic textual unix games
been enjoyed for decades on unix systems. been enjoyed for decades on unix systems.
. .
Includes these programs: adventure, arithmetic, atc, backgammon, battlestar, Includes these programs: adventure, arithmetic, atc, backgammon, battlestar,
bcd, boggle, caesar, canfield, countmail, cribbage, fish, gomoku, hack, bcd, boggle, caesar, canfield, countmail, cribbage, dab, fish, gomoku, hack,
hangman, hunt, mille, monop, morse, number, pig, phantasia, pom, ppt, primes, hangman, hunt, mille, monop, morse, number, pig, phantasia, pom, ppt, primes,
quiz, random, rain, robots, sail, snake, tetris, trek, wargames, worm, worms, quiz, random, rain, robots, sail, snake, tetris, trek, wargames, worm, worms,
wump, wtf wump, wtf

2
debian/rules vendored
View File

@@ -33,10 +33,8 @@ binary-arch: build
$(MAKE) install $(MAKE) install
cp atc/BUGS debian/bsdgames/usr/share/doc/bsdgames/BUGS.atc cp atc/BUGS debian/bsdgames/usr/share/doc/bsdgames/BUGS.atc
cp hunt/README debian/bsdgames/usr/share/doc/bsdgames/README.hunt cp hunt/README debian/bsdgames/usr/share/doc/bsdgames/README.hunt
cp hunt/README.linux debian/bsdgames/usr/share/doc/bsdgames/README.linux.hunt
cp phantasia/README debian/bsdgames/usr/share/doc/bsdgames/README.phantasia cp phantasia/README debian/bsdgames/usr/share/doc/bsdgames/README.phantasia
cp boggle/README debian/bsdgames/usr/share/doc/bsdgames/README.boggle cp boggle/README debian/bsdgames/usr/share/doc/bsdgames/README.boggle
cp boggle/README.linux debian/bsdgames/usr/share/doc/bsdgames/README.linux.boggle
cp hack/Original_READ_ME debian/bsdgames/usr/share/doc/bsdgames/Original_READ_ME.hack cp hack/Original_READ_ME debian/bsdgames/usr/share/doc/bsdgames/Original_READ_ME.hack
cp hack/READ_ME debian/bsdgames/usr/share/doc/bsdgames/READ_ME.hack cp hack/READ_ME debian/bsdgames/usr/share/doc/bsdgames/READ_ME.hack
# Since factor is not installed, and primes.6 is a symlink to # Since factor is not installed, and primes.6 is a symlink to

View File

@@ -1,6 +1,6 @@
# Makefrag - makefile fragment for dm # Makefrag - makefile fragment for dm
# #
# Copyright (c) 1997, 1998, 1999 Joseph Samuel Myers. # Copyright (c) 1997, 1998, 1999, 2004 Joseph Samuel Myers.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,7 @@
# SUCH DAMAGE. # SUCH DAMAGE.
# Add -DLOG if you want logging # Add -DLOG if you want logging
dm_DEFS := $(GETLOADAVG_DEFS) # -DLOG dm_DEFS := $(GETLOADAVG_DEFS) -D_GNU_SOURCE -DSUPPORT_UTMPX -DSUPPORT_UTMP # -DLOG
dm_DIRS := $(GAMESDIR) $(MAN8DIR) $(MAN5DIR) dm_DIRS := $(GAMESDIR) $(MAN8DIR) $(MAN5DIR)
dm_all: dm/dm dm/dm.8 dm/dm.conf.5 dm_all: dm/dm dm/dm.8 dm/dm.conf.5

View File

@@ -1,13 +0,0 @@
1997-08-07
Dm is the `dungeon master', a program that allows you to control when
users can play games. (Note that this does not control any private
copies of games they may have). I do not claim that this program is
actually useful, but it is included in bsd-games since it is in
NetBSD.
Add -DLOG to the DEFS in the Makefile if you want logging of games
playing.
Joseph S. Myers
jsm@polyomino.org.uk

45
dm/dm.c
View File

@@ -1,5 +1,4 @@
/* $NetBSD: dm.c,v 1.18 2003/08/07 09:37:11 agc Exp $ */ /* $NetBSD: dm.c,v 1.20 2004/02/08 22:23:50 jsm Exp $ */
/* For Linux: still using old utmp interface from version 1.16. */
/* /*
* Copyright (c) 1987, 1993 * Copyright (c) 1987, 1993
@@ -40,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)dm.c 8.1 (Berkeley) 5/31/93"; static char sccsid[] = "@(#)dm.c 8.1 (Berkeley) 5/31/93";
#else #else
__RCSID("$NetBSD: dm.c,v 1.18 2003/08/07 09:37:11 agc Exp $"); __RCSID("$NetBSD: dm.c,v 1.20 2004/02/08 22:23:50 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@@ -58,8 +57,8 @@ __RCSID("$NetBSD: dm.c,v 1.18 2003/08/07 09:37:11 agc Exp $");
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include <utmp.h>
#include "utmpentry.h"
#include "pathnames.h" #include "pathnames.h"
static time_t now; /* current time value */ static time_t now; /* current time value */
@@ -67,16 +66,16 @@ static int priority = 0; /* priority game runs at */
static char *game, /* requested game */ static char *game, /* requested game */
*gametty; /* from tty? */ *gametty; /* from tty? */
void c_day __P((const char *, const char *, const char *)); void c_day(const char *, const char *, const char *);
void c_game __P((const char *, const char *, const char *, const char *)); void c_game(const char *, const char *, const char *, const char *);
void c_tty __P((const char *)); void c_tty(const char *);
const char *hour __P((int)); const char *hour(int);
double load __P((void)); double load(void);
int main __P((int, char *[])); int main(int, char *[]);
void nogamefile __P((void)); void nogamefile(void);
void play __P((char **)) __attribute__((__noreturn__)); void play(char **) __attribute__((__noreturn__));
void read_config __P((void)); void read_config(void);
int users __P((void)); int users(void);
int int
main(argc, argv) main(argc, argv)
@@ -253,16 +252,16 @@ load()
int int
users() users()
{ {
static struct utmpentry *ohead = NULL;
int nusers, utmp; struct utmpentry *ep;
struct utmp buf; int nusers;
if ((utmp = open(_PATH_UTMP, O_RDONLY, 0)) < 0) nusers = getutentries(NULL, &ep);
err(1, "%s", _PATH_UTMP); if (ep != ohead) {
for (nusers = 0; read(utmp, (char *)&buf, sizeof(struct utmp)) > 0;) freeutentries(ep);
if (buf.ut_name[0] != '\0') ohead = ep;
++nusers; }
return (nusers); return nusers;
} }
void void

278
dm/utmpentry.c Normal file
View File

@@ -0,0 +1,278 @@
/* $NetBSD: utmpentry.c,v 1.4 2003/02/12 17:39:36 christos Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: utmpentry.c,v 1.4 2003/02/12 17:39:36 christos Exp $");
#endif
#include <sys/stat.h>
#include <time.h>
#include <string.h>
#include <err.h>
#include <stdlib.h>
#ifdef SUPPORT_UTMP
#include <utmp.h>
#endif
#ifdef SUPPORT_UTMPX
#include <utmpx.h>
#endif
#include "utmpentry.h"
#ifdef SUPPORT_UTMP
static void getentry(struct utmpentry *, struct utmp *);
static time_t utmptime = 0;
#endif
#ifdef SUPPORT_UTMPX
static void getentryx(struct utmpentry *, struct utmpx *);
static time_t utmpxtime = 0;
#endif
#if defined(SUPPORT_UTMPX) || defined(SUPPORT_UTMP)
static int setup(const char *);
static void adjust_size(struct utmpentry *e);
#endif
int maxname = 8, maxline = 8, maxhost = 16;
static int numutmp = 0;
static struct utmpentry *ehead;
#if defined(SUPPORT_UTMPX) || defined(SUPPORT_UTMP)
static void
adjust_size(struct utmpentry *e)
{
int max;
if ((max = strlen(e->name)) > maxname)
maxname = max;
if ((max = strlen(e->line)) > maxline)
maxline = max;
if ((max = strlen(e->host)) > maxhost)
maxhost = max;
}
static int
setup(const char *fname)
{
int what = 3;
struct stat st;
if (fname == NULL) {
#ifdef SUPPORT_UTMPX
setutxent();
#endif
#ifdef SUPPORT_UTMP
setutent();
#endif
} else {
size_t len = strlen(fname);
if (len == 0)
errx(1, "Filename cannot be 0 length.");
what = fname[len - 1] == 'x' ? 1 : 2;
if (what == 1) {
#ifdef SUPPORT_UTMPX
if (utmpxname(fname) == 0)
err(1, "Cannot open `%s'", fname);
#else
errx(1, "utmpx support not compiled in");
#endif
} else {
#ifdef SUPPORT_UTMP
if (utmpname(fname) == 0)
err(1, "Cannot open `%s'", fname);
#else
errx(1, "utmp support not compiled in");
#endif
}
}
#ifdef SUPPORT_UTMPX
if (what & 1) {
(void)stat(fname ? fname : _PATH_UTMPX, &st);
if (st.st_mtime > utmpxtime)
utmpxtime = st.st_mtime;
else
what &= ~1;
}
#endif
#ifdef SUPPORT_UTMP
if (what & 2) {
(void)stat(fname ? fname : _PATH_UTMP, &st);
if (st.st_mtime > utmptime)
utmptime = st.st_mtime;
else
what &= ~2;
}
#endif
return what;
}
#endif
void
freeutentries(struct utmpentry *ep)
{
#ifdef SUPPORT_UTMP
utmptime = 0;
#endif
#ifdef SUPPORT_UTMPX
utmpxtime = 0;
#endif
if (ep == ehead) {
ehead = NULL;
numutmp = 0;
}
while (ep) {
struct utmpentry *sep = ep;
ep = ep->next;
free(sep);
}
}
int
getutentries(const char *fname, struct utmpentry **epp)
{
#ifdef SUPPORT_UTMPX
struct utmpx *utx;
#endif
#ifdef SUPPORT_UTMP
struct utmp *ut;
#endif
#if defined(SUPPORT_UTMP) || defined(SUPPORT_UTMPX)
struct utmpentry *ep;
int what = setup(fname);
struct utmpentry **nextp = &ehead;
if (what == 0) {
*epp = ehead;
return numutmp;
} else {
ehead = NULL;
numutmp = 0;
}
#endif
#ifdef SUPPORT_UTMPX
while ((what & 1) && (utx = getutxent()) != NULL) {
if (fname == NULL && utx->ut_type != USER_PROCESS)
continue;
if ((ep = calloc(1, sizeof(struct utmpentry))) == NULL)
err(1, NULL);
getentryx(ep, utx);
*nextp = ep;
nextp = &(ep->next);
}
#endif
#ifdef SUPPORT_UTMP
while ((what & 2) && (ut = getutent()) != NULL) {
if (fname == NULL && (*ut->ut_name == '\0' ||
*ut->ut_line == '\0'))
continue;
/* Don't process entries that we have utmpx for */
for (ep = ehead; ep != NULL; ep = ep->next) {
if (strncmp(ep->line, ut->ut_line,
sizeof(ut->ut_line)) == 0)
break;
}
if (ep != NULL)
continue;
if ((ep = calloc(1, sizeof(struct utmpentry))) == NULL)
err(1, NULL);
getentry(ep, ut);
*nextp = ep;
nextp = &(ep->next);
}
#endif
numutmp = 0;
#if defined(SUPPORT_UTMP) && defined(SUPPORT_UTMPX)
if (ehead != NULL) {
struct utmpentry *from = ehead, *save;
ehead = NULL;
while (from != NULL) {
for (nextp = &ehead;
(*nextp) && strcmp(from->line, (*nextp)->line) > 0;
nextp = &(*nextp)->next)
continue;
save = from;
from = from->next;
save->next = *nextp;
*nextp = save;
numutmp++;
}
}
*epp = ehead;
return numutmp;
#else
*epp = NULL;
return 0;
#endif
}
#ifdef SUPPORT_UTMP
static void
getentry(struct utmpentry *e, struct utmp *up)
{
(void)strncpy(e->name, up->ut_name, sizeof(up->ut_name));
e->name[sizeof(e->name) - 1] = '\0';
(void)strncpy(e->line, up->ut_line, sizeof(up->ut_line));
e->line[sizeof(e->line) - 1] = '\0';
(void)strncpy(e->host, up->ut_host, sizeof(up->ut_host));
e->name[sizeof(e->host) - 1] = '\0';
e->tv.tv_sec = up->ut_time;
e->tv.tv_usec = 0;
adjust_size(e);
}
#endif
#ifdef SUPPORT_UTMPX
static void
getentryx(struct utmpentry *e, struct utmpx *up)
{
(void)strncpy(e->name, up->ut_name, sizeof(up->ut_name));
e->name[sizeof(e->name) - 1] = '\0';
(void)strncpy(e->line, up->ut_line, sizeof(up->ut_line));
e->line[sizeof(e->line) - 1] = '\0';
(void)strncpy(e->host, up->ut_host, sizeof(up->ut_host));
e->name[sizeof(e->host) - 1] = '\0';
e->tv = up->ut_tv;
adjust_size(e);
}
#endif

50
dm/utmpentry.h Normal file
View File

@@ -0,0 +1,50 @@
/* $NetBSD: utmpentry.h,v 1.2 2003/11/28 23:52:34 wiz Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
struct utmpentry {
char name[65];
char line[65];
char host[257];
struct timeval tv;
struct utmpentry *next;
};
extern int maxname, maxline, maxhost;
int getutentries(const char *, struct utmpentry **);
void freeutentries(struct utmpentry *);

View File

@@ -1,7 +1,7 @@
# exec.libs - details of libraries needed to link bsd-games programs. # exec.libs - details of libraries needed to link bsd-games programs.
# This file is used for automatic makefile generation. # This file is used for automatic makefile generation.
# #
# Copyright (c) 1998, 1999, 2000, 2003 Joseph Samuel Myers. # Copyright (c) 1998, 1999, 2000, 2003, 2004 Joseph Samuel Myers.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@@ -35,6 +35,7 @@ boggle/boggle/boggle $(NCURSES_LIB)
caesar -lm caesar -lm
canfield/canfield/canfield $(NCURSES_LIB) canfield/canfield/canfield $(NCURSES_LIB)
cribbage $(NCURSES_LIB) cribbage $(NCURSES_LIB)
dab $(NCURSES_LIB)
factor $(OPENSSL_LIB) factor $(OPENSSL_LIB)
gomoku $(NCURSES_LIB) gomoku $(NCURSES_LIB)
hack $(NCURSES_LIB) hack $(NCURSES_LIB)

View File

@@ -1,7 +1,7 @@
# exec.objs - details of objects that go into bsd-games programs. # exec.objs - details of objects that go into bsd-games programs.
# This file is used for automatic makefile generation. # This file is used for automatic makefile generation.
# #
# Copyright (c) 1998, 1999, 2000, 2001, 2003 Joseph Samuel Myers. # Copyright (c) 1998, 1999, 2000, 2001, 2003, 2004 Joseph Samuel Myers.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@@ -30,7 +30,7 @@
adventure crc.o data.o done.o init.o io.o main.o save.o subr.o \ adventure crc.o data.o done.o init.o io.o main.o save.o subr.o \
vocab.o wizard.o vocab.o wizard.o
adventure/setup setup.o adventure/setup setup.o
arithmetic arithmetic.o arithmetic arithmetic.o lib/getprogname.o
atc extern.o grammar.o graphics.o input.o lex.o list.o \ atc extern.o grammar.o graphics.o input.o lex.o list.o \
log.o main.o tunable.o update.o log.o main.o tunable.o update.o
backgammon/backgammon/backgammon extra.o main.o move.o text.o \ backgammon/backgammon/backgammon extra.o main.o move.o text.o \
@@ -59,10 +59,12 @@ caesar caesar.o
canfield/canfield/canfield canfield.o canfield/canfield/canfield canfield.o
canfield/cfscores/cfscores cfscores.o canfield/cfscores/cfscores cfscores.o
cribbage cards.o crib.o extern.o instr.o io.o score.o support.o cribbage cards.o crib.o extern.o instr.o io.o score.o support.o
dm dm.o lib/getloadavg.o dab algor.o board.o box.o gamescreen.o human.o main.o \
player.o random.o ttyscrn.o
dm dm.o utmpentry.o lib/getloadavg.o
factor factor.o primes/pr_tbl.o factor factor.o primes/pr_tbl.o
fish fish.o fish fish.o
fortune/fortune/fortune fortune.o fortune/fortune/fortune fortune.o lib/getprogname.o
fortune/strfile/strfile strfile.o fortune/strfile/strfile strfile.o
fortune/unstr/unstr unstr.o fortune/unstr/unstr unstr.o
gomoku bdinit.o bdisp.o main.o makemove.o pickmove.o stoc.o gomoku bdinit.o bdisp.o main.o makemove.o pickmove.o stoc.o

View File

@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.10 2002/09/19 03:15:39 lukem Exp $ # $NetBSD: Makefile,v 1.11 2004/02/08 13:16:25 jsm Exp $
# @(#)Makefile 8.1 (Berkeley) 5/31/93 # @(#)Makefile 8.1 (Berkeley) 5/31/93
# For MKCRYPTO # For MKCRYPTO
@@ -17,7 +17,6 @@ DPADD+= ${LIBCRYPTO}
.endif .endif
MAN= factor.6 MAN= factor.6
MLINKS+=factor.6 primes.6
.PATH: ${PRIMES} .PATH: ${PRIMES}
.include <bsd.prog.mk> .include <bsd.prog.mk>

View File

@@ -1,4 +1,4 @@
.\" $NetBSD: factor.6,v 1.8 2003/08/07 09:37:12 agc Exp $ .\" $NetBSD: factor.6,v 1.9 2004/02/08 13:16:25 jsm Exp $
.\" .\"
.\" Copyright (c) 1989, 1993 .\" Copyright (c) 1989, 1993
.\" The Regents of the University of California. All rights reserved. .\" The Regents of the University of California. All rights reserved.
@@ -37,54 +37,45 @@
.\" .\"
.\" chongo <for a good prime call: 391581 * 2^216193 - 1> /\oo/\ .\" chongo <for a good prime call: 391581 * 2^216193 - 1> /\oo/\
.\" .\"
.Dd May 31, 1993 .Dd February 8, 2004
.Dt PRIMES 6 .Dt FACTOR 6
.Os .Os
.Sh NAME .Sh NAME
.Nm primes .Nm factor
.Nd generate primes .Nd factor a number
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm .Nm
.Op Ar number ... .Op Ar number ...
.br
.Nm primes
.Op Ar start Op Ar stop
.Sh DESCRIPTION .Sh DESCRIPTION
The The
.Nm primes .Nm
utility prints primes in ascending order, one per line, starting at or above utility will factor integers between \-2147483648 and 2147483647 inclusive.
.Ar start When a number is factored, it is printed, followed by a
and continuing until, but not including .Dq \&: ,
.Ar stop . and the list of factors on a single line.
The Factors are listed in ascending order, and are preceded by a space.
.Ar start If a factor divides a value more than once, it will be printed more than once.
value must be at least 0 and not greater than
.Ar stop .
The
.Ar stop
value must not be greater than 4294967295.
The default value of
.Ar stop
is 4294967295.
.Pp .Pp
When the When
.Nm primes .Nm
utility is invoked with no arguments, is invoked with one or more arguments, each argument will be factored.
.Ar start .Pp
is read from standard input. When
.Ar stop .Nm
is taken to be 4294967295. is invoked with no arguments,
The .Nm
.Ar start reads numbers, one per line, from standard input, until end of file or error.
value may be preceded by a single +. Leading white-space and empty lines are ignored.
The Numbers may be preceded by a single - or +.
.Ar start Numbers are terminated by a non-digit character (such as a newline).
value is terminated by a non-digit character (such as a newline). After a number is read, it is factored.
The input line must not be longer than 255 characters. Input lines must not be longer than 255 characters.
.Sh DIAGNOSTICS .Sh DIAGNOSTICS
Out of range or invalid input results in Out of range or invalid input results in
.Sq ouch an appropriate error message
being written to standard error. being written to standard error.
.Sh BUGS .Sh BUGS
.Nm primes .Nm
won't get you a world record. cannot handle the
.Dq 10 most wanted
factor list.

View File

@@ -1,4 +1,4 @@
/* $NetBSD: factor.c,v 1.14 2003/08/07 09:37:12 agc Exp $ */ /* $NetBSD: factor.c,v 1.15 2004/02/08 11:47:36 jsm Exp $ */
/* /*
* Copyright (c) 1989, 1993 * Copyright (c) 1989, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)factor.c 8.4 (Berkeley) 5/4/95"; static char sccsid[] = "@(#)factor.c 8.4 (Berkeley) 5/4/95";
#else #else
__RCSID("$NetBSD: factor.c,v 1.14 2003/08/07 09:37:12 agc Exp $"); __RCSID("$NetBSD: factor.c,v 1.15 2004/02/08 11:47:36 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@@ -231,7 +231,9 @@ pr_fact(BIGNUM *val)
bnfact = BN_new(); bnfact = BN_new();
BN_set_word(bnfact, *(fact - 1)); BN_set_word(bnfact, *(fact - 1));
BN_sqr(bnfact, bnfact, ctx); BN_sqr(bnfact, bnfact, ctx);
if (BN_cmp(bnfact, val) > 0) { if (BN_cmp(bnfact, val) > 0
|| BN_is_prime(val, PRIME_CHECKS, NULL, NULL,
NULL) == 1) {
putchar(' '); putchar(' ');
BN_print_dec_fp(stdout, val); BN_print_dec_fp(stdout, val);
} else } else
@@ -280,23 +282,29 @@ usage(void)
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
/* pollard rho, algorithm from Jim Gillogly, May 2000 */ /* pollard p-1, algorithm from Jim Gillogly, May 2000 */
void void
pollard_pminus1(BIGNUM *val) pollard_pminus1(BIGNUM *val)
{ {
BIGNUM *base, *num, *i, *x; BIGNUM *base, *rbase, *num, *i, *x;
base = BN_new(); base = BN_new();
rbase = BN_new();
num = BN_new(); num = BN_new();
i = BN_new(); i = BN_new();
x = BN_new(); x = BN_new();
BN_set_word(rbase, 1);
newbase:
BN_add_word(rbase, 1);
BN_set_word(i, 2); BN_set_word(i, 2);
BN_set_word(base, 2); BN_copy(base, rbase);
for (;;) { for (;;) {
BN_mod_exp(base, base, i, val, ctx); BN_mod_exp(base, base, i, val, ctx);
if (BN_is_one(base))
goto newbase;
BN_copy(x, base); BN_copy(x, base);
BN_sub_word(x, 1); BN_sub_word(x, 1);

View File

@@ -1,4 +1,4 @@
/* $NetBSD: fish.c,v 1.14 2003/08/07 09:37:13 agc Exp $ */ /* $NetBSD: fish.c,v 1.15 2004/01/27 20:30:29 jsm Exp $ */
/*- /*-
* Copyright (c) 1990, 1993 * Copyright (c) 1990, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)fish.c 8.1 (Berkeley) 5/31/93"; static char sccsid[] = "@(#)fish.c 8.1 (Berkeley) 5/31/93";
#else #else
__RCSID("$NetBSD: fish.c,v 1.14 2003/08/07 09:37:13 agc Exp $"); __RCSID("$NetBSD: fish.c,v 1.15 2004/01/27 20:30:29 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@@ -78,22 +78,22 @@ int asked[RANKS], comphand[RANKS], deck[TOTCARDS];
int userasked[RANKS], userhand[RANKS]; int userasked[RANKS], userhand[RANKS];
int curcard = TOTCARDS; int curcard = TOTCARDS;
void chkwinner __P((int, const int *)); void chkwinner(int, const int *);
int compmove __P((void)); int compmove(void);
int countbooks __P((const int *)); int countbooks(const int *);
int countcards __P((const int *)); int countcards(const int *);
int drawcard __P((int, int *)); int drawcard(int, int *);
int gofish __P((int, int, int *)); int gofish(int, int, int *);
void goodmove __P((int, int, int *, int *)); void goodmove(int, int, int *, int *);
void init __P((void)); void init(void);
void instructions __P((void)); void instructions(void);
int main __P((int, char *[])); int main(int, char *[]);
int nrandom __P((int)); int nrandom(int);
void printhand __P((const int *)); void printhand(const int *);
void printplayer __P((int)); void printplayer(int);
int promove __P((void)); int promove(void);
void usage __P((void)) __attribute__((__noreturn__)); void usage(void) __attribute__((__noreturn__));
int usermove __P((void)); int usermove(void);
int int
main(argc, argv) main(argc, argv)

View File

@@ -1,22 +0,0 @@
README.linux for fortune
========================
Here is one port of fortune for Linux. Alternatively, you may wish to
use the enhanced version available from
<ftp://sunsite.unc.edu/pub/Linux/games/amusements/fortune-mod.tar.gz>.
unstr is not installed by default. If you want to install it,
uncomment the relevant lines (installation command and definition of
fortune_unstr_DIRS) in unstr/Makefrag before doing the top level `make
install'.
Offensive fortunes:
The "offensive" fortunes (not very offensive) are disabled by default.
If you want the "offensive" fortunes, answer 'y' to the question when
running configure.
Have fun!
Andy
[ This README.linux subsequently extensively modified - JSM ]

View File

@@ -10919,7 +10919,7 @@ of chemical pollutant in their drinking water. That is why I pledge to
do all that I can to protect the environment of this great nation of do all that I can to protect the environment of this great nation of
ours, and put prayer back in the schools, where it belongs. What we ours, and put prayer back in the schools, where it belongs. What we
need is jobs, not empty promises. I realize I'm risking my political need is jobs, not empty promises. I realize I'm risking my political
career be being so outspoken on a sensitive issue such as the MX, but career by being so outspoken on a sensitive issue such as the MX, but
that's just the kind of straight-talking honest person I am, and I that's just the kind of straight-talking honest person I am, and I
can't help it. can't help it.
-- Dave Barry, "On Presidential Politics" -- Dave Barry, "On Presidential Politics"

View File

@@ -674,7 +674,7 @@ days old. He heard that a foal and his mummy are soon parted.
long-distance caw. long-distance caw.
A musical reviewer admitted he always praised the first show of a A musical reviewer admitted he always praised the first show of a
new theatrical season. "Who am I to stone the first cast?" new theatrical season. "Who am I to stone the first cast?"
A hard-luck actor who appeared in one coloossal disaster after another A hard-luck actor who appeared in one colossal disaster after another
finally got a break, a broken leg to be exact. Someone pointed out that it's finally got a break, a broken leg to be exact. Someone pointed out that it's
the first time the poor fellow's been in the same cast for more than a week. the first time the poor fellow's been in the same cast for more than a week.
% %
@@ -1032,7 +1032,7 @@ with social conventions?"
% %
A ranger was walking through the forest and encountered a hunter A ranger was walking through the forest and encountered a hunter
carrying a shotgun and a dead loon. "What in the world do you think you're carrying a shotgun and a dead loon. "What in the world do you think you're
doing? Don't you know that the loon is on the endagered species list?" doing? Don't you know that the loon is on the endangered species list?"
Instead of answering, the hunter showed the ranger his game bag, Instead of answering, the hunter showed the ranger his game bag,
which contained twelve more loons. which contained twelve more loons.
"Why would you shoot loons?", the ranger asked. "Why would you shoot loons?", the ranger asked.
@@ -1110,7 +1110,7 @@ secrets... so naturally British electronics leak smoke.
-- Jack Banton, PCC Automotive Electrical School -- Jack Banton, PCC Automotive Electrical School
% %
A shy teenage boy finally worked up the nerve to give a gift to A shy teenage boy finally worked up the nerve to give a gift to
Maddona, a young puppy. It hitched its waggin' to a star. Madonna, a young puppy. It hitched its waggin' to a star.
A girl spent a couple hours on the phone talking to her two best A girl spent a couple hours on the phone talking to her two best
friends, Maureen Jones, and Maureen Brown. When asked by her father why she friends, Maureen Jones, and Maureen Brown. When asked by her father why she
had been on the phone so long, she responded "I heard a funny story today had been on the phone so long, she responded "I heard a funny story today

View File

@@ -1,6 +1,6 @@
# Makefrag - makefile fragment for fortune/fortune # Makefrag - makefile fragment for fortune/fortune
# #
# Copyright (c) 1997, 1998 Joseph Samuel Myers. # Copyright (c) 1997, 1998, 2004 Joseph Samuel Myers.
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@@ -26,7 +26,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE. # SUCH DAMAGE.
fortune_fortune_DEFS := -DHAVE_REGCOMP fortune_fortune_DEFS := $(GETPROGNAME_DEFS) -DHAVE_REGCOMP
fortune_fortune_DIRS := $(GAMESDIR) $(MAN6DIR) fortune_fortune_DIRS := $(GAMESDIR) $(MAN6DIR)
fortune_fortune_INCS := -Ifortune/strfile fortune_fortune_INCS := -Ifortune/strfile

View File

@@ -161,7 +161,7 @@ fortune 50% funny 50% not
.Ed .Ed
.Sh FILES .Sh FILES
.Bl -tag -width Pa -compact .Bl -tag -width Pa -compact
.It Pa @sharedir@/fortunes .It Pa @fortune_dir@
.El .El
.Sh SEE ALSO .Sh SEE ALSO
.Xr regex 3 .Xr regex 3

View File

@@ -1,4 +1,4 @@
/* $NetBSD: fortune.c,v 1.39 2003/08/07 09:37:14 agc Exp $ */ /* $NetBSD: fortune.c,v 1.43 2004/01/27 20:30:29 jsm Exp $ */
/*- /*-
* Copyright (c) 1986, 1993 * Copyright (c) 1986, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1986, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)fortune.c 8.1 (Berkeley) 5/31/93"; static char sccsid[] = "@(#)fortune.c 8.1 (Berkeley) 5/31/93";
#else #else
__RCSID("$NetBSD: fortune.c,v 1.39 2003/08/07 09:37:14 agc Exp $"); __RCSID("$NetBSD: fortune.c,v 1.43 2004/01/27 20:30:29 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@@ -126,46 +126,46 @@ FILEDESC *Fortfile; /* Fortune file to use */
STRFILE Noprob_tbl; /* sum of data for all no prob files */ STRFILE Noprob_tbl; /* sum of data for all no prob files */
int add_dir __P((FILEDESC *)); int add_dir(FILEDESC *);
int add_file __P((int, int add_file(int,
const char *, const char *, FILEDESC **, FILEDESC **, FILEDESC *)); const char *, const char *, FILEDESC **, FILEDESC **, FILEDESC *);
void all_forts __P((FILEDESC *, const char *)); void all_forts(FILEDESC *, const char *);
char *copy __P((const char *, u_int)); char *copy(const char *, u_int);
void rot13 __P((char *line, int len)); void rot13(char *line, int len);
void display __P((FILEDESC *)); void display(FILEDESC *);
void do_free __P((void *)); void do_free(void *);
void *do_malloc __P((u_int)); void *do_malloc(u_int);
int form_file_list __P((char **, int)); int form_file_list(char **, int);
int fortlen __P((void)); int fortlen(void);
void get_fort __P((void)); void get_fort(void);
void get_pos __P((FILEDESC *)); void get_pos(FILEDESC *);
void get_tbl __P((FILEDESC *)); void get_tbl(FILEDESC *);
void getargs __P((int, char *[])); void getargs(int, char *[]);
void init_prob __P((void)); void init_prob(void);
int is_dir __P((const char *)); int is_dir(const char *);
int is_fortfile __P((const char *, char **, char **, int)); int is_fortfile(const char *, char **, char **, int);
int is_off_name __P((const char *)); int is_off_name(const char *);
int main __P((int, char *[])); int main(int, char *[]);
int max __P((int, int)); int max(int, int);
FILEDESC * FILEDESC *
new_fp __P((void)); new_fp(void);
char *off_name __P((const char *)); char *off_name(const char *);
void open_dat __P((FILEDESC *)); void open_dat(FILEDESC *);
void open_fp __P((FILEDESC *)); void open_fp(FILEDESC *);
FILEDESC * FILEDESC *
pick_child __P((FILEDESC *)); pick_child(FILEDESC *);
void print_file_list __P((void)); void print_file_list(void);
void print_list __P((FILEDESC *, int)); void print_list(FILEDESC *, int);
void sum_noprobs __P((FILEDESC *)); void sum_noprobs(FILEDESC *);
void sum_tbl __P((STRFILE *, STRFILE *)); void sum_tbl(STRFILE *, STRFILE *);
void usage __P((void)) __attribute__((__noreturn__)); void usage(void) __attribute__((__noreturn__));
void zero_tbl __P((STRFILE *)); void zero_tbl(STRFILE *);
#ifndef NO_REGEX #ifndef NO_REGEX
char *conv_pat __P((char *)); char *conv_pat(char *);
int find_matches __P((void)); int find_matches(void);
void matches_in_list __P((FILEDESC *)); void matches_in_list(FILEDESC *);
int maxlen_in_list __P((FILEDESC *)); int maxlen_in_list(FILEDESC *);
#endif #endif
#ifndef NO_REGEX #ifndef NO_REGEX
@@ -210,14 +210,12 @@ char Re_error[1024];
# endif # endif
#endif #endif
#if (defined(__linux__) && !defined(__GLIBC__)) || (defined(__GLIBC__) && !defined(_DIRENT_HAVE_D_NAMLEN)) #if (defined(__linux__) && !defined(__GLIBC__)) || (defined(__GLIBC__) && !defined(_DIRENT_HAVE_D_NAMLEN)) || defined(__CYGWIN__)
#define NAMLEN(d) (strlen((d)->d_name)) #define NAMLEN(d) (strlen((d)->d_name))
#else #else
#define NAMLEN(d) ((d)->d_namlen) #define NAMLEN(d) ((d)->d_namlen)
#endif #endif
extern char *__progname;
int int
main(ac, av) main(ac, av)
int ac; int ac;
@@ -1403,7 +1401,8 @@ matches_in_list(list)
void void
usage() usage()
{ {
(void) fprintf(stderr, "Usage: %s [-ae", __progname);
(void) fprintf(stderr, "Usage: %s [-ae", getprogname());
#ifdef DEBUG #ifdef DEBUG
(void) fprintf(stderr, "D"); (void) fprintf(stderr, "D");
#endif /* DEBUG */ #endif /* DEBUG */

View File

@@ -1,4 +1,4 @@
/* $NetBSD: unstr.c,v 1.8 2003/08/07 09:37:15 agc Exp $ */ /* $NetBSD: unstr.c,v 1.11 2004/02/08 22:23:50 jsm Exp $ */
/*- /*-
* Copyright (c) 1991, 1993 * Copyright (c) 1991, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\
#if 0 #if 0
static char sccsid[] = "@(#)unstr.c 8.1 (Berkeley) 5/31/93"; static char sccsid[] = "@(#)unstr.c 8.1 (Berkeley) 5/31/93";
#else #else
__RCSID("$NetBSD: unstr.c,v 1.8 2003/08/07 09:37:15 agc Exp $"); __RCSID("$NetBSD: unstr.c,v 1.11 2004/02/08 22:23:50 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@@ -79,9 +79,9 @@ char *Infile, /* name of input file */
FILE *Inf, *Dataf; FILE *Inf, *Dataf;
void getargs __P((char *[])); void getargs(char *[]);
int main __P((int, char *[])); int main(int, char *[]);
void order_unstr __P((STRFILE *)); void order_unstr(STRFILE *);
/* ARGSUSED */ /* ARGSUSED */
int int

View File

@@ -1,4 +1,4 @@
/* $NetBSD: gomoku.h,v 1.8 2003/08/07 09:37:17 agc Exp $ */ /* $NetBSD: gomoku.h,v 1.10 2004/01/27 20:30:29 jsm Exp $ */
/* /*
* Copyright (c) 1994 * Copyright (c) 1994
@@ -35,10 +35,8 @@
*/ */
#include <sys/types.h> #include <sys/types.h>
#include <sys/endian.h>
#include <stdio.h> #include <stdio.h>
#ifdef __linux__
#include <endian.h>
#endif
/* board dimensions */ /* board dimensions */
#define BSZ 19 #define BSZ 19
@@ -263,42 +261,42 @@ extern int debug;
#define ASSERT(x) #define ASSERT(x)
void bdinit __P((struct spotstr *)); void bdinit(struct spotstr *);
void init_overlap __P((void)); void init_overlap(void);
int getline __P((char *, int)); int getline(char *, int);
void ask __P((const char *)); void ask(const char *);
void dislog __P((const char *)); void dislog(const char *);
void bdump __P((FILE *)); void bdump(FILE *);
void bdisp __P((void)); void bdisp(void);
void bdisp_init __P((void)); void bdisp_init(void);
void cursfini __P((void)); void cursfini(void);
void cursinit __P((void)); void cursinit(void);
void bdwho __P((int)); void bdwho(int);
void panic __P((const char *)) __attribute__((__noreturn__)); void panic(const char *) __attribute__((__noreturn__));
void glog __P((const char *)); void glog(const char *);
void dlog __P((const char *)); void dlog(const char *);
void quit __P((void)) __attribute__((__noreturn__)); void quit(void) __attribute__((__noreturn__));
void quitsig __P((int)) __attribute__((__noreturn__)); void quitsig(int) __attribute__((__noreturn__));
void whatsup __P((int)); void whatsup(int);
int readinput __P((FILE *)); int readinput(FILE *);
const char *stoc __P((int)); const char *stoc(int);
int lton __P((int)); int lton(int);
int ctos __P((const char *)); int ctos(const char *);
void update_overlap __P((struct spotstr *)); void update_overlap(struct spotstr *);
int makemove __P((int, int)); int makemove(int, int);
int list_eq __P((struct combostr **, struct combostr **, int)); int list_eq(struct combostr **, struct combostr **, int);
void clearcombo __P((struct combostr *, int)); void clearcombo(struct combostr *, int);
void makeempty __P((struct combostr *)); void makeempty(struct combostr *);
void appendcombo __P((struct combostr *, int)); void appendcombo(struct combostr *, int);
void updatecombo __P((struct combostr *, int)); void updatecombo(struct combostr *, int);
void markcombo __P((struct combostr *)); void markcombo(struct combostr *);
void printcombo __P((struct combostr *, char *)); void printcombo(struct combostr *, char *);
void makecombo __P((struct combostr *, struct spotstr *, int, int)); void makecombo(struct combostr *, struct spotstr *, int, int);
void makecombo2 __P((struct combostr *, struct spotstr *, int, int)); void makecombo2(struct combostr *, struct spotstr *, int, int);
int sortcombo __P((struct combostr **, struct combostr **, struct combostr *)); int sortcombo(struct combostr **, struct combostr **, struct combostr *);
int checkframes __P((struct combostr *, struct combostr *, struct spotstr *, int checkframes(struct combostr *, struct combostr *, struct spotstr *,
int, struct ovlp_info *)); int, struct ovlp_info *);
void addframes __P((int)); void addframes(int);
void scanframes __P((int)); void scanframes(int);
int better __P((const struct spotstr *, const struct spotstr *, int)); int better(const struct spotstr *, const struct spotstr *, int);
int pickmove __P((int)); int pickmove(int);

View File

@@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.11 2003/08/07 09:37:17 agc Exp $ */ /* $NetBSD: main.c,v 1.12 2004/01/27 20:30:29 jsm Exp $ */
/* /*
* Copyright (c) 1994 * Copyright (c) 1994
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1994\n\
#if 0 #if 0
static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 5/4/95"; static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 5/4/95";
#else #else
__RCSID("$NetBSD: main.c,v 1.11 2003/08/07 09:37:17 agc Exp $"); __RCSID("$NetBSD: main.c,v 1.12 2004/01/27 20:30:29 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@@ -79,7 +79,7 @@ int movelog[BSZ * BSZ]; /* log of all the moves */
int movenum; /* current move number */ int movenum; /* current move number */
const char *plyr[2]; /* who's who */ const char *plyr[2]; /* who's who */
int main __P((int, char *[])); int main(int, char *[]);
int int
main(argc, argv) main(argc, argv)

View File

@@ -1,4 +1,4 @@
/* $NetBSD: pickmove.c,v 1.10 2003/08/07 09:37:17 agc Exp $ */ /* $NetBSD: pickmove.c,v 1.11 2004/01/27 20:26:20 jsm Exp $ */
/* /*
* Copyright (c) 1994 * Copyright (c) 1994
@@ -37,7 +37,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)pickmove.c 8.2 (Berkeley) 5/3/95"; static char sccsid[] = "@(#)pickmove.c 8.2 (Berkeley) 5/3/95";
#else #else
__RCSID("$NetBSD: pickmove.c,v 1.10 2003/08/07 09:37:17 agc Exp $"); __RCSID("$NetBSD: pickmove.c,v 1.11 2004/01/27 20:26:20 jsm Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */

View File

@@ -1,4 +1,4 @@
/* $NetBSD: def.func_tab.h,v 1.6 2003/04/02 18:36:34 jsm Exp $ */ /* $NetBSD: def.func_tab.h,v 1.7 2004/01/27 20:30:29 jsm Exp $ */
/* /*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@@ -65,14 +65,14 @@
#define _DEF_FUNC_TAB_H_ #define _DEF_FUNC_TAB_H_
struct func_tab { struct func_tab {
char f_char; char f_char;
int (*f_funct) __P((void)); int (*f_funct)(void);
}; };
extern const struct func_tab cmdlist[]; extern const struct func_tab cmdlist[];
struct ext_func_tab { struct ext_func_tab {
const char *ef_txt; const char *ef_txt;
int (*ef_funct) __P((void)); int (*ef_funct)(void);
}; };
extern const struct ext_func_tab extcmdlist[]; extern const struct ext_func_tab extcmdlist[];

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
/* $NetBSD: hack.apply.c,v 1.7 2003/04/02 18:36:35 jsm Exp $ */ /* $NetBSD: hack.apply.c,v 1.8 2004/01/27 20:30:29 jsm Exp $ */
/* /*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@@ -63,7 +63,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.apply.c,v 1.7 2003/04/02 18:36:35 jsm Exp $"); __RCSID("$NetBSD: hack.apply.c,v 1.8 2004/01/27 20:30:29 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include "hack.h" #include "hack.h"
@@ -71,16 +71,16 @@ __RCSID("$NetBSD: hack.apply.c,v 1.7 2003/04/02 18:36:35 jsm Exp $");
#include "def.edog.h" #include "def.edog.h"
#include "def.mkroom.h" #include "def.mkroom.h"
static void use_camera __P((struct obj *)); static void use_camera(struct obj *);
static int in_ice_box __P((struct obj *)); static int in_ice_box(struct obj *);
static int ck_ice_box __P((struct obj *)); static int ck_ice_box(struct obj *);
static int out_ice_box __P((struct obj *)); static int out_ice_box(struct obj *);
static void use_ice_box __P((struct obj *)); static void use_ice_box(struct obj *);
static struct monst *bchit __P((int, int , int , int)); static struct monst *bchit(int, int , int , int);
static void use_whistle __P((struct obj *)); static void use_whistle(struct obj *);
static void use_magic_whistle __P((struct obj *)); static void use_magic_whistle(struct obj *);
static int dig __P((void)); static int dig(void);
static int use_pick_axe __P((struct obj *)); static int use_pick_axe(struct obj *);
int int
doapply() doapply()

View File

@@ -1,4 +1,4 @@
/* $NetBSD: hack.do.c,v 1.6 2003/04/02 18:36:35 jsm Exp $ */ /* $NetBSD: hack.do.c,v 1.7 2004/01/27 20:30:29 jsm Exp $ */
/* /*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@@ -63,7 +63,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.do.c,v 1.6 2003/04/02 18:36:35 jsm Exp $"); __RCSID("$NetBSD: hack.do.c,v 1.7 2004/01/27 20:30:29 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
/* Contains code for 'd', 'D' (drop), '>', '<' (up, down) and 't' (throw) */ /* Contains code for 'd', 'D' (drop), '>', '<' (up, down) and 't' (throw) */
@@ -75,7 +75,7 @@ __RCSID("$NetBSD: hack.do.c,v 1.6 2003/04/02 18:36:35 jsm Exp $");
#include <stdlib.h> #include <stdlib.h>
static int drop __P((struct obj *)); static int drop(struct obj *);
int int
dodrop() dodrop()
@@ -406,8 +406,8 @@ dothrow()
mon = bhit(u.dx, u.dy, (obj->otyp == ICE_BOX) ? 1 : mon = bhit(u.dx, u.dy, (obj->otyp == ICE_BOX) ? 1 :
(!Punished || obj != uball) ? 8 : !u.ustuck ? 5 : 1, (!Punished || obj != uball) ? 8 : !u.ustuck ? 5 : 1,
obj->olet, obj->olet,
(void (*) __P((struct monst *, struct obj *))) 0, (void (*)(struct monst *, struct obj *)) 0,
(int (*) __P((struct obj *, struct obj *))) 0, obj); (int (*)(struct obj *, struct obj *)) 0, obj);
} }
if (mon) { if (mon) {
/* awake monster if sleeping */ /* awake monster if sleeping */

View File

@@ -1,4 +1,4 @@
/* $NetBSD: hack.h,v 1.9 2003/04/02 18:36:37 jsm Exp $ */ /* $NetBSD: hack.h,v 1.10 2004/01/27 20:30:29 jsm Exp $ */
/* /*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@@ -110,7 +110,7 @@ struct prop {
#define RIGHT_SIDE RIGHT_RING #define RIGHT_SIDE RIGHT_RING
#define BOTH_SIDES (LEFT_SIDE | RIGHT_SIDE) #define BOTH_SIDES (LEFT_SIDE | RIGHT_SIDE)
long p_flgs; long p_flgs;
void (*p_tofn) __P((void)); /* called after timeout */ void (*p_tofn)(void); /* called after timeout */
}; };
struct you { struct you {
@@ -212,8 +212,8 @@ extern char sdir[]; /* defined in hack.c */
extern const char shtypes[]; /* = "=/)%?!["; 8 types: 7 specialized, 1 mixed */ extern const char shtypes[]; /* = "=/)%?!["; 8 types: 7 specialized, 1 mixed */
extern const char vowels[]; extern const char vowels[];
extern coord bhitpos; /* place where thrown weapon falls to the ground */ extern coord bhitpos; /* place where thrown weapon falls to the ground */
extern int (*afternmv) __P((void)); extern int (*afternmv)(void);
extern int (*occupation) __P((void)); extern int (*occupation)(void);
extern int CO, LI; /* usually COLNO and ROWNO+2 */ extern int CO, LI; /* usually COLNO and ROWNO+2 */
extern int bases[]; extern int bases[];
extern int doorindex; extern int doorindex;

View File

@@ -1,4 +1,4 @@
/* $NetBSD: hack.invent.c,v 1.8 2003/04/02 18:36:37 jsm Exp $ */ /* $NetBSD: hack.invent.c,v 1.9 2004/01/27 20:30:29 jsm Exp $ */
/* /*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@@ -63,7 +63,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.invent.c,v 1.8 2003/04/02 18:36:37 jsm Exp $"); __RCSID("$NetBSD: hack.invent.c,v 1.9 2004/01/27 20:30:29 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include <stdlib.h> #include <stdlib.h>
@@ -78,8 +78,8 @@ __RCSID("$NetBSD: hack.invent.c,v 1.8 2003/04/02 18:36:37 jsm Exp $");
static int lastinvnr = 51; /* 0 ... 51 */ static int lastinvnr = 51; /* 0 ... 51 */
static void assigninvlet __P((struct obj *)); static void assigninvlet(struct obj *);
static char *xprname __P((struct obj *, char)); static char *xprname(struct obj *, char);
static void static void
assigninvlet(otmp) assigninvlet(otmp)
@@ -566,7 +566,7 @@ ckunpaid(otmp)
int int
ggetobj(word, fn, max) ggetobj(word, fn, max)
const char *word; const char *word;
int (*fn) __P((struct obj *)); int (*fn)(struct obj *);
int max; int max;
{ {
char buf[BUFSZ]; char buf[BUFSZ];
@@ -575,8 +575,8 @@ ggetobj(word, fn, max)
int oletct = 0, iletct = 0; int oletct = 0, iletct = 0;
boolean allflag = FALSE; boolean allflag = FALSE;
char olets[20], ilets[20]; char olets[20], ilets[20];
int (*ckfn) __P((struct obj *)) = int (*ckfn)(struct obj *) =
(int (*) __P((struct obj *))) 0; (int (*)(struct obj *)) 0;
xchar allowgold = (u.ugold && !strcmp(word, "drop")) ? 1 : 0; /* BAH */ xchar allowgold = (u.ugold && !strcmp(word, "drop")) ? 1 : 0; /* BAH */
if (!invent && !allowgold) { if (!invent && !allowgold) {
pline("You have nothing to %s.", word); pline("You have nothing to %s.", word);
@@ -652,8 +652,8 @@ askchain(objchn, olets, allflag, fn, ckfn, max)
struct obj *objchn; struct obj *objchn;
char *olets; char *olets;
int allflag; int allflag;
int (*fn) __P((struct obj *)); int (*fn)(struct obj *);
int (*ckfn) __P((struct obj *)); int (*ckfn)(struct obj *);
int max; int max;
{ {
struct obj *otmp, *otmp2; struct obj *otmp, *otmp2;

View File

@@ -1,4 +1,4 @@
/* $NetBSD: hack.main.c,v 1.8 2003/04/02 18:36:37 jsm Exp $ */ /* $NetBSD: hack.main.c,v 1.9 2004/01/27 20:30:29 jsm Exp $ */
/* /*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@@ -63,7 +63,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: hack.main.c,v 1.8 2003/04/02 18:36:37 jsm Exp $"); __RCSID("$NetBSD: hack.main.c,v 1.9 2004/01/27 20:30:29 jsm Exp $");
#endif /* not lint */ #endif /* not lint */
#include <signal.h> #include <signal.h>
@@ -79,8 +79,8 @@ __RCSID("$NetBSD: hack.main.c,v 1.8 2003/04/02 18:36:37 jsm Exp $");
#define gamename "hack" #define gamename "hack"
#endif #endif
int (*afternmv) __P((void)); int (*afternmv)(void);
int (*occupation) __P((void)); int (*occupation)(void);
const char *occtxt; /* defined when occupation != NULL */ const char *occtxt; /* defined when occupation != NULL */
int hackpid; /* current pid */ int hackpid; /* current pid */
@@ -92,8 +92,8 @@ char SAVEF[PL_NSIZ + 11] = "save/"; /* save/99999player */
char *hname; /* name of the game (argv[0] of call) */ char *hname; /* name of the game (argv[0] of call) */
char obuf[BUFSIZ]; /* BUFSIZ is defined in stdio.h */ char obuf[BUFSIZ]; /* BUFSIZ is defined in stdio.h */
int main __P((int, char *[])); int main(int, char *[]);
static void chdirx __P((const char *, boolean)); static void chdirx(const char *, boolean);
int int
main(argc, argv) main(argc, argv)

Some files were not shown because too many files have changed in this diff Show More