diff --git a/COPYING b/COPYING index 3779480..d3baec4 100644 --- a/COPYING +++ b/COPYING @@ -102,11 +102,11 @@ These terms also apply to "hunt/Makeconfig", which is derived from the hunt "Makefile.inc" distributed by NetBSD. The files "backgammon/backgammon/backlocal.h", "countmail/countmail", -"hack/extern.h", "robots/auto.c", "sail/display.h" and -"sail/restart.h" have a similar licence, but copyright is held by the -NetBSD Foundation: +"dm/utmpentry.c", "dm/utmpentry.h", "hack/extern.h", "robots/auto.c", +"sail/display.h", "sail/restart.h" and the game "dab" have a similar +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. 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 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 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 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. 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 file to which you could apply your own copyright). -The files "bsd-games.lsm", "ChangeLog.0", "THANKS", "INSTALL", -"README", "TODO", "boggle/README.linux", "fortune/README.linux", and -"hunt/README.linux" are still significantly derived from files in the -original bsd-games package for Linux by Curt Olson and Andy Tefft. It -is expected that the following terms will apply to these files, and to +The files "bsd-games.lsm", "ChangeLog.0", "THANKS", "INSTALL" and +"README" are still significantly derived from files in the original +bsd-games package for Linux by Curt Olson and Andy Tefft. It 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 to be confirmed with 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. Redistribution and use in source and binary forms, with or without diff --git a/ChangeLog b/ChangeLog index 6c80746..3fb7c1b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,248 @@ +2004-02-13 Joseph S. Myers + + * 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 + + * 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 + + * primes/primes.6: Update from NetBSD CVS. + +2004-02-09 Joseph S. Myers + + * 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 + + * 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 . + + * 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 + + * 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 + + * 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 + + * 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 . + +2004-01-16 Joseph S. Myers + + * wtf/acronyms, wtf/acronyms.comp: Update from NetBSD CVS. + +2004-01-14 Joseph S. Myers + + * wtf/acronyms, wtf/acronyms.comp: Update from NetBSD CVS. + +2004-01-04 Joseph S. Myers + + * 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 + + * 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 * Version 2.15. diff --git a/INSTALL b/INSTALL index a41c332..e09961b 100644 --- a/INSTALL +++ b/INSTALL @@ -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 source directory: to do the latter, move those files and directories 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, 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. +bsd-games-VERSION directory before building. Prerequisites ============= 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 hunt) since they lack the header. @@ -161,13 +159,7 @@ Building and installation this or a later version, and a new one created with the correct permissions. -10. You may wish to do something with the BSD Users' Supplementary - 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 +10. "make distclean" will restore the source directory to the original unpacked state. The automatically generated dependency files include paths to system headers, including those in gcc's internal header directory: if you have changed your compiler or library @@ -180,10 +172,6 @@ Building and installation 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; you may want to volunteer for some of the things in there. diff --git a/Makeconfig.in b/Makeconfig.in index 86efce3..68b25fc 100644 --- a/Makeconfig.in +++ b/Makeconfig.in @@ -1,6 +1,6 @@ # 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. # # Redistribution and use in source and binary forms, with or without @@ -50,6 +50,8 @@ MAN8DIR := @man8dir@ MAN5DIR := @man5dir@ # Constant data (arch-independent) SHAREDIR := @sharedir@ +# Miscellaneous documentation +DOCDIR := @docdir@ # Variable data VARLIBDIR := @varlibdir@ # Directory for hidden games (dm) @@ -83,12 +85,17 @@ HIDE_GAME := @hidegame@ # Compilation details CC := @cc@ +CXX := @cxx@ OPTIMIZE := @optimize_flags@ WARNING := @warning_flags@ +CXX_WARNING := @cxx_warning_flags@ CFLAGS := $(OPTIMIZE) $(WARNING) @other_cflags@ +CXXFLAGS := $(OPTIMIZE) $(CXX_WARNING) @other_cflags@ LDFLAGS := @other_ldflags@ FGETLN_DEFS := @fgetln_defs@ GETLOADAVG_DEFS := @getloadavg_defs@ +STRLCPY_DEFS := @strlcpy_defs@ +GETPROGNAME_DEFS := @getprogname_defs@ NCURSES_LIB := @ncurses_lib@ NCURSES_INCS := @ncurses_includes@ OPENSSL_LIB := @openssl_lib@ diff --git a/Makefile.bsd b/Makefile.bsd index 4089709..9fba00c 100644 --- a/Makefile.bsd +++ b/Makefile.bsd @@ -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 # Missing: ching dungeon warp @@ -6,8 +6,8 @@ # Don't belong: xneko xroach SUBDIR= adventure arithmetic atc backgammon banner battlestar bcd boggle \ - caesar canfield countmail cribbage dm factor fish fortune gomoku hack \ - hangman hunt larn mille monop morse number phantasia pig pom ppt \ + caesar canfield countmail cribbage dab dm factor fish fortune gomoku \ + hack hangman hunt larn mille monop morse number phantasia pig pom ppt \ primes quiz rain random robots rogue sail snake tetris trek wargames \ worm worms wtf wump diff --git a/NEWS b/NEWS index 3caf766..bcf5347 100644 --- a/NEWS +++ b/NEWS @@ -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 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 +; more portability issues remain. + +* Various improvements to morse from OpenBSD. + +* Some bugs fixed, some backlogged. + Version 2.15 (2003-12-18) ============ diff --git a/PACKAGING b/PACKAGING index 5bd4ce4..67ce5c6 100644 --- a/PACKAGING +++ b/PACKAGING @@ -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. You may wish to include auxiliary documentation for users, such as the -BSD Users' Supplementary Documents for trek and rogue -(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. +AUTHORS and THANKS files and the year 2000 statement YEAR2000. Assuming you distribute source for your package (I do not believe any of the games have licences requiring this), and separate your patches diff --git a/README b/README index 161e5d1..17165f4 100644 --- a/README +++ b/README @@ -21,8 +21,7 @@ The games are mostly not enhanced from the NetBSD versions, but many bugs are fixed. For installation instructions and details of prerequisites, see the -file "INSTALL". Some games have "README.linux" files you may wish to -read. +file "INSTALL". The statement of year 2000 issues associated with bsd-games and 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 countmail: tell you how much new mail you have cribbage: cribbage +dab: dots and boxes dm: dungeon master, regulates games playing factor: factor a number 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 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 +. +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 jsm@polyomino.org.uk diff --git a/THANKS b/THANKS index 10e033c..5ca755b 100644 --- a/THANKS +++ b/THANKS @@ -12,6 +12,10 @@ in this list. For recent work (since 1.3), thanks to: +David A Bagley + + For work towards portability to Cygwin. + Joey Hess For the Debian patches, which covered what was needed to make the games diff --git a/TODO b/TODO index 2c639fc..7013fda 100644 --- a/TODO +++ b/TODO @@ -47,8 +47,6 @@ those. The issues listed there are not included in this list. has some; Paul Janzen is adding FreeBSD changes to 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 variables are substituted from the configure script into the Makefiles. diff --git a/adventure/extern.h b/adventure/extern.h index 8505881..b9950b5 100644 --- a/adventure/extern.h +++ b/adventure/extern.h @@ -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. @@ -32,99 +32,99 @@ #include /* crc.c */ -void crc_start __P((void)); -unsigned long crc __P((const char *, int)); +void crc_start(void); +unsigned long crc(const char *, int); /* done.c */ -int score __P((void)); -void done __P((int)) __attribute__((__noreturn__)); -void die __P((int)); +int score(void); +void done(int) __attribute__((__noreturn__)); +void die(int); /* init.c */ -void init __P((void)); -char *decr __P((int, int, int, int, int)); -void linkdata __P((void)); -void trapdel __P((int)); -void startup __P((void)); +void init(void); +char *decr(int, int, int, int, int); +void linkdata(void); +void trapdel(int); +void startup(void); /* io.c */ -void getin __P((char **, char **)); -int yes __P((int, int, int)); -int yesm __P((int, int, int)); -int next __P((void)); -void rdata __P((void)); -int rnum __P((void)); -void rdesc __P((int)); -void rtrav __P((void)); +void getin(char **, char **); +int yes(int, int, int); +int yesm(int, int, int); +int next(void); +void rdata(void); +int rnum(void); +void rdesc(int); +void rtrav(void); #ifdef DEBUG -void twrite __P((int)); +void twrite(int); #endif -void rvoc __P((void)); -void rlocs __P((void)); -void rdflt __P((void)); -void rliq __P((void)); -void rhints __P((void)); -void rspeak __P((int)); -void mspeak __P((int)); +void rvoc(void); +void rlocs(void); +void rdflt(void); +void rliq(void); +void rhints(void); +void rspeak(int); +void mspeak(int); struct text; -void speak __P((const struct text *)); -void pspeak __P((int, int)); +void speak(const struct text *); +void pspeak(int, int); /* save.c */ -int save __P((const char *)); -int restore __P((const char *)); +int save(const char *); +int restore(const char *); /* subr.c */ -int toting __P((int)); -int here __P((int)); -int at __P((int)); -int liq2 __P((int)); -int liq __P((void)); -int liqloc __P((int)); -int bitset __P((int, int)); -int forced __P((int)); -int dark __P((void)); -int pct __P((int)); -int fdwarf __P((void)); -int march __P((void)); -int mback __P((void)); -int specials __P((void)); -int trbridge __P((void)); -void badmove __P((void)); -void bug __P((int)) __attribute__((__noreturn__)); -void checkhints __P((void)); -int trsay __P((void)); -int trtake __P((void)); -int dropper __P((void)); -int trdrop __P((void)); -int tropen __P((void)); -int trkill __P((void)); -int trtoss __P((void)); -int trfeed __P((void)); -int trfill __P((void)); -void closing __P((void)); -void caveclose __P((void)); +int toting(int); +int here(int); +int at(int); +int liq2(int); +int liq(void); +int liqloc(int); +int bitset(int, int); +int forced(int); +int dark(void); +int pct(int); +int fdwarf(void); +int march(void); +int mback(void); +int specials(void); +int trbridge(void); +void badmove(void); +void bug(int) __attribute__((__noreturn__)); +void checkhints(void); +int trsay(void); +int trtake(void); +int dropper(void); +int trdrop(void); +int tropen(void); +int trkill(void); +int trtoss(void); +int trfeed(void); +int trfill(void); +void closing(void); +void caveclose(void); /* vocab.c */ -void dstroy __P((int)); -void juggle __P((int)); -void move __P((int, int)); -int put __P((int, int, int)); -void carry __P((int, int)); -void drop __P((int, int)); -int vocab __P((const char *, int, int)); +void dstroy(int); +void juggle(int); +void move(int, int); +int put(int, int, int); +void carry(int, int); +void drop(int, int); +int vocab(const char *, int, int); /* These three used to be functions in vocab.c */ #define copystr(src, dest) strcpy((dest), (src)) #define weq(str1, str2) (!strncmp((str1), (str2), 5)) #define length(str) (strlen((str)) + 1) -void prht __P((void)); +void prht(void); /* wizard.c */ -void datime __P((int *, int *)); -void poof __P((void)); -int Start __P((void)); -int wizard __P((void)); -void ciao __P((void)); -int ran __P((int)); +void datime(int *, int *); +void poof(void); +int Start(void); +int wizard(void); +void ciao(void); +int ran(int); diff --git a/adventure/main.c b/adventure/main.c index ba2b2a4..3e1cd2d 100644 --- a/adventure/main.c +++ b/adventure/main.c @@ -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 @@ -44,7 +44,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\ #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/2/93"; #else -__RCSID("$NetBSD: main.c,v 1.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 /* 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 "extern.h" -int main __P((int, char **)); +int main(int, char **); int main(argc, argv) diff --git a/arithmetic/Makefrag b/arithmetic/Makefrag index 54a77aa..aa11f10 100644 --- a/arithmetic/Makefrag +++ b/arithmetic/Makefrag @@ -1,6 +1,6 @@ # Makefrag - makefile fragment for arithmetic # -# Copyright (c) 1997, 1998 Joseph Samuel Myers. +# Copyright (c) 1997, 1998, 2004 Joseph Samuel Myers. # All rights reserved. # # 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 # SUCH DAMAGE. +arithmetic_DEFS := $(GETPROGNAME_DEFS) arithmetic_DIRS := $(GAMESDIR) $(MAN6DIR) arithmetic_all: arithmetic/arithmetic arithmetic/arithmetic.6 diff --git a/arithmetic/arithmetic.c b/arithmetic/arithmetic.c index fb1170e..b3f6d82 100644 --- a/arithmetic/arithmetic.c +++ b/arithmetic/arithmetic.c @@ -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 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\ #if 0 static char sccsid[] = "@(#)arithmetic.c 8.1 (Berkeley) 5/31/93"; #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 /* not lint */ @@ -84,14 +84,14 @@ __RCSID("$NetBSD: arithmetic.c,v 1.19 2003/08/07 09:36:52 agc Exp $"); #include #include -int getrandom __P((int, int, int)); -void intr __P((int)) __attribute__((__noreturn__)); -int main __P((int, char *[])); -int opnum __P((int)); -void penalise __P((int, int, int)); -int problem __P((void)); -void showstats __P((int)); -void usage __P((void)) __attribute__((__noreturn__)); +int getrandom(int, int, int); +void intr(int) __attribute__((__noreturn__)); +int main(int, char *[]); +int opnum(int); +void penalise(int, int, int); +int problem(void); +void showstats(int); +void usage(void) __attribute__((__noreturn__)); const char keylist[] = "+-x/"; const char defaultkeys[] = "+-"; @@ -102,8 +102,6 @@ int nright, nwrong; time_t qtime; #define NQUESTS 20 -extern char *__progname; /* from crt0.o */ - /* * Select keys from +-x/ to be asked addition, subtraction, multiplication, * and division problems. More than one key may be given. The default is @@ -390,6 +388,6 @@ void usage() { (void)fprintf(stderr, "Usage: %s [-o +-x/] [-r range]\n", - __progname); + getprogname()); exit(1); } diff --git a/atc/atc.6.in b/atc/atc.6.in index d9800cf..3ce455c 100644 --- a/atc/atc.6.in +++ b/atc/atc.6.in @@ -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 .\" The Regents of the University of California. All rights reserved. @@ -34,7 +34,7 @@ .\" .\" Copyright (c) 1986 Ed James. All rights reserved. .\" -.Dd May 31, 1993 +.Dd January 1, 2004 .Dt ATC 6 .Os .Sh NAME @@ -112,7 +112,6 @@ Suspending a game is not permitted. If you get a talk message, tough. When was the last time an Air Traffic Controller got called away to the phone? .Sh THE DISPLAY -.Pp Depending on the terminal you run .Nm on, the screen will be divided into 4 areas. diff --git a/atc/extern.h b/atc/extern.h index 1b0fa41..c2706d2 100644 --- a/atc/extern.h +++ b/atc/extern.h @@ -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 @@ -58,81 +58,81 @@ extern struct termios tty_start, tty_new; extern DISPLACEMENT displacement[MAXDIR]; -int addplane __P((void)); -void append __P((LIST *, PLANE *)); -void check_adir __P((int, int, int)); -void check_edge __P((int, int)); -void check_edir __P((int, int, int)); -void check_line __P((int, int, int, int)); -void check_linepoint __P((int, int)); -void check_point __P((int, int)); -int checkdefs __P((void)); -int compar __P((const void *, const void *)); -void delete __P((LIST *, PLANE *)); -int dir_deg __P((int)); -int dir_no __P((char)); -void done_screen __P((void)); -void draw_all __P((void)); -void draw_line __P((WINDOW *, int, int, int, int, const char *)); -void erase_all __P((void)); -int getAChar __P((void)); -int getcommand __P((void)); -int gettoken __P((void)); -void init_gr __P((void)); -void ioaddstr __P((int, const char *)); -void ioclrtobot __P((void)); -void ioclrtoeol __P((int)); -void ioerror __P((int, int, const char *)); -void iomove __P((int)); -int list_games __P((void)); -int log_score __P((int)); -void log_score_quit __P((int)) __attribute__((__noreturn__)); -void loser __P((const PLANE *, const char *)) __attribute__((__noreturn__)); -int main __P((int, char *[])); -char name __P((const PLANE *)); -int next_plane __P((void)); -void noise __P((void)); -int number __P((char)); -void open_score_file __P((void)); -void planewin __P((void)); -int pop __P((void)); -void push __P((int, int)); -void quit __P((int)); -int read_file __P((const char *)); -void redraw __P((void)); -void rezero __P((void)); -void setup_screen __P((const C_SCREEN *)); -int too_close __P((const PLANE *p1, const PLANE *p2, int)); -void update __P((int)); -int yyerror __P((const char *)); -int yylex __P((void)); +int addplane(void); +void append(LIST *, PLANE *); +void check_adir(int, int, int); +void check_edge(int, int); +void check_edir(int, int, int); +void check_line(int, int, int, int); +void check_linepoint(int, int); +void check_point(int, int); +int checkdefs(void); +int compar(const void *, const void *); +void delete(LIST *, PLANE *); +int dir_deg(int); +int dir_no(char); +void done_screen(void); +void draw_all(void); +void draw_line(WINDOW *, int, int, int, int, const char *); +void erase_all(void); +int getAChar(void); +int getcommand(void); +int gettoken(void); +void init_gr(void); +void ioaddstr(int, const char *); +void ioclrtobot(void); +void ioclrtoeol(int); +void ioerror(int, int, const char *); +void iomove(int); +int list_games(void); +int log_score(int); +void log_score_quit(int) __attribute__((__noreturn__)); +void loser(const PLANE *, const char *) __attribute__((__noreturn__)); +int main(int, char *[]); +char name(const PLANE *); +int next_plane(void); +void noise(void); +int number(char); +void open_score_file(void); +void planewin(void); +int pop(void); +void push(int, int); +void quit(int); +int read_file(const char *); +void redraw(void); +void rezero(void); +void setup_screen(const C_SCREEN *); +int too_close(const PLANE *p1, const PLANE *p2, int); +void update(int); +int yyerror(const char *); +int yylex(void); #ifndef YYEMPTY -int yyparse __P((void)); +int yyparse(void); #endif -const char *Left __P((char)); -const char *Right __P((char)); -const char *airport __P((char)); -const char *beacon __P((char)); -const char *benum __P((char)); -const char *circle __P((char)); -const char *climb __P((char)); -const char *command __P((const PLANE *)); -const char *default_game __P((void)); -const char *delayb __P((char)); -const char *descend __P((char)); -const char *ex_it __P((char)); -PLANE *findplane __P((int)); -const char *ignore __P((char)); -const char *left __P((char)); -const char *mark __P((char)); -PLANE *newplane __P((void)); -const char *okay_game __P((const char *)); -const char *rel_dir __P((char)); -const char *right __P((char)); -const char *setalt __P((char)); -const char *setplane __P((char)); -const char *setrelalt __P((char)); -const char *timestr __P((int)); -const char *to_dir __P((char)); -const char *turn __P((char)); -const char *unmark __P((char)); +const char *Left(char); +const char *Right(char); +const char *airport(char); +const char *beacon(char); +const char *benum(char); +const char *circle(char); +const char *climb(char); +const char *command(const PLANE *); +const char *default_game(void); +const char *delayb(char); +const char *descend(char); +const char *ex_it(char); +PLANE *findplane(int); +const char *ignore(char); +const char *left(char); +const char *mark(char); +PLANE *newplane(void); +const char *okay_game(const char *); +const char *rel_dir(char); +const char *right(char); +const char *setalt(char); +const char *setplane(char); +const char *setrelalt(char); +const char *timestr(int); +const char *to_dir(char); +const char *turn(char); +const char *unmark(char); diff --git a/atc/input.c b/atc/input.c index 232e81f..d628553 100644 --- a/atc/input.c +++ b/atc/input.c @@ -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 @@ -46,7 +46,7 @@ #if 0 static char sccsid[] = "@(#)input.c 8.1 (Berkeley) 5/31/93"; #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 /* not lint */ @@ -67,7 +67,7 @@ typedef struct { int token; int to_state; const char *str; - const char *(*func) __P((char)); + const char *(*func)(char); } RULE; typedef struct { @@ -229,7 +229,7 @@ int getcommand() { int c, i, done; - const char *s, *(*func) __P((char)); + const char *s, *(*func)(char); PLANE *pp; rezero(); diff --git a/backgammon/backgammon/backlocal.h b/backgammon/backgammon/backlocal.h index 792d796..f3b49a2 100644 --- a/backgammon/backgammon/backlocal.h +++ b/backgammon/backgammon/backlocal.h @@ -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. @@ -36,13 +36,13 @@ * POSSIBILITY OF SUCH DAMAGE. */ -void dble __P((void)); -int dblgood __P((void)); -int eval __P((void)); -int freemen __P((int)); -void movcmp __P((void)); -void move __P((int)); -int movegood __P((void)); -void pickmove __P((void)); -int trapped __P((int, int)); -void trymove __P((int, int)); +void dble(void); +int dblgood(void); +int eval(void); +int freemen(int); +void movcmp(void); +void move(int); +int movegood(void); +void pickmove(void); +int trapped(int, int); +void trymove(int, int); diff --git a/backgammon/backgammon/main.c b/backgammon/backgammon/main.c index a2572de..809cccd 100644 --- a/backgammon/backgammon/main.c +++ b/backgammon/backgammon/main.c @@ -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 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; #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 /* not lint */ diff --git a/backgammon/backgammon/move.c b/backgammon/backgammon/move.c index 7f1e203..9fd81f1 100644 --- a/backgammon/backgammon/move.c +++ b/backgammon/backgammon/move.c @@ -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 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93"; #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 /* not lint */ @@ -83,13 +83,13 @@ static int cg[5]; /* candidate finish position */ static int race; /* game reduced to a race */ -static int bcomp __P((struct BOARD *, struct BOARD *)); -static struct BOARD *bsave __P((void)); -static void binsert __P((struct BOARD *)); -static void boardcopy __P((struct BOARD *)); -static void makefree __P((struct BOARD *)); -static void mvcheck __P((struct BOARD *, struct BOARD *)); -static struct BOARD *nextfree __P((void)); +static int bcomp(struct BOARD *, struct BOARD *); +static struct BOARD *bsave(void); +static void binsert(struct BOARD *); +static void boardcopy(struct BOARD *); +static void makefree(struct BOARD *); +static void mvcheck(struct BOARD *, struct BOARD *); +static struct BOARD *nextfree(void); void diff --git a/backgammon/common_source/back.h b/backgammon/common_source/back.h index c7ca828..fffd941 100644 --- a/backgammon/common_source/back.h +++ b/backgammon/common_source/back.h @@ -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 @@ -129,57 +129,57 @@ extern int curc; /* column position of cursor */ extern int begscr; /* 'beginning' of screen (not including board) */ -int addbuf __P((int)); -void backone __P((int)); -void bsect __P((int, int, int, int)); -void buflush __P((void)); -int canhit __P((int, int)); -int checkd __P((int)); -int checkmove __P((int)); -void clear __P((void)); -void clend __P((void)); -void cline __P((void)); -int count __P((void)); -void curmove __P((int, int)); -int dotable __P((char, int)); -void errexit __P((const char *)) __attribute__((__noreturn__)); -void fancyc __P((int)); -void fboard __P((void)); -void fixcol __P((int, int, int, int, int)); -void fixpos __P((int, int, int, int, int)); -void fixtty __P((struct termios *)); -void getarg __P((char ***)); -int getcaps __P((const char *)); -void getmove __P((void)); -void getout __P((int)) __attribute__((__noreturn__)); -void gwrite __P((void)); -void init __P((void)); -int last __P((void)); -int main __P((int, char *[])); -int makmove __P((int)); -int movallow __P((void)); -void movback __P((int)); -void moverr __P((int)); -int movokay __P((int)); -void newline __P((void)); -void newpos __P((void)); -void nexturn __P((void)); -void norec __P((const char *)) __attribute__((__noreturn__)); -void odds __P((int, int, int)); -void proll __P((void)); -int quit __P((void)); -int readc __P((void)); -void recover __P((const char *)); -void refresh __P((void)); -void roll __P((void)); -int rsetbrd __P((void)); -void save __P((int)); -int text __P((const char *const *)); -void wrboard __P((void)); -void wrbsub __P((void)); -void wrhit __P((int)); -void wrint __P((int)); -void writec __P((char)); -void writel __P((const char *)); -void wrscore __P((void)); -int yorn __P((char)); +int addbuf(int); +void backone(int); +void bsect(int, int, int, int); +void buflush(void); +int canhit(int, int); +int checkd(int); +int checkmove(int); +void clear(void); +void clend(void); +void cline(void); +int count(void); +void curmove(int, int); +int dotable(char, int); +void errexit(const char *) __attribute__((__noreturn__)); +void fancyc(int); +void fboard(void); +void fixcol(int, int, int, int, int); +void fixpos(int, int, int, int, int); +void fixtty(struct termios *); +void getarg(char ***); +int getcaps(const char *); +void getmove(void); +void getout(int) __attribute__((__noreturn__)); +void gwrite(void); +void init(void); +int last(void); +int main(int, char *[]); +int makmove(int); +int movallow(void); +void movback(int); +void moverr(int); +int movokay(int); +void newline(void); +void newpos(void); +void nexturn(void); +void norec(const char *) __attribute__((__noreturn__)); +void odds(int, int, int); +void proll(void); +int quit(void); +int readc(void); +void recover(const char *); +void refresh(void); +void roll(void); +int rsetbrd(void); +void save(int); +int text(const char *const *); +void wrboard(void); +void wrbsub(void); +void wrhit(int); +void wrint(int); +void writec(char); +void writel(const char *); +void wrscore(void); +int yorn(char); diff --git a/backgammon/teachgammon/data.c b/backgammon/teachgammon/data.c index 87f6513..189066e 100644 --- a/backgammon/teachgammon/data.c +++ b/backgammon/teachgammon/data.c @@ -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 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)data.c 8.1 (Berkeley) 5/31/93"; #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 /* not lint */ diff --git a/backgammon/teachgammon/teach.c b/backgammon/teachgammon/teach.c index d3a320c..15e0e06 100644 --- a/backgammon/teachgammon/teach.c +++ b/backgammon/teachgammon/teach.c @@ -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 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ #if 0 static char sccsid[] = "@(#)teach.c 8.1 (Berkeley) 5/31/93"; #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 /* not lint */ diff --git a/backgammon/teachgammon/tutor.h b/backgammon/teachgammon/tutor.h index d0544bf..6fcceff 100644 --- a/backgammon/teachgammon/tutor.h +++ b/backgammon/teachgammon/tutor.h @@ -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 @@ -62,7 +62,7 @@ extern const char *const stragy[]; extern const struct situatn test[]; -int brdeq __P((const int *, const int *)); -void clrest __P((void)); -void leave __P((void)) __attribute__((__noreturn__)); -void tutor __P((void)) __attribute__((__noreturn__)); +int brdeq(const int *, const int *); +void clrest(void); +void leave(void) __attribute__((__noreturn__)); +void tutor(void) __attribute__((__noreturn__)); diff --git a/banner/banner.c b/banner/banner.c index 0d2d9ae..4d2103c 100644 --- a/banner/banner.c +++ b/banner/banner.c @@ -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 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993, 1994\n\ #if 0 static char sccsid[] = "@(#)banner.c 8.4 (Berkeley) 4/29/95"; #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 /* 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 main __P((int, char *[])); +int main(int, char *[]); int main(argc, argv) diff --git a/battlestar/battlestar.c b/battlestar/battlestar.c index 62e1e63..ed62590 100644 --- a/battlestar/battlestar.c +++ b/battlestar/battlestar.c @@ -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 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\ #if 0 static char sccsid[] = "@(#)battlestar.c 8.2 (Berkeley) 4/28/95"; #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 /* not lint */ @@ -52,7 +52,7 @@ __RCSID("$NetBSD: battlestar.c,v 1.13 2003/08/07 09:37:00 agc Exp $"); #include "extern.h" -int main __P((int, char *[])); +int main(int, char *[]); int main(argc, argv) diff --git a/battlestar/extern.h b/battlestar/extern.h index fd6d962..3c9c9c4 100644 --- a/battlestar/extern.h +++ b/battlestar/extern.h @@ -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 @@ -328,60 +328,60 @@ extern const struct objs nightobjs[]; #define DEFAULT_SAVE_FILE ".Bstar" -void bury __P((void)); -int card __P((const char *, int)); -void chime __P((void)); -void convert __P((int)); -void crash __P((void)); -int cypher __P((void)); -void die __P((void)) __attribute__((__noreturn__)); -void diesig __P((int)) __attribute__((__noreturn__)); -void dig __P((void)); -void dooropen __P((void)); -int draw __P((void)); -void drink __P((void)); -int drive __P((void)); -int drop __P((const char *)); -int eat __P((void)); -int fight __P((int, int)); -int follow __P((void)); -char *getcom __P((char *, int, const char *, const char *)); -char *getword __P((char *, char *, int)); -int give __P((void)); -void initialize __P((const char *)); -int jump __P((void)); -void kiss __P((void)); -int land __P((void)); -int launch __P((void)); -void light __P((void)); -void live __P((void)) __attribute__((__noreturn__)); -void love __P((void)); -int moveplayer __P((int, int)); -void murder __P((void)); -void news __P((void)); -void newway __P((int)); -void open_score_file __P((void)); -void parse __P((void)); -void post __P((char)); -void printobjs __P((void)); -int put __P((void)); -int puton __P((void)); -const char *rate __P((void)); -void ravage __P((void)); -void restore __P((const char *)); -int ride __P((void)); -void save __P((const char *)); -char *save_file_name __P((const char *, size_t)); -int shoot __P((void)); -int take __P((unsigned int[])); -int takeoff __P((void)); -int throw __P((const char *)); -const char *truedirec __P((int, char)); -int ucard __P((const unsigned int *)); -int use __P((void)); -int visual __P((void)); -int wearit __P((void)); -void whichway __P((struct room)); -void wordinit __P((void)); -void writedes __P((void)); -int zzz __P((void)); +void bury(void); +int card(const char *, int); +void chime(void); +void convert(int); +void crash(void); +int cypher(void); +void die(void) __attribute__((__noreturn__)); +void diesig(int) __attribute__((__noreturn__)); +void dig(void); +void dooropen(void); +int draw(void); +void drink(void); +int drive(void); +int drop(const char *); +int eat(void); +int fight(int, int); +int follow(void); +char *getcom(char *, int, const char *, const char *); +char *getword(char *, char *, int); +int give(void); +void initialize(const char *); +int jump(void); +void kiss(void); +int land(void); +int launch(void); +void light(void); +void live(void) __attribute__((__noreturn__)); +void love(void); +int moveplayer(int, int); +void murder(void); +void news(void); +void newway(int); +void open_score_file(void); +void parse(void); +void post(char); +void printobjs(void); +int put(void); +int puton(void); +const char *rate(void); +void ravage(void); +void restore(const char *); +int ride(void); +void save(const char *); +char *save_file_name(const char *, size_t); +int shoot(void); +int take(unsigned int[]); +int takeoff(void); +int throw(const char *); +const char *truedirec(int, char); +int ucard(const unsigned int *); +int use(void); +int visual(void); +int wearit(void); +void whichway(struct room); +void wordinit(void); +void writedes(void); +int zzz(void); diff --git a/battlestar/fly.c b/battlestar/fly.c index 3caf311..ee0bf90 100644 --- a/battlestar/fly.c +++ b/battlestar/fly.c @@ -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 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)fly.c 8.2 (Berkeley) 4/28/95"; #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 /* not lint */ @@ -52,13 +52,13 @@ int ourclock = 120; /* time for all the flights in the game */ static char cross = 0; static sig_t oldsig; -static void blast __P((void)); -static void endfly __P((void)); -static void moveenemy __P((int)); -static void notarget __P((void)); -static void screen __P((void)); -static void succumb __P((int)); -static void target __P((void)); +static void blast(void); +static void endfly(void); +static void moveenemy(int); +static void notarget(void); +static void screen(void); +static void succumb(int); +static void target(void); static void succumb(dummy) diff --git a/battlestar/init.c b/battlestar/init.c index a945042..e904aad 100644 --- a/battlestar/init.c +++ b/battlestar/init.c @@ -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 @@ -34,15 +34,15 @@ #if 0 static char sccsid[] = "@(#)init.c 8.4 (Berkeley) 4/30/95"; #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 /* not lint */ #include "extern.h" -static int checkout __P((const char *)); -static const char *getutmp __P((void)); -static int wizard __P((const char *)); +static int checkout(const char *); +static const char *getutmp(void); +static int wizard(const char *); void initialize(filename) diff --git a/battlestar/parse.c b/battlestar/parse.c index 3c38fd7..c1505a3 100644 --- a/battlestar/parse.c +++ b/battlestar/parse.c @@ -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 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)parse.c 8.2 (Berkeley) 4/28/95"; #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 /* 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 HASHMASK (HASHSIZE - 1) -static int hash __P((const char *)); -static void install __P((struct wlist *)); -static struct wlist *lookup __P((const char *)); +static int hash(const char *); +static void install(struct wlist *); +static struct wlist *lookup(const char *); static struct wlist *hashtab[HASHSIZE]; diff --git a/bcd/bcd.c b/bcd/bcd.c index 97bf184..b5b6b93 100644 --- a/bcd/bcd.c +++ b/bcd/bcd.c @@ -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 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\ #if 0 static char sccsid[] = "@(#)bcd.c 8.2 (Berkeley) 3/20/94"; #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 /* not lint */ @@ -124,8 +124,8 @@ const u_short holes[256] = { */ #define bit(w,i) ((w)&(1<<(i))) -int main __P((int, char *[])); -void printcard __P((unsigned char *)); +int main(int, char *[]); +void printcard(unsigned char *); int main(argc, argv) diff --git a/boggle/README.linux b/boggle/README.linux deleted file mode 100644 index be64ac5..0000000 --- a/boggle/README.linux +++ /dev/null @@ -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 , 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 -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: diff --git a/boggle/boggle/bog.c b/boggle/boggle/bog.c index 3a11bf2..e3c3e67 100644 --- a/boggle/boggle/bog.c +++ b/boggle/boggle/bog.c @@ -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 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1993\n\ #if 0 static char sccsid[] = "@(#)bog.c 8.2 (Berkeley) 5/4/95"; #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 /* 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 "extern.h" -static int compar __P((const void *, const void *)); - int main __P((int, char *[])); +static int compar(const void *, const void *); + int main(int, char *[]); struct dictindex dictindex[26]; diff --git a/boggle/boggle/extern.h b/boggle/boggle/extern.h index fa2a0ab..ba36561 100644 --- a/boggle/boggle/extern.h +++ b/boggle/boggle/extern.h @@ -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 @@ -33,39 +33,39 @@ #include -void addword __P((const char *)); -void badword __P((void)); -char *batchword __P((FILE *)); -void checkdict __P((void)); -int checkword __P((const char *, int, int *)); -void cleanup __P((void)); -void delay __P((int)); -long dictseek __P((FILE *, long, int)); -void findword __P((void)); -void flushin __P((FILE *)); -char *getline __P((char *)); -void getword __P((char *)); -int help __P((void)); -int inputch __P((void)); -int loaddict __P((FILE *)); -int loadindex __P((const char *)); -void newgame __P((const char *)); -char *nextword __P((FILE *)); -FILE *opendict __P((const char *)); -void playgame __P((void)); -void prompt __P((const char *)); -void prtable __P((const char *const [], - int, int, int, void (*)(const char *const [], int), int (*)(const char *const [], int))); -void putstr __P((const char *)); -void redraw __P((void)); -void results __P((void)); -int setup __P((int, time_t)); -void showboard __P((const char *)); -void showstr __P((const char *, int)); -void showword __P((int)); -void starttime __P((void)); -void startwords __P((void)); -void stoptime __P((void)); -int timerch __P((void)); -void usage __P((void)) __attribute__((__noreturn__)); -int validword __P((const char *)); +void addword(const char *); +void badword(void); +char *batchword(FILE *); +void checkdict(void); +int checkword(const char *, int, int *); +void cleanup(void); +void delay(int); +long dictseek(FILE *, long, int); +void findword(void); +void flushin(FILE *); +char *getline(char *); +void getword(char *); +int help(void); +int inputch(void); +int loaddict(FILE *); +int loadindex(const char *); +void newgame(const char *); +char *nextword(FILE *); +FILE *opendict(const char *); +void playgame(void); +void prompt(const char *); +void prtable(const char *const [], + int, int, int, void (*)(const char *const [], int), int (*)(const char *const [], int)); +void putstr(const char *); +void redraw(void); +void results(void); +int setup(int, time_t); +void showboard(const char *); +void showstr(const char *, int); +void showword(int); +void starttime(void); +void startwords(void); +void stoptime(void); +int timerch(void); +void usage(void) __attribute__((__noreturn__)); +int validword(const char *); diff --git a/boggle/boggle/mach.c b/boggle/boggle/mach.c index 5f78e0c..bf70d73 100644 --- a/boggle/boggle/mach.c +++ b/boggle/boggle/mach.c @@ -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 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)mach.c 8.1 (Berkeley) 6/11/93"; #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 /* not lint */ @@ -73,14 +73,14 @@ extern int usedbits, wordpath[]; extern time_t start_t; extern int debug; -static void cont_catcher __P((int)); -static int prwidth __P((const char *const [], int)); -static void prword __P((const char *const [], int)); -static void stop_catcher __P((int)); -static void tty_cleanup __P((void)); -static int tty_setup __P((void)); -static void tty_showboard __P((const char *)); -static void winch_catcher __P((int)); +static void cont_catcher(int); +static int prwidth(const char *const [], int); +static void prword(const char *const [], int); +static void stop_catcher(int); +static void tty_cleanup(void); +static int tty_setup(void); +static void tty_showboard(const char *); +static void winch_catcher(int); /* * Do system dependent initialization diff --git a/boggle/boggle/prtable.c b/boggle/boggle/prtable.c index 6c3d507..2326f87 100644 --- a/boggle/boggle/prtable.c +++ b/boggle/boggle/prtable.c @@ -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 @@ -36,7 +36,7 @@ #include #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 */ #include @@ -45,7 +45,7 @@ __RCSID("$NetBSD: prtable.c,v 1.7 2003/08/07 09:37:05 agc Exp $"); #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 @@ -66,8 +66,8 @@ void prtable(base, num, d_cols, width, prentry, length) const char *const base[]; int num, d_cols, width; - void (*prentry) __P((const char *const [], int)); - int (*length) __P((const char *const [], int)); + void (*prentry)(const char *const [], int); + int (*length)(const char *const [], int); { int c, j; int a, b, cols, loc, maxlen, nrows, z; @@ -117,7 +117,7 @@ static int get_maxlen(base, num, length) const char *const base[]; int num; - int (*length) __P((const char *const *, int)); + int (*length)(const char *const *, int); { int i, len, max; diff --git a/boggle/boggle/timer.c b/boggle/boggle/timer.c index 0d015fa..569d9ae 100644 --- a/boggle/boggle/timer.c +++ b/boggle/boggle/timer.c @@ -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 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)timer.c 8.2 (Berkeley) 2/22/94"; #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 /* 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 "extern.h" -static int waitch __P((int)); +static int waitch(int); extern int tlimit; extern time_t start_t; diff --git a/bsd-games.lsm b/bsd-games.lsm index ea5e804..424003b 100644 --- a/bsd-games.lsm +++ b/bsd-games.lsm @@ -1,17 +1,17 @@ Begin4 Title: bsd-games -Version: 2.15 -Entered-date: 2003-12-18 +Version: 2.16 +Entered-date: 2004-02-13 Description: Port of most of the games from NetBSD-current. Games included: adventure arithmetic atc backgammon banner battlestar - bcd boggle caesar canfield countmail cribbage dm factor fish fortune - gomoku hack hangman hunt mille monop morse number phantasia pig pom - ppt primes quiz rain random robots sail snake tetris trek wargames - worm worms wtf wump. + bcd boggle caesar canfield countmail cribbage dab dm factor fish + fortune gomoku hack hangman hunt mille monop morse number phantasia + pig pom ppt primes quiz rain random robots sail snake tetris trek + wargames worm worms wtf wump. Keywords: games, NetBSD Maintained-by: jsm@polyomino.org.uk (Joseph S. Myers) 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 Original-site: ftp.netbsd.org /pub/NetBSD/NetBSD-current/tar_files/src games.tar.gz diff --git a/caesar/caesar.c b/caesar/caesar.c index 8e80335..e354832 100644 --- a/caesar/caesar.c +++ b/caesar/caesar.c @@ -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 @@ -47,7 +47,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\ #if 0 static char sccsid[] = "@(#)caesar.c 8.1 (Berkeley) 5/31/93"; #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 /* not lint */ @@ -76,8 +76,8 @@ double stdf[26] = { }; -int main __P((int, char *[])); -void printit __P((const char *)) __attribute__((__noreturn__)); +int main(int, char *[]); +void printit(const char *) __attribute__((__noreturn__)); int main(argc, argv) diff --git a/canfield/canfield/canfield.c b/canfield/canfield/canfield.c index d1d40d6..cbdc404 100644 --- a/canfield/canfield/canfield.c +++ b/canfield/canfield/canfield.c @@ -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 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ #if 0 static char sccsid[] = "@(#)canfield.c 8.1 (Berkeley) 5/31/93"; #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 /* not lint */ @@ -198,53 +198,53 @@ bool startedgame = FALSE, infullgame = FALSE; time_t acctstart; int dbfd = -1; -void askquit __P((int)); -void cleanup __P((int)) __attribute__((__noreturn__)); -void cleanupboard __P((void)); -void clearabovemovebox __P((void)); -void clearbelowmovebox __P((void)); -void clearmsg __P((void)); -void clearstat __P((void)); -void destinerror __P((void)); -bool diffcolor __P((const struct cardtype *, const struct cardtype *)); -void dumberror __P((void)); -bool finish __P((void)); -void fndbase __P((struct cardtype **, int, int)); -void getcmd __P((int, int, const char *)); -void initall __P((void)); -void initdeck __P((struct cardtype *[])); -void initgame __P((void)); -void instruct __P((void)); -int main __P((void)); -void makeboard __P((void)); -void movebox __P((void)); -void movecard __P((void)); -void movetofound __P((struct cardtype **, int)); -void movetotalon __P((void)); -bool notempty __P((const struct cardtype *)); -void printbottombettingbox __P((void)); -void printbottominstructions __P((void)); -void printcard __P((int, int, const struct cardtype *)); -void printrank __P((int, int, const struct cardtype *, bool)); -void printtopbettingbox __P((void)); -void printtopinstructions __P((void)); -bool rankhigher __P((const struct cardtype *, int)); -bool ranklower __P((const struct cardtype *, const struct cardtype *)); -void removecard __P((int, int)); -int samesuit __P((const struct cardtype *, int)); -void showcards __P((void)); -void showstat __P((void)); -void shuffle __P((struct cardtype *[])); -void simpletableau __P((struct cardtype **, int)); -void startgame __P((void)); -void suspend __P((void)); -bool tabok __P((const struct cardtype *, int)); -void tabprint __P((int, int)); -void tabtotab __P((int, int)); -void transit __P((struct cardtype **, struct cardtype **)); -void updatebettinginfo __P((void)); -void usedstock __P((void)); -void usedtalon __P((void)); +void askquit(int); +void cleanup(int) __attribute__((__noreturn__)); +void cleanupboard(void); +void clearabovemovebox(void); +void clearbelowmovebox(void); +void clearmsg(void); +void clearstat(void); +void destinerror(void); +bool diffcolor(const struct cardtype *, const struct cardtype *); +void dumberror(void); +bool finish(void); +void fndbase(struct cardtype **, int, int); +void getcmd(int, int, const char *); +void initall(void); +void initdeck(struct cardtype *[]); +void initgame(void); +void instruct(void); +int main(void); +void makeboard(void); +void movebox(void); +void movecard(void); +void movetofound(struct cardtype **, int); +void movetotalon(void); +bool notempty(const struct cardtype *); +void printbottombettingbox(void); +void printbottominstructions(void); +void printcard(int, int, const struct cardtype *); +void printrank(int, int, const struct cardtype *, bool); +void printtopbettingbox(void); +void printtopinstructions(void); +bool rankhigher(const struct cardtype *, int); +bool ranklower(const struct cardtype *, const struct cardtype *); +void removecard(int, int); +int samesuit(const struct cardtype *, int); +void showcards(void); +void showstat(void); +void shuffle(struct cardtype *[]); +void simpletableau(struct cardtype **, int); +void startgame(void); +void suspend(void); +bool tabok(const struct cardtype *, int); +void tabprint(int, int); +void tabtotab(int, int); +void transit(struct cardtype **, struct cardtype **); +void updatebettinginfo(void); +void usedstock(void); +void usedtalon(void); /* * The following procedures print the board onto the screen using the diff --git a/canfield/cfscores/cfscores.c b/canfield/cfscores/cfscores.c index 6aecb10..b8a2a49 100644 --- a/canfield/cfscores/cfscores.c +++ b/canfield/cfscores/cfscores.c @@ -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 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\ #if 0 static char sccsid[] = "@(#)cfscores.c 8.1 (Berkeley) 5/31/93"; #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 /* not lint */ @@ -66,8 +66,8 @@ struct betinfo { int dbfd; -int main __P((int, char *[])); -void printuser __P((const struct passwd *, int)); +int main(int, char *[]); +void printuser(const struct passwd *, int); int main(argc, argv) diff --git a/configure b/configure index e2bd7a7..017c6a4 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #!/bin/sh # 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. # # Redistribution and use in source and binary forms, with or without @@ -56,10 +56,10 @@ ask () { read input fi case "$input" in - '') + ('') input="$default" ;; - *) + (*) ;; esac eval $query_var=\"\$input\" @@ -73,13 +73,13 @@ ask_yn () { ask "$1" $2 $3 eval answer=\$$2 case "$answer" in - [yY]*) + ([yY]*) answer=y ;; - [nN]*) + ([nN]*) answer=n ;; - *) + (*) answer= echo "Please answer y or n" ;; @@ -242,6 +242,13 @@ else subst_vars="$subst_vars man5dir" 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 # games ghettoes of /usr/games, /var/games, etc., then a subdirectory for # 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 ask "Use .so or symlinks for manpages" use_dot_so .so case "$use_dot_so" in - .so) + (.so) ;; - syml*) + (syml*) use_dot_so=symlinks ;; - *) + (*) use_dot_so= echo "Please answer \`.so\' or \`symlinks\'" ;; @@ -317,13 +324,19 @@ subst_vars="$subst_vars install_script" echo echo "It is presumed in some places by the Makefiles that the compiler" 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" echo echo "The default warning flags should give a compile with few warnings." # -Wbad-function-cast and -Wshadow give lots of warnings that are basically # 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 "You probably want the default here, or could use -lncurses_g for" echo "debugging ncurses. Use -lcurses -ltermcap if you want to try that," @@ -409,6 +422,29 @@ main(void) } EOF +check_func sig_t < + +sig_t s; + +int +main(void) +{ + return 0; +} +EOF + +check_func getprogname < + +int +main(void) +{ + const char *n = getprogname(); + return 0; +} +EOF + echo "#endif /* !defined(LINUX_BSD_GAMES_H) */" >>include/bsd-games.h @@ -630,7 +666,25 @@ EOF for dir in $make_dirs; do udir=$(slashdot_to_under $dir) eval clean_$udir= - cat >>GNUmakefile <>GNUmakefile <>GNUmakefile <>GNUmakefile < diff --git a/dab/Makefrag b/dab/Makefrag new file mode 100644 index 0000000..50b9bf7 --- /dev/null +++ b/dab/Makefrag @@ -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 diff --git a/dab/algor.cc b/dab/algor.cc new file mode 100644 index 0000000..b84a3bd --- /dev/null +++ b/dab/algor.cc @@ -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; +} diff --git a/dab/algor.h b/dab/algor.h new file mode 100644 index 0000000..862c93a --- /dev/null +++ b/dab/algor.h @@ -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 diff --git a/dab/board.cc b/dab/board.cc new file mode 100644 index 0000000..6cd3e95 --- /dev/null +++ b/dab/board.cc @@ -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 +#include +#include +#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(); +} diff --git a/dab/board.h b/dab/board.h new file mode 100644 index 0000000..9a21a0a --- /dev/null +++ b/dab/board.h @@ -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 + +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 diff --git a/dab/box.cc b/dab/box.cc new file mode 100644 index 0000000..ed9cadb --- /dev/null +++ b/dab/box.cc @@ -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 + +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() = ' '; +} diff --git a/dab/box.h b/dab/box.h new file mode 100644 index 0000000..015e9a7 --- /dev/null +++ b/dab/box.h @@ -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 + +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 diff --git a/dab/dab.6 b/dab/dab.6 new file mode 100644 index 0000000..a5feab5 --- /dev/null +++ b/dab/dab.6 @@ -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 diff --git a/dab/defs.h b/dab/defs.h new file mode 100644 index 0000000..b0bda57 --- /dev/null +++ b/dab/defs.h @@ -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 + +#define RCSID(id) \ + static const char *rcsid(const char* x) { return x ? rcsid(id) : x; } + +#endif diff --git a/dab/gamescreen.cc b/dab/gamescreen.cc new file mode 100644 index 0000000..47a9e22 --- /dev/null +++ b/dab/gamescreen.cc @@ -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() +{ +} diff --git a/dab/gamescreen.h b/dab/gamescreen.h new file mode 100644 index 0000000..ca90cb3 --- /dev/null +++ b/dab/gamescreen.h @@ -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 + +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 diff --git a/dab/human.cc b/dab/human.cc new file mode 100644 index 0000000..79ceeb7 --- /dev/null +++ b/dab/human.cc @@ -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); + } +} diff --git a/dab/human.h b/dab/human.h new file mode 100644 index 0000000..b245ee1 --- /dev/null +++ b/dab/human.h @@ -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 +#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 diff --git a/dab/main.cc b/dab/main.cc new file mode 100644 index 0000000..399aa83 --- /dev/null +++ b/dab/main.cc @@ -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 +#include +#include +#include +#include +#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 ] [-n ] [ []]" << 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; +} diff --git a/dab/player.cc b/dab/player.cc new file mode 100644 index 0000000..25ae6ca --- /dev/null +++ b/dab/player.cc @@ -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; + } + } +} diff --git a/dab/player.h b/dab/player.h new file mode 100644 index 0000000..514b9b7 --- /dev/null +++ b/dab/player.h @@ -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 + +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 diff --git a/dab/random.cc b/dab/random.cc new file mode 100644 index 0000000..001c996 --- /dev/null +++ b/dab/random.cc @@ -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 +#include +#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; + } + } +} diff --git a/dab/random.h b/dab/random.h new file mode 100644 index 0000000..4f5b81b --- /dev/null +++ b/dab/random.h @@ -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 + +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 diff --git a/dab/test.cc b/dab/test.cc new file mode 100644 index 0000000..de03147 --- /dev/null +++ b/dab/test.cc @@ -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 +#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; +} diff --git a/dab/ttyscrn.cc b/dab/ttyscrn.cc new file mode 100644 index 0000000..62ae843 --- /dev/null +++ b/dab/ttyscrn.cc @@ -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 +#include +#include + +#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(); +} diff --git a/dab/ttyscrn.h b/dab/ttyscrn.h new file mode 100644 index 0000000..5e0a540 --- /dev/null +++ b/dab/ttyscrn.h @@ -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 diff --git a/debian/changelog b/debian/changelog index 8fa78a1..f71a048 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +bsdgames (2.16-1) unstable; urgency=low + + * New upstream release. + + -- Joey Hess Sat, 14 Feb 2004 16:34:08 -0500 + bsdgames (2.15-1) unstable; urgency=low * New upstream release. diff --git a/debian/control b/debian/control index ac7554d..f2520df 100644 --- a/debian/control +++ b/debian/control @@ -15,7 +15,7 @@ Description: a collection of classic textual unix games been enjoyed for decades on unix systems. . 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, quiz, random, rain, robots, sail, snake, tetris, trek, wargames, worm, worms, wump, wtf diff --git a/debian/rules b/debian/rules index 382685f..a19f611 100755 --- a/debian/rules +++ b/debian/rules @@ -33,10 +33,8 @@ binary-arch: build $(MAKE) install 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.linux debian/bsdgames/usr/share/doc/bsdgames/README.linux.hunt 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.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/READ_ME debian/bsdgames/usr/share/doc/bsdgames/READ_ME.hack # Since factor is not installed, and primes.6 is a symlink to diff --git a/dm/Makefrag b/dm/Makefrag index 8f1cc29..5fcb07f 100644 --- a/dm/Makefrag +++ b/dm/Makefrag @@ -1,6 +1,6 @@ # 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. # # Redistribution and use in source and binary forms, with or without @@ -27,7 +27,7 @@ # SUCH DAMAGE. # 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_all: dm/dm dm/dm.8 dm/dm.conf.5 diff --git a/dm/README.linux b/dm/README.linux deleted file mode 100644 index d5196a8..0000000 --- a/dm/README.linux +++ /dev/null @@ -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 diff --git a/dm/dm.c b/dm/dm.c index 6c89316..a5918ce 100644 --- a/dm/dm.c +++ b/dm/dm.c @@ -1,5 +1,4 @@ -/* $NetBSD: dm.c,v 1.18 2003/08/07 09:37:11 agc Exp $ */ -/* For Linux: still using old utmp interface from version 1.16. */ +/* $NetBSD: dm.c,v 1.20 2004/02/08 22:23:50 jsm Exp $ */ /* * Copyright (c) 1987, 1993 @@ -40,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993\n\ #if 0 static char sccsid[] = "@(#)dm.c 8.1 (Berkeley) 5/31/93"; #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 /* not lint */ @@ -58,8 +57,8 @@ __RCSID("$NetBSD: dm.c,v 1.18 2003/08/07 09:37:11 agc Exp $"); #include #include #include -#include +#include "utmpentry.h" #include "pathnames.h" static time_t now; /* current time value */ @@ -67,16 +66,16 @@ static int priority = 0; /* priority game runs at */ static char *game, /* requested game */ *gametty; /* from tty? */ -void c_day __P((const char *, const char *, const char *)); -void c_game __P((const char *, const char *, const char *, const char *)); -void c_tty __P((const char *)); -const char *hour __P((int)); -double load __P((void)); -int main __P((int, char *[])); -void nogamefile __P((void)); -void play __P((char **)) __attribute__((__noreturn__)); -void read_config __P((void)); -int users __P((void)); +void c_day(const char *, const char *, const char *); +void c_game(const char *, const char *, const char *, const char *); +void c_tty(const char *); +const char *hour(int); +double load(void); +int main(int, char *[]); +void nogamefile(void); +void play(char **) __attribute__((__noreturn__)); +void read_config(void); +int users(void); int main(argc, argv) @@ -253,16 +252,16 @@ load() int users() { - - int nusers, utmp; - struct utmp buf; - - if ((utmp = open(_PATH_UTMP, O_RDONLY, 0)) < 0) - err(1, "%s", _PATH_UTMP); - for (nusers = 0; read(utmp, (char *)&buf, sizeof(struct utmp)) > 0;) - if (buf.ut_name[0] != '\0') - ++nusers; - return (nusers); + static struct utmpentry *ohead = NULL; + struct utmpentry *ep; + int nusers; + + nusers = getutentries(NULL, &ep); + if (ep != ohead) { + freeutentries(ep); + ohead = ep; + } + return nusers; } void diff --git a/dm/utmpentry.c b/dm/utmpentry.c new file mode 100644 index 0000000..7c42fe7 --- /dev/null +++ b/dm/utmpentry.c @@ -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 +#ifndef lint +__RCSID("$NetBSD: utmpentry.c,v 1.4 2003/02/12 17:39:36 christos Exp $"); +#endif + +#include + +#include +#include +#include +#include + +#ifdef SUPPORT_UTMP +#include +#endif +#ifdef SUPPORT_UTMPX +#include +#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 diff --git a/dm/utmpentry.h b/dm/utmpentry.h new file mode 100644 index 0000000..e5420d4 --- /dev/null +++ b/dm/utmpentry.h @@ -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 *); diff --git a/exec.libs b/exec.libs index 2d81ae6..a091425 100644 --- a/exec.libs +++ b/exec.libs @@ -1,7 +1,7 @@ # exec.libs - details of libraries needed to link bsd-games programs. # 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. # # Redistribution and use in source and binary forms, with or without @@ -35,6 +35,7 @@ boggle/boggle/boggle $(NCURSES_LIB) caesar -lm canfield/canfield/canfield $(NCURSES_LIB) cribbage $(NCURSES_LIB) +dab $(NCURSES_LIB) factor $(OPENSSL_LIB) gomoku $(NCURSES_LIB) hack $(NCURSES_LIB) diff --git a/exec.objs b/exec.objs index 049c98a..9ca6ffa 100644 --- a/exec.objs +++ b/exec.objs @@ -1,7 +1,7 @@ # exec.objs - details of objects that go into bsd-games programs. # 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. # # 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 \ vocab.o wizard.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 \ log.o main.o tunable.o update.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/cfscores/cfscores cfscores.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 fish fish.o -fortune/fortune/fortune fortune.o +fortune/fortune/fortune fortune.o lib/getprogname.o fortune/strfile/strfile strfile.o fortune/unstr/unstr unstr.o gomoku bdinit.o bdisp.o main.o makemove.o pickmove.o stoc.o diff --git a/factor/Makefile.bsd b/factor/Makefile.bsd index 0be0475..415e38a 100644 --- a/factor/Makefile.bsd +++ b/factor/Makefile.bsd @@ -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 # For MKCRYPTO @@ -17,7 +17,6 @@ DPADD+= ${LIBCRYPTO} .endif MAN= factor.6 -MLINKS+=factor.6 primes.6 .PATH: ${PRIMES} .include diff --git a/factor/factor.6 b/factor/factor.6 index 493296f..4600bd3 100644 --- a/factor/factor.6 +++ b/factor/factor.6 @@ -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 .\" The Regents of the University of California. All rights reserved. @@ -37,54 +37,45 @@ .\" .\" chongo /\oo/\ .\" -.Dd May 31, 1993 -.Dt PRIMES 6 +.Dd February 8, 2004 +.Dt FACTOR 6 .Os .Sh NAME -.Nm primes -.Nd generate primes +.Nm factor +.Nd factor a number .Sh SYNOPSIS .Nm .Op Ar number ... -.br -.Nm primes -.Op Ar start Op Ar stop .Sh DESCRIPTION The -.Nm primes -utility prints primes in ascending order, one per line, starting at or above -.Ar start -and continuing until, but not including -.Ar stop . -The -.Ar start -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. +.Nm +utility will factor integers between \-2147483648 and 2147483647 inclusive. +When a number is factored, it is printed, followed by a +.Dq \&: , +and the list of factors on a single line. +Factors are listed in ascending order, and are preceded by a space. +If a factor divides a value more than once, it will be printed more than once. .Pp -When the -.Nm primes -utility is invoked with no arguments, -.Ar start -is read from standard input. -.Ar stop -is taken to be 4294967295. -The -.Ar start -value may be preceded by a single +. -The -.Ar start -value is terminated by a non-digit character (such as a newline). -The input line must not be longer than 255 characters. +When +.Nm +is invoked with one or more arguments, each argument will be factored. +.Pp +When +.Nm +is invoked with no arguments, +.Nm +reads numbers, one per line, from standard input, until end of file or error. +Leading white-space and empty lines are ignored. +Numbers may be preceded by a single - or +. +Numbers are terminated by a non-digit character (such as a newline). +After a number is read, it is factored. +Input lines must not be longer than 255 characters. .Sh DIAGNOSTICS Out of range or invalid input results in -.Sq ouch +an appropriate error message being written to standard error. .Sh BUGS -.Nm primes -won't get you a world record. +.Nm +cannot handle the +.Dq 10 most wanted +factor list. diff --git a/factor/factor.c b/factor/factor.c index 4d66a99..ec2dd77 100644 --- a/factor/factor.c +++ b/factor/factor.c @@ -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 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\ #if 0 static char sccsid[] = "@(#)factor.c 8.4 (Berkeley) 5/4/95"; #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 /* not lint */ @@ -231,7 +231,9 @@ pr_fact(BIGNUM *val) bnfact = BN_new(); BN_set_word(bnfact, *(fact - 1)); 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(' '); BN_print_dec_fp(stdout, val); } else @@ -280,23 +282,29 @@ usage(void) #ifdef HAVE_OPENSSL -/* pollard rho, algorithm from Jim Gillogly, May 2000 */ +/* pollard p-1, algorithm from Jim Gillogly, May 2000 */ void pollard_pminus1(BIGNUM *val) { - BIGNUM *base, *num, *i, *x; + BIGNUM *base, *rbase, *num, *i, *x; base = BN_new(); + rbase = BN_new(); num = BN_new(); i = BN_new(); x = BN_new(); + BN_set_word(rbase, 1); + newbase: + BN_add_word(rbase, 1); BN_set_word(i, 2); - BN_set_word(base, 2); + BN_copy(base, rbase); for (;;) { BN_mod_exp(base, base, i, val, ctx); + if (BN_is_one(base)) + goto newbase; BN_copy(x, base); BN_sub_word(x, 1); diff --git a/fish/fish.c b/fish/fish.c index c28da11..8704964 100644 --- a/fish/fish.c +++ b/fish/fish.c @@ -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 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 1993\n\ #if 0 static char sccsid[] = "@(#)fish.c 8.1 (Berkeley) 5/31/93"; #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 /* not lint */ @@ -78,22 +78,22 @@ int asked[RANKS], comphand[RANKS], deck[TOTCARDS]; int userasked[RANKS], userhand[RANKS]; int curcard = TOTCARDS; -void chkwinner __P((int, const int *)); -int compmove __P((void)); -int countbooks __P((const int *)); -int countcards __P((const int *)); -int drawcard __P((int, int *)); -int gofish __P((int, int, int *)); -void goodmove __P((int, int, int *, int *)); -void init __P((void)); -void instructions __P((void)); -int main __P((int, char *[])); -int nrandom __P((int)); -void printhand __P((const int *)); -void printplayer __P((int)); -int promove __P((void)); -void usage __P((void)) __attribute__((__noreturn__)); -int usermove __P((void)); +void chkwinner(int, const int *); +int compmove(void); +int countbooks(const int *); +int countcards(const int *); +int drawcard(int, int *); +int gofish(int, int, int *); +void goodmove(int, int, int *, int *); +void init(void); +void instructions(void); +int main(int, char *[]); +int nrandom(int); +void printhand(const int *); +void printplayer(int); +int promove(void); +void usage(void) __attribute__((__noreturn__)); +int usermove(void); int main(argc, argv) diff --git a/fortune/README.linux b/fortune/README.linux deleted file mode 100644 index dd55f04..0000000 --- a/fortune/README.linux +++ /dev/null @@ -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 -. - -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 ] diff --git a/fortune/datfiles/fortunes b/fortune/datfiles/fortunes index a679604..be6b88f 100644 --- a/fortune/datfiles/fortunes +++ b/fortune/datfiles/fortunes @@ -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 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 -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 can't help it. -- Dave Barry, "On Presidential Politics" diff --git a/fortune/datfiles/fortunes2 b/fortune/datfiles/fortunes2 index 547657f..f2629a8 100644 --- a/fortune/datfiles/fortunes2 +++ b/fortune/datfiles/fortunes2 @@ -674,7 +674,7 @@ days old. He heard that a foal and his mummy are soon parted. long-distance caw. A musical reviewer admitted he always praised the first show of a 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 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 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, which contained twelve more loons. "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 % 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 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 diff --git a/fortune/fortune/Makefrag b/fortune/fortune/Makefrag index d0ca10d..7c72e0e 100644 --- a/fortune/fortune/Makefrag +++ b/fortune/fortune/Makefrag @@ -1,6 +1,6 @@ # Makefrag - makefile fragment for fortune/fortune # -# Copyright (c) 1997, 1998 Joseph Samuel Myers. +# Copyright (c) 1997, 1998, 2004 Joseph Samuel Myers. # All rights reserved. # # 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 # SUCH DAMAGE. -fortune_fortune_DEFS := -DHAVE_REGCOMP +fortune_fortune_DEFS := $(GETPROGNAME_DEFS) -DHAVE_REGCOMP fortune_fortune_DIRS := $(GAMESDIR) $(MAN6DIR) fortune_fortune_INCS := -Ifortune/strfile diff --git a/fortune/fortune/fortune.6.in b/fortune/fortune/fortune.6.in index 6c07b05..d46b9e3 100644 --- a/fortune/fortune/fortune.6.in +++ b/fortune/fortune/fortune.6.in @@ -161,7 +161,7 @@ fortune 50% funny 50% not .Ed .Sh FILES .Bl -tag -width Pa -compact -.It Pa @sharedir@/fortunes +.It Pa @fortune_dir@ .El .Sh SEE ALSO .Xr regex 3 diff --git a/fortune/fortune/fortune.c b/fortune/fortune/fortune.c index 177b342..abe7321 100644 --- a/fortune/fortune/fortune.c +++ b/fortune/fortune/fortune.c @@ -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 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1986, 1993\n\ #if 0 static char sccsid[] = "@(#)fortune.c 8.1 (Berkeley) 5/31/93"; #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 /* not lint */ @@ -126,46 +126,46 @@ FILEDESC *Fortfile; /* Fortune file to use */ STRFILE Noprob_tbl; /* sum of data for all no prob files */ -int add_dir __P((FILEDESC *)); -int add_file __P((int, - const char *, const char *, FILEDESC **, FILEDESC **, FILEDESC *)); -void all_forts __P((FILEDESC *, const char *)); -char *copy __P((const char *, u_int)); -void rot13 __P((char *line, int len)); -void display __P((FILEDESC *)); -void do_free __P((void *)); -void *do_malloc __P((u_int)); -int form_file_list __P((char **, int)); -int fortlen __P((void)); -void get_fort __P((void)); -void get_pos __P((FILEDESC *)); -void get_tbl __P((FILEDESC *)); -void getargs __P((int, char *[])); -void init_prob __P((void)); -int is_dir __P((const char *)); -int is_fortfile __P((const char *, char **, char **, int)); -int is_off_name __P((const char *)); -int main __P((int, char *[])); -int max __P((int, int)); +int add_dir(FILEDESC *); +int add_file(int, + const char *, const char *, FILEDESC **, FILEDESC **, FILEDESC *); +void all_forts(FILEDESC *, const char *); +char *copy(const char *, u_int); +void rot13(char *line, int len); +void display(FILEDESC *); +void do_free(void *); +void *do_malloc(u_int); +int form_file_list(char **, int); +int fortlen(void); +void get_fort(void); +void get_pos(FILEDESC *); +void get_tbl(FILEDESC *); +void getargs(int, char *[]); +void init_prob(void); +int is_dir(const char *); +int is_fortfile(const char *, char **, char **, int); +int is_off_name(const char *); +int main(int, char *[]); +int max(int, int); FILEDESC * - new_fp __P((void)); -char *off_name __P((const char *)); -void open_dat __P((FILEDESC *)); -void open_fp __P((FILEDESC *)); + new_fp(void); +char *off_name(const char *); +void open_dat(FILEDESC *); +void open_fp(FILEDESC *); FILEDESC * - pick_child __P((FILEDESC *)); -void print_file_list __P((void)); -void print_list __P((FILEDESC *, int)); -void sum_noprobs __P((FILEDESC *)); -void sum_tbl __P((STRFILE *, STRFILE *)); -void usage __P((void)) __attribute__((__noreturn__)); -void zero_tbl __P((STRFILE *)); + pick_child(FILEDESC *); +void print_file_list(void); +void print_list(FILEDESC *, int); +void sum_noprobs(FILEDESC *); +void sum_tbl(STRFILE *, STRFILE *); +void usage(void) __attribute__((__noreturn__)); +void zero_tbl(STRFILE *); #ifndef NO_REGEX -char *conv_pat __P((char *)); -int find_matches __P((void)); -void matches_in_list __P((FILEDESC *)); -int maxlen_in_list __P((FILEDESC *)); +char *conv_pat(char *); +int find_matches(void); +void matches_in_list(FILEDESC *); +int maxlen_in_list(FILEDESC *); #endif #ifndef NO_REGEX @@ -210,14 +210,12 @@ char Re_error[1024]; # 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)) #else #define NAMLEN(d) ((d)->d_namlen) #endif -extern char *__progname; - int main(ac, av) int ac; @@ -1403,7 +1401,8 @@ matches_in_list(list) void usage() { - (void) fprintf(stderr, "Usage: %s [-ae", __progname); + + (void) fprintf(stderr, "Usage: %s [-ae", getprogname()); #ifdef DEBUG (void) fprintf(stderr, "D"); #endif /* DEBUG */ diff --git a/fortune/unstr/unstr.c b/fortune/unstr/unstr.c index 1fca89a..06dc0ea 100644 --- a/fortune/unstr/unstr.c +++ b/fortune/unstr/unstr.c @@ -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 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\ #if 0 static char sccsid[] = "@(#)unstr.c 8.1 (Berkeley) 5/31/93"; #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 /* not lint */ @@ -79,9 +79,9 @@ char *Infile, /* name of input file */ FILE *Inf, *Dataf; -void getargs __P((char *[])); -int main __P((int, char *[])); -void order_unstr __P((STRFILE *)); +void getargs(char *[]); +int main(int, char *[]); +void order_unstr(STRFILE *); /* ARGSUSED */ int diff --git a/gomoku/gomoku.h b/gomoku/gomoku.h index ae0b017..0d9ff6e 100644 --- a/gomoku/gomoku.h +++ b/gomoku/gomoku.h @@ -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 @@ -35,10 +35,8 @@ */ #include +#include #include -#ifdef __linux__ -#include -#endif /* board dimensions */ #define BSZ 19 @@ -263,42 +261,42 @@ extern int debug; #define ASSERT(x) -void bdinit __P((struct spotstr *)); -void init_overlap __P((void)); -int getline __P((char *, int)); -void ask __P((const char *)); -void dislog __P((const char *)); -void bdump __P((FILE *)); -void bdisp __P((void)); -void bdisp_init __P((void)); -void cursfini __P((void)); -void cursinit __P((void)); -void bdwho __P((int)); -void panic __P((const char *)) __attribute__((__noreturn__)); -void glog __P((const char *)); -void dlog __P((const char *)); -void quit __P((void)) __attribute__((__noreturn__)); -void quitsig __P((int)) __attribute__((__noreturn__)); -void whatsup __P((int)); -int readinput __P((FILE *)); -const char *stoc __P((int)); -int lton __P((int)); -int ctos __P((const char *)); -void update_overlap __P((struct spotstr *)); -int makemove __P((int, int)); -int list_eq __P((struct combostr **, struct combostr **, int)); -void clearcombo __P((struct combostr *, int)); -void makeempty __P((struct combostr *)); -void appendcombo __P((struct combostr *, int)); -void updatecombo __P((struct combostr *, int)); -void markcombo __P((struct combostr *)); -void printcombo __P((struct combostr *, char *)); -void makecombo __P((struct combostr *, struct spotstr *, int, int)); -void makecombo2 __P((struct combostr *, struct spotstr *, int, int)); -int sortcombo __P((struct combostr **, struct combostr **, struct combostr *)); -int checkframes __P((struct combostr *, struct combostr *, struct spotstr *, -int, struct ovlp_info *)); -void addframes __P((int)); -void scanframes __P((int)); -int better __P((const struct spotstr *, const struct spotstr *, int)); -int pickmove __P((int)); +void bdinit(struct spotstr *); +void init_overlap(void); +int getline(char *, int); +void ask(const char *); +void dislog(const char *); +void bdump(FILE *); +void bdisp(void); +void bdisp_init(void); +void cursfini(void); +void cursinit(void); +void bdwho(int); +void panic(const char *) __attribute__((__noreturn__)); +void glog(const char *); +void dlog(const char *); +void quit(void) __attribute__((__noreturn__)); +void quitsig(int) __attribute__((__noreturn__)); +void whatsup(int); +int readinput(FILE *); +const char *stoc(int); +int lton(int); +int ctos(const char *); +void update_overlap(struct spotstr *); +int makemove(int, int); +int list_eq(struct combostr **, struct combostr **, int); +void clearcombo(struct combostr *, int); +void makeempty(struct combostr *); +void appendcombo(struct combostr *, int); +void updatecombo(struct combostr *, int); +void markcombo(struct combostr *); +void printcombo(struct combostr *, char *); +void makecombo(struct combostr *, struct spotstr *, int, int); +void makecombo2(struct combostr *, struct spotstr *, int, int); +int sortcombo(struct combostr **, struct combostr **, struct combostr *); +int checkframes(struct combostr *, struct combostr *, struct spotstr *, + int, struct ovlp_info *); +void addframes(int); +void scanframes(int); +int better(const struct spotstr *, const struct spotstr *, int); +int pickmove(int); diff --git a/gomoku/main.c b/gomoku/main.c index 10c16ab..299dee1 100644 --- a/gomoku/main.c +++ b/gomoku/main.c @@ -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 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1994\n\ #if 0 static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 5/4/95"; #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 /* not lint */ @@ -79,7 +79,7 @@ int movelog[BSZ * BSZ]; /* log of all the moves */ int movenum; /* current move number */ const char *plyr[2]; /* who's who */ -int main __P((int, char *[])); +int main(int, char *[]); int main(argc, argv) diff --git a/gomoku/pickmove.c b/gomoku/pickmove.c index d740325..db0fe69 100644 --- a/gomoku/pickmove.c +++ b/gomoku/pickmove.c @@ -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 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)pickmove.c 8.2 (Berkeley) 5/3/95"; #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 /* not lint */ diff --git a/hack/def.func_tab.h b/hack/def.func_tab.h index 062bda8..78957e0 100644 --- a/hack/def.func_tab.h +++ b/hack/def.func_tab.h @@ -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, @@ -65,14 +65,14 @@ #define _DEF_FUNC_TAB_H_ struct func_tab { char f_char; - int (*f_funct) __P((void)); + int (*f_funct)(void); }; extern const struct func_tab cmdlist[]; struct ext_func_tab { const char *ef_txt; - int (*ef_funct) __P((void)); + int (*ef_funct)(void); }; extern const struct ext_func_tab extcmdlist[]; diff --git a/hack/extern.h b/hack/extern.h index 804498c..e2ef242 100644 --- a/hack/extern.h +++ b/hack/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.5 2002/05/26 00:12:12 wiz Exp $ */ +/* $NetBSD: extern.h,v 1.6 2004/01/27 20:30:29 jsm Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -41,628 +41,628 @@ #include /* alloc.c */ -long *alloc __P((unsigned)); -long *enlarge __P((char *, unsigned)); +long *alloc(unsigned); +long *enlarge(char *, unsigned); /* hack.apply.c */ -int doapply __P((void)); -int holetime __P((void)); -void dighole __P((void)); +int doapply(void); +int holetime(void); +void dighole(void); /* hack.bones.c */ -void savebones __P((void)); -int getbones __P((void)); +void savebones(void); +int getbones(void); /* hack.c */ -void unsee __P((void)); -void seeoff __P((int)); -void domove __P((void)); -void movobj __P((struct obj *, int, int)); -int dopickup __P((void)); -void pickup __P((int)); -void lookaround __P((void)); -int monster_nearby __P((void)); -int rroom __P((int, int)); -int cansee __P((xchar, xchar)); -int sgn __P((int)); -void setsee __P((void)); -void nomul __P((int)); -int abon __P((void)); -int dbon __P((void)); -void losestr __P((int)); -void losehp __P((int, const char *)); -void losehp_m __P((int, struct monst *)); -void losexp __P((void)); -int inv_weight __P((void)); -int inv_cnt __P((void)); -long newuexp __P((void)); +void unsee(void); +void seeoff(int); +void domove(void); +void movobj(struct obj *, int, int); +int dopickup(void); +void pickup(int); +void lookaround(void); +int monster_nearby(void); +int rroom(int, int); +int cansee(xchar, xchar); +int sgn(int); +void setsee(void); +void nomul(int); +int abon(void); +int dbon(void); +void losestr(int); +void losehp(int, const char *); +void losehp_m(int, struct monst *); +void losexp(void); +int inv_weight(void); +int inv_cnt(void); +long newuexp(void); /* hack.cmd.c */ -void rhack __P((const char *)); -int doextcmd __P((void)); -char lowc __P((int)); -char unctrl __P((int)); -int movecmd __P((int)); -int getdir __P((boolean)); -void confdir __P((void)); -int finddir __P((void)); -int isroom __P((int, int)); -int isok __P((int, int)); +void rhack(const char *); +int doextcmd(void); +char lowc(int); +char unctrl(int); +int movecmd(int); +int getdir(boolean); +void confdir(void); +int finddir(void); +int isroom(int, int); +int isok(int, int); /* hack.do.c */ -int dodrop __P((void)); -void dropx __P((struct obj *)); -void dropy __P((struct obj *)); -int doddrop __P((void)); -int dodown __P((void)); -int doup __P((void)); -void goto_level __P((int, boolean)); -int donull __P((void)); -int dopray __P((void)); -int dothrow __P((void)); -struct obj *splitobj __P((struct obj *, int)); -void more_experienced __P((int, int)); -void set_wounded_legs __P((long, int)); -void heal_legs __P((void)); +int dodrop(void); +void dropx(struct obj *); +void dropy(struct obj *); +int doddrop(void); +int dodown(void); +int doup(void); +void goto_level(int, boolean); +int donull(void); +int dopray(void); +int dothrow(void); +struct obj *splitobj(struct obj *, int); +void more_experienced(int, int); +void set_wounded_legs(long, int); +void heal_legs(void); /* hack.do_name.c */ -coord getpos __P((int, const char *)); -int do_mname __P((void)); -void do_oname __P((struct obj *)); -int ddocall __P((void)); -void docall __P((struct obj *)); -char *xmonnam __P((struct monst *, int)); -char *lmonnam __P((struct monst *)); -char *monnam __P((struct monst *)); -char *Monnam __P((struct monst *)); -char *amonnam __P((struct monst *, const char *)); -char *Amonnam __P((struct monst *, const char *)); -char *Xmonnam __P((struct monst *)); -char *visctrl __P((int)); +coord getpos(int, const char *); +int do_mname(void); +void do_oname(struct obj *); +int ddocall(void); +void docall(struct obj *); +char *xmonnam(struct monst *, int); +char *lmonnam(struct monst *); +char *monnam(struct monst *); +char *Monnam(struct monst *); +char *amonnam(struct monst *, const char *); +char *Amonnam(struct monst *, const char *); +char *Xmonnam(struct monst *); +char *visctrl(int); /* hack.do_wear.c */ -void off_msg __P((struct obj *)); -int doremarm __P((void)); -int doremring __P((void)); -int dorr __P((struct obj *)); -int cursed __P((struct obj *)); -int armoroff __P((struct obj *)); -int doweararm __P((void)); -int dowearring __P((void)); -void ringoff __P((struct obj *)); -void find_ac __P((void)); -void glibr __P((void)); -struct obj *some_armor __P((void)); -void corrode_armor __P((void)); +void off_msg(struct obj *); +int doremarm(void); +int doremring(void); +int dorr(struct obj *); +int cursed(struct obj *); +int armoroff(struct obj *); +int doweararm(void); +int dowearring(void); +void ringoff(struct obj *); +void find_ac(void); +void glibr(void); +struct obj *some_armor(void); +void corrode_armor(void); /* hack.dog.c */ -void makedog __P((void)); -void initedog __P((struct monst *)); -void losedogs __P((void)); -void keepdogs __P((void)); -void fall_down __P((struct monst *)); -int dogfood __P((struct obj *)); -int dog_move __P((struct monst *, int)); -int inroom __P((xchar, xchar)); -int tamedog __P((struct monst *, struct obj *)); +void makedog(void); +void initedog(struct monst *); +void losedogs(void); +void keepdogs(void); +void fall_down(struct monst *); +int dogfood(struct obj *); +int dog_move(struct monst *, int); +int inroom(xchar, xchar); +int tamedog(struct monst *, struct obj *); /* hack.eat.c */ -void init_uhunger __P((void)); -int opentin __P((void)); -int Meatdone __P((void)); -int doeat __P((void)); -void gethungry __P((void)); -void morehungry __P((int)); -void lesshungry __P((int)); -int unfaint __P((void)); -void newuhs __P((boolean)); -int poisonous __P((struct obj *)); -int eatcorpse __P((struct obj *)); +void init_uhunger(void); +int opentin(void); +int Meatdone(void); +int doeat(void); +void gethungry(void); +void morehungry(int); +void lesshungry(int); +int unfaint(void); +void newuhs(boolean); +int poisonous(struct obj *); +int eatcorpse(struct obj *); /* hack.end.c */ -int dodone __P((void)); -void done1 __P((int)); -void done_intr __P((int)); -void done_hangup __P((int)); -void done_in_by __P((struct monst *)); -void done __P((const char *)); -void topten __P((void)); -void outheader __P((void)); +int dodone(void); +void done1(int); +void done_intr(int); +void done_hangup(int); +void done_in_by(struct monst *); +void done(const char *); +void topten(void); +void outheader(void); struct toptenentry; -int outentry __P((int, struct toptenentry *, int)); -char *itoa __P((int)); -const char *ordin __P((int)); -void clearlocks __P((void)); -void hangup __P((int)) __attribute__((__noreturn__)); -char *eos __P((char *)); -void charcat __P((char *, int)); -void prscore __P((int, char **)); +int outentry(int, struct toptenentry *, int); +char *itoa(int); +const char *ordin(int); +void clearlocks(void); +void hangup(int) __attribute__((__noreturn__)); +char *eos(char *); +void charcat(char *, int); +void prscore(int, char **); /* hack.engrave.c */ -struct engr *engr_at __P((xchar, xchar)); -int sengr_at __P((const char *, xchar, xchar)); -void u_wipe_engr __P((int)); -void wipe_engr_at __P((xchar, xchar, xchar)); -void read_engr_at __P((int, int)); -void make_engr_at __P((int, int, const char *)); -int doengrave __P((void)); -void save_engravings __P((int)); -void rest_engravings __P((int)); -void del_engr __P((struct engr *)); +struct engr *engr_at(xchar, xchar); +int sengr_at(const char *, xchar, xchar); +void u_wipe_engr(int); +void wipe_engr_at(xchar, xchar, xchar); +void read_engr_at(int, int); +void make_engr_at(int, int, const char *); +int doengrave(void); +void save_engravings(int); +void rest_engravings(int); +void del_engr(struct engr *); /* hack.fight.c */ -int hitmm __P((struct monst *, struct monst *)); -void mondied __P((struct monst *)); -void monstone __P((struct monst *)); -int fightm __P((struct monst *)); -int thitu __P((int, int, const char *)); -boolean hmon __P((struct monst *, struct obj *, int)); -int attack __P((struct monst *)); +int hitmm(struct monst *, struct monst *); +void mondied(struct monst *); +void monstone(struct monst *); +int fightm(struct monst *); +int thitu(int, int, const char *); +boolean hmon(struct monst *, struct obj *, int); +int attack(struct monst *); /* hack.invent.c */ -struct obj *addinv __P((struct obj *)); -void useup __P((struct obj *)); -void freeinv __P((struct obj *)); -void delobj __P((struct obj *)); -void freeobj __P((struct obj *)); -void freegold __P((struct gold *)); -void deltrap __P((struct trap *)); -struct monst *m_at __P((int, int)); -struct obj *o_at __P((int, int)); -struct obj *sobj_at __P((int, int, int)); -int carried __P((struct obj *)); -int carrying __P((int)); -struct obj *o_on __P((unsigned int, struct obj *)); -struct trap *t_at __P((int, int)); -struct gold *g_at __P((int, int)); -struct obj *mkgoldobj __P((long)); -struct obj *getobj __P((const char *, const char *)); -int ckunpaid __P((struct obj *)); -int ggetobj __P((const char *, int (*fn)(struct obj *), int)); -int askchain __P((struct obj *, char *, int, int (*)(struct obj *), - int (*)(struct obj *), int)); -char obj_to_let __P((struct obj *)); -void prinv __P((struct obj *)); -int ddoinv __P((void)); -void doinv __P((char *)); -int dotypeinv __P((void)); -int dolook __P((void)); -void stackobj __P((struct obj *)); -int merged __P((struct obj *, struct obj *, int)); -int countgold __P((void)); -int doprgold __P((void)); -int doprwep __P((void)); -int doprarm __P((void)); -int doprring __P((void)); -int digit __P((int)); +struct obj *addinv(struct obj *); +void useup(struct obj *); +void freeinv(struct obj *); +void delobj(struct obj *); +void freeobj(struct obj *); +void freegold(struct gold *); +void deltrap(struct trap *); +struct monst *m_at(int, int); +struct obj *o_at(int, int); +struct obj *sobj_at(int, int, int); +int carried(struct obj *); +int carrying(int); +struct obj *o_on(unsigned int, struct obj *); +struct trap *t_at(int, int); +struct gold *g_at(int, int); +struct obj *mkgoldobj(long); +struct obj *getobj(const char *, const char *); +int ckunpaid(struct obj *); +int ggetobj(const char *, int (*fn)(struct obj *), int); +int askchain(struct obj *, char *, int, int (*)(struct obj *), + int (*)(struct obj *), int); +char obj_to_let(struct obj *); +void prinv(struct obj *); +int ddoinv(void); +void doinv(char *); +int dotypeinv(void); +int dolook(void); +void stackobj(struct obj *); +int merged(struct obj *, struct obj *, int); +int countgold(void); +int doprgold(void); +int doprwep(void); +int doprarm(void); +int doprring(void); +int digit(int); /* hack.ioctl.c */ -void getioctls __P((void)); -void setioctls __P((void)); -int dosuspend __P((void)); +void getioctls(void); +void setioctls(void); +int dosuspend(void); /* hack.lev.c */ -void savelev __P((int, xchar)); -void bwrite __P((int, const void *, unsigned)); -void saveobjchn __P((int, struct obj *)); -void savemonchn __P((int, struct monst *)); -void savegoldchn __P((int, struct gold *)); -void savetrapchn __P((int, struct trap *)); -void getlev __P((int, int, xchar)); -void mread __P((int, char *, unsigned)); -void mklev __P((void)); +void savelev(int, xchar); +void bwrite(int, const void *, unsigned); +void saveobjchn(int, struct obj *); +void savemonchn(int, struct monst *); +void savegoldchn(int, struct gold *); +void savetrapchn(int, struct trap *); +void getlev(int, int, xchar); +void mread(int, char *, unsigned); +void mklev(void); /* hack.main.c */ -void glo __P((int)); -void askname __P((void)); -void impossible __P((const char *, ...)) +void glo(int); +void askname(void); +void impossible(const char *, ...) __attribute__((__format__(__printf__, 1, 2))); -void stop_occupation __P((void)); +void stop_occupation(void); /* hack.makemon.c */ -struct monst *makemon __P((const struct permonst *, int, int)); -coord enexto __P((xchar, xchar)); -int goodpos __P((int, int)); -void rloc __P((struct monst *)); -struct monst *mkmon_at __P((int, int, int)); +struct monst *makemon(const struct permonst *, int, int); +coord enexto(xchar, xchar); +int goodpos(int, int); +void rloc(struct monst *); +struct monst *mkmon_at(int, int, int); /* hack.mhitu.c */ -int mhitu __P((struct monst *)); -int hitu __P((struct monst *, int)); +int mhitu(struct monst *); +int hitu(struct monst *, int); /* hack.mklev.c */ -void makelevel __P((void)); -int makerooms __P((void)); -void addrs __P((int, int, int, int)); -void addrsx __P((int, int, int, int, boolean)); +void makelevel(void); +int makerooms(void); +void addrs(int, int, int, int); +void addrsx(int, int, int, int, boolean); struct mkroom; -int comp __P((const void *, const void *)); -coord finddpos __P((int, int, int, int)); -int okdoor __P((int, int)); -void dodoor __P((int, int, struct mkroom *)); -void dosdoor __P((int, int, struct mkroom *, int)); -int maker __P((schar, schar, schar, schar)); -void makecorridors __P((void)); -void join __P((int, int)); -void make_niches __P((void)); -void makevtele __P((void)); -void makeniche __P((boolean)); -void mktrap __P((int, int, struct mkroom *)); +int comp(const void *, const void *); +coord finddpos(int, int, int, int); +int okdoor(int, int); +void dodoor(int, int, struct mkroom *); +void dosdoor(int, int, struct mkroom *, int); +int maker(schar, schar, schar, schar); +void makecorridors(void); +void join(int, int); +void make_niches(void); +void makevtele(void); +void makeniche(boolean); +void mktrap(int, int, struct mkroom *); /* hack.mkmaze.c */ -void makemaz __P((void)); -void walkfrom __P((int, int)); -void move __P((int *, int *, int)); -int okay __P((int, int, int)); -coord mazexy __P((void)); +void makemaz(void); +void walkfrom(int, int); +void move(int *, int *, int); +int okay(int, int, int); +coord mazexy(void); /* hack.mkobj.c */ -struct obj *mkobj_at __P((int, int, int)); -void mksobj_at __P((int, int, int)); -struct obj *mkobj __P((int)); -struct obj *mksobj __P((int)); -int letter __P((int)); -int weight __P((struct obj *)); -void mkgold __P((long, int, int)); +struct obj *mkobj_at(int, int, int); +void mksobj_at(int, int, int); +struct obj *mkobj(int); +struct obj *mksobj(int); +int letter(int); +int weight(struct obj *); +void mkgold(long, int, int); /* hack.mkshop.c */ -void mkshop __P((void)); -void mkzoo __P((int)); -const struct permonst *morguemon __P((void)); -void mkswamp __P((void)); -int nexttodoor __P((int, int)); -int has_dnstairs __P((struct mkroom *)); -int has_upstairs __P((struct mkroom *)); -int isbig __P((struct mkroom *)); -int dist2 __P((int, int, int, int)); -int sq __P((int)); +void mkshop(void); +void mkzoo(int); +const struct permonst *morguemon(void); +void mkswamp(void); +int nexttodoor(int, int); +int has_dnstairs(struct mkroom *); +int has_upstairs(struct mkroom *); +int isbig(struct mkroom *); +int dist2(int, int, int, int); +int sq(int); /* hack.mon.c */ -void movemon __P((void)); -void justswld __P((struct monst *, const char *)); -void youswld __P((struct monst *, int, int, const char *)); -int dochugw __P((struct monst *)); -int dochug __P((struct monst *)); -int m_move __P((struct monst *, int)); -void mpickgold __P((struct monst *)); -void mpickgems __P((struct monst *)); -int mfndpos __P((struct monst *, coord[9 ], int[9 ], int)); -int dist __P((int, int)); -void poisoned __P((const char *, const char *)); -void mondead __P((struct monst *)); -void replmon __P((struct monst *, struct monst *)); -void relmon __P((struct monst *)); -void monfree __P((struct monst *)); -void dmonsfree __P((void)); -void unstuck __P((struct monst *)); -void killed __P((struct monst *)); -void kludge __P((const char *, const char *)); -void rescham __P((void)); -int newcham __P((struct monst *, const struct permonst *)); -void mnexto __P((struct monst *)); -int ishuman __P((struct monst *)); -void setmangry __P((struct monst *)); -int canseemon __P((struct monst *)); +void movemon(void); +void justswld(struct monst *, const char *); +void youswld(struct monst *, int, int, const char *); +int dochugw(struct monst *); +int dochug(struct monst *); +int m_move(struct monst *, int); +void mpickgold(struct monst *); +void mpickgems(struct monst *); +int mfndpos(struct monst *, coord[9 ], int[9 ], int); +int dist(int, int); +void poisoned(const char *, const char *); +void mondead(struct monst *); +void replmon(struct monst *, struct monst *); +void relmon(struct monst *); +void monfree(struct monst *); +void dmonsfree(void); +void unstuck(struct monst *); +void killed(struct monst *); +void kludge(const char *, const char *); +void rescham(void); +int newcham(struct monst *, const struct permonst *); +void mnexto(struct monst *); +int ishuman(struct monst *); +void setmangry(struct monst *); +int canseemon(struct monst *); /* hack.monst.c */ /* hack.o_init.c */ -int letindex __P((int)); -void init_objects __P((void)); -int probtype __P((int)); -void setgemprobs __P((void)); -void oinit __P((void)); -void savenames __P((int)); -void restnames __P((int)); -int dodiscovered __P((void)); -int interesting_to_discover __P((int)); +int letindex(int); +void init_objects(void); +int probtype(int); +void setgemprobs(void); +void oinit(void); +void savenames(int); +void restnames(int); +int dodiscovered(void); +int interesting_to_discover(int); /* hack.objnam.c */ -char *strprepend __P((char *, char *)); -char *sitoa __P((int)); -char *typename __P((int)); -char *xname __P((struct obj *)); -char *doname __P((struct obj *)); -void setan __P((const char *, char *)); -char *aobjnam __P((struct obj *, const char *)); -char *Doname __P((struct obj *)); -struct obj *readobjnam __P((char *)); +char *strprepend(char *, char *); +char *sitoa(int); +char *typename(int); +char *xname(struct obj *); +char *doname(struct obj *); +void setan(const char *, char *); +char *aobjnam(struct obj *, const char *); +char *Doname(struct obj *); +struct obj *readobjnam(char *); /* hack.options.c */ -void initoptions __P((void)); -void parseoptions __P((char *, boolean)); -int doset __P((void)); +void initoptions(void); +void parseoptions(char *, boolean); +int doset(void); /* hack.pager.c */ -int dowhatis __P((void)); -void intruph __P((int)); -void page_more __P((FILE *, int)); -void set_whole_screen __P((void)); -int readnews __P((void)); -void set_pager __P((int)); -int page_line __P((const char *)); -void cornline __P((int, const char *)); -int dohelp __P((void)); -int page_file __P((const char *, boolean)); -int dosh __P((void)); -int child __P((int)); +int dowhatis(void); +void intruph(int); +void page_more(FILE *, int); +void set_whole_screen(void); +int readnews(void); +void set_pager(int); +int page_line(const char *); +void cornline(int, const char *); +int dohelp(void); +int page_file(const char *, boolean); +int dosh(void); +int child(int); /* hack.potion.c */ -int dodrink __P((void)); -void pluslvl __P((void)); -void strange_feeling __P((struct obj *, const char *)); -void potionhit __P((struct monst *, struct obj *)); -void potionbreathe __P((struct obj *)); -int dodip __P((void)); -void ghost_from_bottle __P((void)); +int dodrink(void); +void pluslvl(void); +void strange_feeling(struct obj *, const char *); +void potionhit(struct monst *, struct obj *); +void potionbreathe(struct obj *); +int dodip(void); +void ghost_from_bottle(void); /* hack.pri.c */ -void swallowed __P((void)); -void panic __P((const char *, ...)) +void swallowed(void); +void panic(const char *, ...) __attribute__((__format__(__printf__, 1, 2))); -void atl __P((int, int, int)); -void on_scr __P((int, int)); -void tmp_at __P((schar, schar)); -void Tmp_at __P((schar, schar)); -void setclipped __P((void)) __attribute__((__noreturn__)); -void at __P((xchar, xchar, int)); -void prme __P((void)); -int doredraw __P((void)); -void docrt __P((void)); -void docorner __P((int, int)); -void curs_on_u __P((void)); -void pru __P((void)); -void prl __P((int, int)); -char news0 __P((xchar, xchar)); -void newsym __P((int, int)); -void mnewsym __P((int, int)); -void nosee __P((int, int)); -void prl1 __P((int, int)); -void nose1 __P((int, int)); -int vism_at __P((int, int)); -void pobj __P((struct obj *)); -void unpobj __P((struct obj *)); -void seeobjs __P((void)); -void seemons __P((void)); -void pmon __P((struct monst *)); -void unpmon __P((struct monst *)); -void nscr __P((void)); -void cornbot __P((int)); -void bot __P((void)); -void mstatusline __P((struct monst *)); -void cls __P((void)); +void atl(int, int, int); +void on_scr(int, int); +void tmp_at(schar, schar); +void Tmp_at(schar, schar); +void setclipped(void) __attribute__((__noreturn__)); +void at(xchar, xchar, int); +void prme(void); +int doredraw(void); +void docrt(void); +void docorner(int, int); +void curs_on_u(void); +void pru(void); +void prl(int, int); +char news0(xchar, xchar); +void newsym(int, int); +void mnewsym(int, int); +void nosee(int, int); +void prl1(int, int); +void nose1(int, int); +int vism_at(int, int); +void pobj(struct obj *); +void unpobj(struct obj *); +void seeobjs(void); +void seemons(void); +void pmon(struct monst *); +void unpmon(struct monst *); +void nscr(void); +void cornbot(int); +void bot(void); +void mstatusline(struct monst *); +void cls(void); /* hack.read.c */ -int doread __P((void)); -int identify __P((struct obj *)); -void litroom __P((boolean)); -int monstersym __P((int)); +int doread(void); +int identify(struct obj *); +void litroom(boolean); +int monstersym(int); /* hack.rip.c */ -void outrip __P((void)); -void center __P((int, char *)); +void outrip(void); +void center(int, char *); /* hack.rumors.c */ -void init_rumors __P((FILE *)); -int skipline __P((FILE *)); -void outline __P((FILE *)); -void outrumor __P((void)); -int used __P((int)); +void init_rumors(FILE *); +int skipline(FILE *); +void outline(FILE *); +void outrumor(void); +int used(int); /* hack.save.c */ -int dosave __P((void)); -int dosave0 __P((int)); -int dorecover __P((int)); -struct obj *restobjchn __P((int)); -struct monst *restmonchn __P((int)); +int dosave(void); +int dosave0(int); +int dorecover(int); +struct obj *restobjchn(int); +struct monst *restmonchn(int); /* hack.search.c */ -int findit __P((void)); -int dosearch __P((void)); -int doidtrap __P((void)); -void wakeup __P((struct monst *)); -void seemimic __P((struct monst *)); +int findit(void); +int dosearch(void); +int doidtrap(void); +void wakeup(struct monst *); +void seemimic(struct monst *); /* hack.shk.c */ -void obfree __P((struct obj *, struct obj *)); -void paybill __P((void)); -char *shkname __P((struct monst *)); -void shkdead __P((struct monst *)); -void replshk __P((struct monst *, struct monst *)); -int inshop __P((void)); -int dopay __P((void)); +void obfree(struct obj *, struct obj *); +void paybill(void); +char *shkname(struct monst *); +void shkdead(struct monst *); +void replshk(struct monst *, struct monst *); +int inshop(void); +int dopay(void); struct bill_x; -struct obj *bp_to_obj __P((struct bill_x *)); -void addtobill __P((struct obj *)); -void splitbill __P((struct obj *, struct obj *)); -void subfrombill __P((struct obj *)); -int doinvbill __P((int)); -int shkcatch __P((struct obj *)); -int shk_move __P((struct monst *)); -void shopdig __P((int)); -int online __P((int, int)); -int follower __P((struct monst *)); +struct obj *bp_to_obj(struct bill_x *); +void addtobill(struct obj *); +void splitbill(struct obj *, struct obj *); +void subfrombill(struct obj *); +int doinvbill(int); +int shkcatch(struct obj *); +int shk_move(struct monst *); +void shopdig(int); +int online(int, int); +int follower(struct monst *); /* hack.shknam.c */ -void findname __P((char *, int)); +void findname(char *, int); /* hack.steal.c */ -long somegold __P((void)); -void stealgold __P((struct monst *)); -int stealarm __P((void)); -int steal __P((struct monst *)); -void mpickobj __P((struct monst *, struct obj *)); -int stealamulet __P((struct monst *)); -void relobj __P((struct monst *, int)); +long somegold(void); +void stealgold(struct monst *); +int stealarm(void); +int steal(struct monst *); +void mpickobj(struct monst *, struct obj *); +int stealamulet(struct monst *); +void relobj(struct monst *, int); /* hack.termcap.c */ -void startup __P((void)); -void start_screen __P((void)); -void end_screen __P((void)); -void curs __P((int, int)); -void nocmov __P((int, int)); -void cmov __P((int, int)); -int xputc __P((int)); -void xputs __P((char *)); -void cl_end __P((void)); -void clear_screen __P((void)); -void home __P((void)); -void standoutbeg __P((void)); -void standoutend __P((void)); -void backsp __P((void)); -void bell __P((void)); -void delay_output __P((void)); -void cl_eos __P((void)); +void startup(void); +void start_screen(void); +void end_screen(void); +void curs(int, int); +void nocmov(int, int); +void cmov(int, int); +int xputc(int); +void xputs(char *); +void cl_end(void); +void clear_screen(void); +void home(void); +void standoutbeg(void); +void standoutend(void); +void backsp(void); +void bell(void); +void delay_output(void); +void cl_eos(void); /* hack.timeout.c */ -void timeout __P((void)); -void stoned_dialogue __P((void)); +void timeout(void); +void stoned_dialogue(void); /* hack.topl.c */ -int doredotopl __P((void)); -void redotoplin __P((void)); -void remember_topl __P((void)); -void addtopl __P((const char *)); -void xmore __P((const char *)); -void more __P((void)); -void cmore __P((const char *)); -void clrlin __P((void)); -void pline __P((const char *, ...)) +int doredotopl(void); +void redotoplin(void); +void remember_topl(void); +void addtopl(const char *); +void xmore(const char *); +void more(void); +void cmore(const char *); +void clrlin(void); +void pline(const char *, ...) __attribute__((__format__(__printf__, 1, 2))); -void vpline __P((const char *, va_list)) +void vpline(const char *, va_list) __attribute__((__format__(__printf__, 1, 0))); -void putsym __P((int)); -void putstr __P((const char *)); +void putsym(int); +void putstr(const char *); /* hack.track.c */ -void initrack __P((void)); -void settrack __P((void)); -coord *gettrack __P((int, int)); +void initrack(void); +void settrack(void); +coord *gettrack(int, int); /* hack.trap.c */ -struct trap *maketrap __P((int, int, int)); -void dotrap __P((struct trap *)); -int mintrap __P((struct monst *)); -void selftouch __P((const char *)); -void float_up __P((void)); -void float_down __P((void)); -void vtele __P((void)); -void tele __P((void)); -void teleds __P((int, int)); -int teleok __P((int, int)); -int dotele __P((void)); -void placebc __P((int)); -void unplacebc __P((void)); -void level_tele __P((void)); -void drown __P((void)); +struct trap *maketrap(int, int, int); +void dotrap(struct trap *); +int mintrap(struct monst *); +void selftouch(const char *); +void float_up(void); +void float_down(void); +void vtele(void); +void tele(void); +void teleds(int, int); +int teleok(int, int); +int dotele(void); +void placebc(int); +void unplacebc(void); +void level_tele(void); +void drown(void); /* hack.tty.c */ -void gettty __P((void)); -void settty __P((const char *)); -void setctty __P((void)); -void setftty __P((void)); -void error __P((const char *, ...)) +void gettty(void); +void settty(const char *); +void setctty(void); +void setftty(void); +void error(const char *, ...) __attribute__((__format__(__printf__, 1, 2),__noreturn__)); -void getlin __P((char *)); -void getret __P((void)); -void cgetret __P((const char *)); -void xwaitforspace __P((const char *)); -char *parse __P((void)); -char readchar __P((void)); -void end_of_input __P((void)) __attribute__((__noreturn__)); +void getlin(char *); +void getret(void); +void cgetret(const char *); +void xwaitforspace(const char *); +char *parse(void); +char readchar(void); +void end_of_input(void) __attribute__((__noreturn__)); /* hack.u_init.c */ -void u_init __P((void)); +void u_init(void); struct trobj; -void ini_inv __P((struct trobj *)); -void wiz_inv __P((void)); -void plnamesuffix __P((void)); -int role_index __P((int)); +void ini_inv(struct trobj *); +void wiz_inv(void); +void plnamesuffix(void); +int role_index(int); /* hack.unix.c */ -void setrandom __P((void)); -struct tm *getlt __P((void)); -int getyear __P((void)); -char *getdate __P((void)); -int phase_of_the_moon __P((void)); -int night __P((void)); -int midnight __P((void)); -void gethdate __P((char *)); -int uptodate __P((int)); -int veryold __P((int)); -void getlock __P((void)); -void getmailstatus __P((void)); -void ckmailstatus __P((void)); -void newmail __P((void)); -void mdrush __P((struct monst *, boolean)); -void readmail __P((void)); -void regularize __P((char *)); +void setrandom(void); +struct tm *getlt(void); +int getyear(void); +char *getdate(void); +int phase_of_the_moon(void); +int night(void); +int midnight(void); +void gethdate(char *); +int uptodate(int); +int veryold(int); +void getlock(void); +void getmailstatus(void); +void ckmailstatus(void); +void newmail(void); +void mdrush(struct monst *, boolean); +void readmail(void); +void regularize(char *); /* hack.vault.c */ -void setgd __P((void)); -int gd_move __P((void)); -void gddead __P((void)); -void replgd __P((struct monst *, struct monst *)); -void invault __P((void)); +void setgd(void); +int gd_move(void); +void gddead(void); +void replgd(struct monst *, struct monst *); +void invault(void); /* hack.version.c */ -int doversion __P((void)); +int doversion(void); /* hack.wield.c */ -void setuwep __P((struct obj *)); -int dowield __P((void)); -void corrode_weapon __P((void)); -int chwepon __P((struct obj *, int)); +void setuwep(struct obj *); +int dowield(void); +void corrode_weapon(void); +int chwepon(struct obj *, int); /* hack.wizard.c */ -void amulet __P((void)); -int wiz_hit __P((struct monst *)); -void inrange __P((struct monst *)); -void aggravate __P((void)); -void clonewiz __P((struct monst *)); +void amulet(void); +int wiz_hit(struct monst *); +void inrange(struct monst *); +void aggravate(void); +void clonewiz(struct monst *); /* hack.worm.c */ #ifndef NOWORM -int getwn __P((struct monst *)); -void initworm __P((struct monst *)); -void worm_move __P((struct monst *)); -void worm_nomove __P((struct monst *)); -void wormdead __P((struct monst *)); -void wormhit __P((struct monst *)); -void wormsee __P((unsigned)); +int getwn(struct monst *); +void initworm(struct monst *); +void worm_move(struct monst *); +void worm_nomove(struct monst *); +void wormdead(struct monst *); +void wormhit(struct monst *); +void wormsee(unsigned); struct wseg; -void pwseg __P((struct wseg *)); -void cutworm __P((struct monst *, xchar, xchar, uchar)); -void remseg __P((struct wseg *)); +void pwseg(struct wseg *); +void cutworm(struct monst *, xchar, xchar, uchar); +void remseg(struct wseg *); #endif /* hack.worn.c */ -void setworn __P((struct obj *, long)); -void setnotworn __P((struct obj *)); +void setworn(struct obj *, long); +void setnotworn(struct obj *); /* hack.zap.c */ -void bhitm __P((struct monst *, struct obj *)); -int bhito __P((struct obj *, struct obj *)); -int dozap __P((void)); -const char *exclam __P((int)); -void hit __P((const char *, struct monst *, const char *)); -void miss __P((const char *, struct monst *)); -struct monst *bhit __P((int, int, int, int, +void bhitm(struct monst *, struct obj *); +int bhito(struct obj *, struct obj *); +int dozap(void); +const char *exclam(int); +void hit(const char *, struct monst *, const char *); +void miss(const char *, struct monst *); +struct monst *bhit(int, int, int, int, void (*)(struct monst *, struct obj *), int (*)(struct obj *, struct obj *), - struct obj *)); -struct monst *boomhit __P((int, int)); -char dirlet __P((int, int)); -void buzz __P((int, xchar, xchar, int, int)); -int zhit __P((struct monst *, int)); -int revive __P((struct obj *)); -void rloco __P((struct obj *)); -void fracture_rock __P((struct obj *)); -void burn_scrolls __P((void)); + struct obj *); +struct monst *boomhit(int, int); +char dirlet(int, int); +void buzz(int, xchar, xchar, int, int); +int zhit(struct monst *, int); +int revive(struct obj *); +void rloco(struct obj *); +void fracture_rock(struct obj *); +void burn_scrolls(void); /* rnd.c */ -int rn1 __P((int, int)); -int rn2 __P((int)); -int rnd __P((int)); -int d __P((int, int)); +int rn1(int, int); +int rn2(int); +int rnd(int); +int d(int, int); #endif /* _EXTERN_H_ */ diff --git a/hack/hack.apply.c b/hack/hack.apply.c index 91a222b..391cbf4 100644 --- a/hack/hack.apply.c +++ b/hack/hack.apply.c @@ -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, @@ -63,7 +63,7 @@ #include #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 */ #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.mkroom.h" -static void use_camera __P((struct obj *)); -static int in_ice_box __P((struct obj *)); -static int ck_ice_box __P((struct obj *)); -static int out_ice_box __P((struct obj *)); -static void use_ice_box __P((struct obj *)); -static struct monst *bchit __P((int, int , int , int)); -static void use_whistle __P((struct obj *)); -static void use_magic_whistle __P((struct obj *)); -static int dig __P((void)); -static int use_pick_axe __P((struct obj *)); +static void use_camera(struct obj *); +static int in_ice_box(struct obj *); +static int ck_ice_box(struct obj *); +static int out_ice_box(struct obj *); +static void use_ice_box(struct obj *); +static struct monst *bchit(int, int , int , int); +static void use_whistle(struct obj *); +static void use_magic_whistle(struct obj *); +static int dig(void); +static int use_pick_axe(struct obj *); int doapply() diff --git a/hack/hack.do.c b/hack/hack.do.c index c02be1d..b606eda 100644 --- a/hack/hack.do.c +++ b/hack/hack.do.c @@ -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, @@ -63,7 +63,7 @@ #include #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 */ /* 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 -static int drop __P((struct obj *)); +static int drop(struct obj *); int dodrop() @@ -406,8 +406,8 @@ dothrow() mon = bhit(u.dx, u.dy, (obj->otyp == ICE_BOX) ? 1 : (!Punished || obj != uball) ? 8 : !u.ustuck ? 5 : 1, obj->olet, - (void (*) __P((struct monst *, struct obj *))) 0, - (int (*) __P((struct obj *, struct obj *))) 0, obj); + (void (*)(struct monst *, struct obj *)) 0, + (int (*)(struct obj *, struct obj *)) 0, obj); } if (mon) { /* awake monster if sleeping */ diff --git a/hack/hack.h b/hack/hack.h index b088690..9ca5d82 100644 --- a/hack/hack.h +++ b/hack/hack.h @@ -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, @@ -110,7 +110,7 @@ struct prop { #define RIGHT_SIDE RIGHT_RING #define BOTH_SIDES (LEFT_SIDE | RIGHT_SIDE) long p_flgs; - void (*p_tofn) __P((void)); /* called after timeout */ + void (*p_tofn)(void); /* called after timeout */ }; 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 vowels[]; extern coord bhitpos; /* place where thrown weapon falls to the ground */ -extern int (*afternmv) __P((void)); -extern int (*occupation) __P((void)); +extern int (*afternmv)(void); +extern int (*occupation)(void); extern int CO, LI; /* usually COLNO and ROWNO+2 */ extern int bases[]; extern int doorindex; diff --git a/hack/hack.invent.c b/hack/hack.invent.c index d4a7d2e..c33d502 100644 --- a/hack/hack.invent.c +++ b/hack/hack.invent.c @@ -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, @@ -63,7 +63,7 @@ #include #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 */ #include @@ -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 void assigninvlet __P((struct obj *)); -static char *xprname __P((struct obj *, char)); +static void assigninvlet(struct obj *); +static char *xprname(struct obj *, char); static void assigninvlet(otmp) @@ -566,7 +566,7 @@ ckunpaid(otmp) int ggetobj(word, fn, max) const char *word; - int (*fn) __P((struct obj *)); + int (*fn)(struct obj *); int max; { char buf[BUFSZ]; @@ -575,8 +575,8 @@ ggetobj(word, fn, max) int oletct = 0, iletct = 0; boolean allflag = FALSE; char olets[20], ilets[20]; - int (*ckfn) __P((struct obj *)) = - (int (*) __P((struct obj *))) 0; + int (*ckfn)(struct obj *) = + (int (*)(struct obj *)) 0; xchar allowgold = (u.ugold && !strcmp(word, "drop")) ? 1 : 0; /* BAH */ if (!invent && !allowgold) { pline("You have nothing to %s.", word); @@ -652,8 +652,8 @@ askchain(objchn, olets, allflag, fn, ckfn, max) struct obj *objchn; char *olets; int allflag; - int (*fn) __P((struct obj *)); - int (*ckfn) __P((struct obj *)); + int (*fn)(struct obj *); + int (*ckfn)(struct obj *); int max; { struct obj *otmp, *otmp2; diff --git a/hack/hack.main.c b/hack/hack.main.c index 7530220..ce4715c 100644 --- a/hack/hack.main.c +++ b/hack/hack.main.c @@ -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, @@ -63,7 +63,7 @@ #include #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 */ #include @@ -79,8 +79,8 @@ __RCSID("$NetBSD: hack.main.c,v 1.8 2003/04/02 18:36:37 jsm Exp $"); #define gamename "hack" #endif -int (*afternmv) __P((void)); -int (*occupation) __P((void)); +int (*afternmv)(void); +int (*occupation)(void); const char *occtxt; /* defined when occupation != NULL */ 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 obuf[BUFSIZ]; /* BUFSIZ is defined in stdio.h */ -int main __P((int, char *[])); -static void chdirx __P((const char *, boolean)); +int main(int, char *[]); +static void chdirx(const char *, boolean); int main(argc, argv) diff --git a/hack/hack.options.c b/hack/hack.options.c index 39fe328..ea55cb8 100644 --- a/hack/hack.options.c +++ b/hack/hack.options.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.options.c,v 1.6 2003/04/02 18:36:39 jsm Exp $ */ +/* $NetBSD: hack.options.c,v 1.7 2004/01/01 16:02:51 jsm Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.options.c,v 1.6 2003/04/02 18:36:39 jsm Exp $"); +__RCSID("$NetBSD: hack.options.c,v 1.7 2004/01/01 16:02:51 jsm Exp $"); #endif /* not lint */ #include diff --git a/hack/hack.pri.c b/hack/hack.pri.c index 4305fe6..410aa72 100644 --- a/hack/hack.pri.c +++ b/hack/hack.pri.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.pri.c,v 1.7 1.8 2003/04/02 18:36:39 jsm Exp $ */ +/* $NetBSD: hack.pri.c,v 1.8 2003/04/02 18:36:39 jsm Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, diff --git a/hack/hack.shk.c b/hack/hack.shk.c index 2e826bd..ee06653 100644 --- a/hack/hack.shk.c +++ b/hack/hack.shk.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.shk.c,v 1.6 2003/04/02 18:36:40 jsm Exp $ */ +/* $NetBSD: hack.shk.c,v 1.7 2004/01/27 20:30:29 jsm Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.shk.c,v 1.6 2003/04/02 18:36:40 jsm Exp $"); +__RCSID("$NetBSD: hack.shk.c,v 1.7 2004/01/27 20:30:29 jsm Exp $"); #endif /* not lint */ #include @@ -71,14 +71,14 @@ __RCSID("$NetBSD: hack.shk.c,v 1.6 2003/04/02 18:36:40 jsm Exp $"); #include "extern.h" #ifndef QUEST -static void setpaid __P((void)); -static void addupbill __P((void)); -static void findshk __P((int)); -static struct bill_x *onbill __P((struct obj *)); -static void pay __P((long, struct monst *)); -static int dopayobj __P((struct bill_x *)); -static int getprice __P((struct obj *)); -static int realhunger __P((void)); +static void setpaid(void); +static void addupbill(void); +static void findshk(int); +static struct bill_x *onbill(struct obj *); +static void pay(long, struct monst *); +static int dopayobj(struct bill_x *); +static int getprice(struct obj *); +static int realhunger(void); #endif #ifdef QUEST diff --git a/hack/hack.vault.c b/hack/hack.vault.c index d2fdb60..f312bf1 100644 --- a/hack/hack.vault.c +++ b/hack/hack.vault.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.vault.c,v 1.6 2003/04/02 18:36:41 jsm Exp $ */ +/* $NetBSD: hack.vault.c,v 1.7 2004/01/27 20:30:29 jsm Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.vault.c,v 1.6 2003/04/02 18:36:41 jsm Exp $"); +__RCSID("$NetBSD: hack.vault.c,v 1.7 2004/01/27 20:30:29 jsm Exp $"); #endif /* not lint */ #include "hack.h" @@ -114,8 +114,8 @@ static struct monst *guard; static int gdlevel; #define EGD ((struct egd *)(&(guard->mextra[0]))) -static void restfakecorr __P((void)); -static int goldincorridor __P((void)); +static void restfakecorr(void); +static int goldincorridor(void); static void restfakecorr() diff --git a/hack/hack.zap.c b/hack/hack.zap.c index afddab1..e974d2b 100644 --- a/hack/hack.zap.c +++ b/hack/hack.zap.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.zap.c,v 1.6 2003/04/02 18:36:42 jsm Exp $ */ +/* $NetBSD: hack.zap.c,v 1.7 2004/01/27 20:30:29 jsm Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.zap.c,v 1.6 2003/04/02 18:36:42 jsm Exp $"); +__RCSID("$NetBSD: hack.zap.c,v 1.7 2004/01/27 20:30:29 jsm Exp $"); #endif /* not lint */ #include "hack.h" @@ -386,8 +386,8 @@ bhit(ddx, ddy, range, sym, fhitm, fhito, obj) int ddx, ddy, range; /* direction and range */ char sym; /* symbol displayed on path */ /* fns called when mon/obj hit */ - void (*fhitm) __P((struct monst *, struct obj *)); - int (*fhito) __P((struct obj *, struct obj *)); + void (*fhitm)(struct monst *, struct obj *); + int (*fhito)(struct obj *, struct obj *); struct obj *obj; /* 2nd arg to fhitm/fhito */ { struct monst *mtmp; diff --git a/hangman/hangman.h b/hangman/hangman.h index 3389f2d..ba7d8d0 100644 --- a/hangman/hangman.h +++ b/hangman/hangman.h @@ -1,4 +1,4 @@ -/* $NetBSD: hangman.h,v 1.12 2003/08/07 09:37:21 agc Exp $ */ +/* $NetBSD: hangman.h,v 1.13 2004/01/27 20:30:29 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -81,14 +81,14 @@ extern FILE *Dict; extern off_t Dict_size; -void die __P((int)) __attribute__((__noreturn__)); -void endgame __P((void)); -int main __P((int, char *[])); -void getguess __P((void)); -void getword __P((void)); -void playgame __P((void)); -void prdata __P((void)); -void prman __P((void)); -void prword __P((void)); -int readch __P((void)); -void setup __P((void)); +void die(int) __attribute__((__noreturn__)); +void endgame(void); +int main(int, char *[]); +void getguess(void); +void getword(void); +void playgame(void); +void prdata(void); +void prman(void); +void prword(void); +int readch(void); +void setup(void); diff --git a/hunt/README.linux b/hunt/README.linux deleted file mode 100644 index 1d42d10..0000000 --- a/hunt/README.linux +++ /dev/null @@ -1,31 +0,0 @@ -1997-12-19 - -I have replaced the old hunt port, which was rather a mess, with a version -based on that in NetBSD-current. This version now uses internet domain -sockets rather than Unix domain sockets, but is almost completely untested. -The original README.linux is below. - -Joseph S. Myers -jsm@polyomino.org.uk - -8/25/93 - -Finally, we have a version of hunt that appears to work!!!!!! -It hasn't been extensively tested, and may contain many bugs. Note, -any problems would most likely be due to my mangling/porting the code. -The original authors have done a nice job. - -Also, you can go through the Makefile and specify your desired game -parameters. Be careful what you change, this Linux version is rather -fragile. Any volunteers to sort out running over a network? - -One hint for those who have never played hunt before ... - 1. Start the hunt driver: % /usr/sbin/huntd & - 2. Now start hunt: % /usr/games/hunt [options] -In other words, for best results, get the driver running first. - -Happy hunting! (And if you ever see "black tite" show up in one of your -hunt games, RUN!!!!!) - -Curt Olson -curt@sledge.mn.org diff --git a/hunt/hunt/hunt.c b/hunt/hunt/hunt.c index e322754..f3be6a8 100644 --- a/hunt/hunt/hunt.c +++ b/hunt/hunt/hunt.c @@ -1,4 +1,4 @@ -/* $NetBSD: hunt.c,v 1.20 2003/06/11 12:04:06 wiz Exp $ */ +/* $NetBSD: hunt.c,v 1.22 2004/02/08 22:23:50 jsm Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. * All rights reserved. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hunt.c,v 1.20 2003/06/11 12:04:06 wiz Exp $"); +__RCSID("$NetBSD: hunt.c,v 1.22 2004/02/08 22:23:50 jsm Exp $"); #endif /* not lint */ # include @@ -112,15 +112,15 @@ static int in_visual; extern int cur_row, cur_col; -void dump_scores __P((SOCKET)); -long env_init __P((long)); -void fill_in_blanks __P((void)); -void leave __P((int, const char *)) __attribute__((__noreturn__)); -void leavex __P((int, const char *)) __attribute__((__noreturn__)); -void fincurs __P((void)); -int main __P((int, char *[])); +void dump_scores(SOCKET); +long env_init(long); +void fill_in_blanks(void); +void leave(int, const char *) __attribute__((__noreturn__)); +void leavex(int, const char *) __attribute__((__noreturn__)); +void fincurs(void); +int main(int, char *[]); # ifdef INTERNET -SOCKET *list_drivers __P((void)); +SOCKET *list_drivers(void); # endif extern int Otto_mode; diff --git a/hunt/hunt/otto.c b/hunt/hunt/otto.c index 758719e..3fcaaee 100644 --- a/hunt/hunt/otto.c +++ b/hunt/hunt/otto.c @@ -1,4 +1,4 @@ -/* $NetBSD: otto.c,v 1.5 2003/06/11 12:00:21 wiz Exp $ */ +/* $NetBSD: otto.c,v 1.7 2004/02/08 22:23:50 jsm Exp $ */ # ifdef OTTO /* * Copyright (c) 1983-2003, Regents of the University of California. @@ -45,7 +45,7 @@ #include #ifndef lint -__RCSID("$NetBSD: otto.c,v 1.5 2003/06/11 12:00:21 wiz Exp $"); +__RCSID("$NetBSD: otto.c,v 1.7 2004/02/08 22:23:50 jsm Exp $"); #endif /* not lint */ # include @@ -142,15 +142,15 @@ STATIC int num_turns; /* for wandering */ STATIC char been_there[HEIGHT][WIDTH2]; STATIC struct itimerval pause_time = { { 0, 0 }, { 0, 55000 }}; -STATIC void attack __P((int, struct item *)); -STATIC void duck __P((int)); -STATIC void face_and_move_direction __P((int, int)); -STATIC int go_for_ammo __P((char)); -STATIC void ottolook __P((int, struct item *)); -STATIC void look_around __P((void)); -STATIC SIGNAL_TYPE nothing __P((int)); -STATIC int stop_look __P((struct item *, char, int, int)); -STATIC void wander __P((void)); +STATIC void attack(int, struct item *); +STATIC void duck(int); +STATIC void face_and_move_direction(int, int); +STATIC int go_for_ammo(char); +STATIC void ottolook(int, struct item *); +STATIC void look_around(void); +STATIC SIGNAL_TYPE nothing(int); +STATIC int stop_look(struct item *, char, int, int); +STATIC void wander(void); extern int Otto_count; diff --git a/hunt/hunt/playit.c b/hunt/hunt/playit.c index 2125c40..9acf86e 100644 --- a/hunt/hunt/playit.c +++ b/hunt/hunt/playit.c @@ -1,4 +1,4 @@ -/* $NetBSD: playit.c,v 1.7 2003/06/11 12:00:21 wiz Exp $ */ +/* $NetBSD: playit.c,v 1.8 2004/01/27 20:30:29 jsm Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. * All rights reserved. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: playit.c,v 1.7 2003/06/11 12:00:21 wiz Exp $"); +__RCSID("$NetBSD: playit.c,v 1.8 2004/01/27 20:30:29 jsm Exp $"); #endif /* not lint */ # include @@ -95,8 +95,8 @@ static unsigned char ibuf[256], *iptr = ibuf; extern int _putchar(); #endif -static unsigned char getchr __P((void)); -static void send_stuff __P((void)); +static unsigned char getchr(void); +static void send_stuff(void); /* * playit: diff --git a/hunt/huntd/driver.c b/hunt/huntd/driver.c index b106130..6b756ab 100644 --- a/hunt/huntd/driver.c +++ b/hunt/huntd/driver.c @@ -1,4 +1,4 @@ -/* $NetBSD: driver.c,v 1.9 2003/06/11 12:00:22 wiz Exp $ */ +/* $NetBSD: driver.c,v 1.10 2004/01/27 20:30:29 jsm Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. * All rights reserved. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: driver.c,v 1.9 2003/06/11 12:00:22 wiz Exp $"); +__RCSID("$NetBSD: driver.c,v 1.10 2004/01/27 20:30:29 jsm Exp $"); #endif /* not lint */ # include @@ -69,13 +69,13 @@ u_short stat_port; /* port # of statistics tcp socket */ # define DAEMON_SIZE (sizeof Daemon - 1) # endif -static void clear_scores __P((void)); -static int havechar __P((PLAYER *, int)); -static void init __P((void)); - int main __P((int, char *[], char *[])); -static void makeboots __P((void)); -static void send_stats __P((void)); -static void zap __P((PLAYER *, FLAG, int)); +static void clear_scores(void); +static int havechar(PLAYER *, int); +static void init(void); + int main(int, char *[], char *[]); +static void makeboots(void); +static void send_stats(void); +static void zap(PLAYER *, FLAG, int); /* diff --git a/hunt/huntd/execute.c b/hunt/huntd/execute.c index 52db473..36ee8b4 100644 --- a/hunt/huntd/execute.c +++ b/hunt/huntd/execute.c @@ -1,4 +1,4 @@ -/* $NetBSD: execute.c,v 1.3 2003/06/11 12:00:22 wiz Exp $ */ +/* $NetBSD: execute.c,v 1.4 2004/01/27 20:30:29 jsm Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. * All rights reserved. @@ -32,19 +32,19 @@ #include #ifndef lint -__RCSID("$NetBSD: execute.c,v 1.3 2003/06/11 12:00:22 wiz Exp $"); +__RCSID("$NetBSD: execute.c,v 1.4 2004/01/27 20:30:29 jsm Exp $"); #endif /* not lint */ # include # include "hunt.h" -static void cloak __P((PLAYER *)); -static void face __P((PLAYER *, int)); -static void fire __P((PLAYER *, int)); -static void fire_slime __P((PLAYER *, int)); -static void move_player __P((PLAYER *, int)); -static void pickup __P((PLAYER *, int, int, int, int)); -static void scan __P((PLAYER *)); +static void cloak(PLAYER *); +static void face(PLAYER *, int); +static void fire(PLAYER *, int); +static void fire_slime(PLAYER *, int); +static void move_player(PLAYER *, int); +static void pickup(PLAYER *, int, int, int, int); +static void scan(PLAYER *); # ifdef MONITOR diff --git a/hunt/huntd/expl.c b/hunt/huntd/expl.c index 70acdac..7b4ad91 100644 --- a/hunt/huntd/expl.c +++ b/hunt/huntd/expl.c @@ -1,4 +1,4 @@ -/* $NetBSD: expl.c,v 1.3 2003/06/11 12:00:22 wiz Exp $ */ +/* $NetBSD: expl.c,v 1.4 2004/01/27 20:30:29 jsm Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. * All rights reserved. @@ -32,13 +32,13 @@ #include #ifndef lint -__RCSID("$NetBSD: expl.c,v 1.3 2003/06/11 12:00:22 wiz Exp $"); +__RCSID("$NetBSD: expl.c,v 1.4 2004/01/27 20:30:29 jsm Exp $"); #endif /* not lint */ # include # include "hunt.h" -static void remove_wall __P((int, int)); +static void remove_wall(int, int); /* diff --git a/hunt/huntd/faketalk.c b/hunt/huntd/faketalk.c index dcd1709..a0e6598 100644 --- a/hunt/huntd/faketalk.c +++ b/hunt/huntd/faketalk.c @@ -1,4 +1,4 @@ -/* $NetBSD: faketalk.c,v 1.8 2003/06/11 12:00:22 wiz Exp $ */ +/* $NetBSD: faketalk.c,v 1.10 2004/02/08 22:23:50 jsm Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. * All rights reserved. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: faketalk.c,v 1.8 2003/06/11 12:00:22 wiz Exp $"); +__RCSID("$NetBSD: faketalk.c,v 1.10 2004/02/08 22:23:50 jsm Exp $"); #endif /* not lint */ #include "bsd.h" @@ -66,8 +66,8 @@ extern char *my_machine_name; extern char *First_arg, *Last_arg; extern char **environ; -static void do_announce __P((char *)); -SIGNAL_TYPE exorcise __P((int)); +static void do_announce(char *); +SIGNAL_TYPE exorcise(int); /* * exorcise - disspell zombies */ diff --git a/hunt/huntd/hunt.h b/hunt/huntd/hunt.h index 840e507..114df3c 100644 --- a/hunt/huntd/hunt.h +++ b/hunt/huntd/hunt.h @@ -1,4 +1,4 @@ -/* $NetBSD: hunt.h,v 1.9 2003/06/11 12:04:06 wiz Exp $ */ +/* $NetBSD: hunt.h,v 1.11 2004/02/08 22:23:50 jsm Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. @@ -416,69 +416,69 @@ extern FLAG no_beep; * function types */ -void add_shot __P((int, int, int, char, int, PLAYER *, int, char)); -int answer __P((void)); -void bad_con __P((void)) __attribute__((__noreturn__)); -void bad_ver __P((void)) __attribute__((__noreturn__)); -int broadcast_vec __P((int, struct sockaddr **)); -void ce __P((PLAYER *)); -void cgoto __P((PLAYER *, int, int)); -void check __P((PLAYER *, int, int)); -void checkdam __P((PLAYER *, PLAYER *, IDENT *, int, char)); -void clearwalls __P((void)); -void clear_eol __P((void)); -void clear_the_screen __P((void)); -void clrscr __P((PLAYER *)); -BULLET *create_shot __P((int, int, int, char, int, int, PLAYER *, - IDENT *, int, char)); -void do_connect __P((const char *, char, long)); -void do_message __P((void)); -void drawmaze __P((PLAYER *)); -void drawplayer __P((PLAYER *, FLAG)); -void drawstatus __P((PLAYER *)); -void execute __P((PLAYER *)); -void faketalk __P((void)); -void find_driver __P((FLAG)); -void fixshots __P((int, int, char)); -IDENT *get_ident __P((u_long, u_long, const char *, char)); -void get_local_name __P((const char *)); -int get_remote_name __P((char *)); -BULLET *is_bullet __P((int, int)); -void look __P((PLAYER *)); -void makemaze __P((void)); -void message __P((PLAYER *, const char *)); -void mon_execute __P((PLAYER *)); -void moveshots __P((void)); -void open_ctl __P((void)); -int opposite __P((int, char)); -void otto __P((int, int, char)); -void outch __P((PLAYER *, int)); -void outstr __P((PLAYER *, const char *, int)); -int player_sym __P((const PLAYER *, int, int)); -PLAYER *play_at __P((int, int)); -void playit __P((void)); -void put_ch __P((char)); +void add_shot(int, int, int, char, int, PLAYER *, int, char); +int answer(void); +void bad_con(void) __attribute__((__noreturn__)); +void bad_ver(void) __attribute__((__noreturn__)); +int broadcast_vec(int, struct sockaddr **); +void ce(PLAYER *); +void cgoto(PLAYER *, int, int); +void check(PLAYER *, int, int); +void checkdam(PLAYER *, PLAYER *, IDENT *, int, char); +void clearwalls(void); +void clear_eol(void); +void clear_the_screen(void); +void clrscr(PLAYER *); +BULLET *create_shot(int, int, int, char, int, int, PLAYER *, + IDENT *, int, char); +void do_connect(const char *, char, long); +void do_message(void); +void drawmaze(PLAYER *); +void drawplayer(PLAYER *, FLAG); +void drawstatus(PLAYER *); +void execute(PLAYER *); +void faketalk(void); +void find_driver(FLAG); +void fixshots(int, int, char); +IDENT *get_ident(u_long, u_long, const char *, char); +void get_local_name(const char *); +int get_remote_name(char *); +BULLET *is_bullet(int, int); +void look(PLAYER *); +void makemaze(void); +void message(PLAYER *, const char *); +void mon_execute(PLAYER *); +void moveshots(void); +void open_ctl(void); +int opposite(int, char); +void otto(int, int, char); +void outch(PLAYER *, int); +void outstr(PLAYER *, const char *, int); +int player_sym(const PLAYER *, int, int); +PLAYER *play_at(int, int); +void playit(void); +void put_ch(char); # ifndef USE_CURSES -void put_str __P((const char *)); -# endif -int quit __P((int)); -int rand_dir __P((void)); -int rand_num __P((int)); -void redraw_screen __P((void)); -void rmnl __P((char *)); -void rollexpl __P((void)); -void see __P((PLAYER *, int)); -void sendcom __P((PLAYER *, int, ...)); -void showexpl __P((int, int, char)); -void showstat __P((PLAYER *)); -void start_driver __P((void)); -void stmonitor __P((PLAYER *)); -void stplayer __P((PLAYER *, int)); -char translate __P((char)); -SIGNAL_TYPE cleanup __P((int)) __attribute__((__noreturn__)); -SIGNAL_TYPE intr __P((int)); -SIGNAL_TYPE sigalrm __P((int)); -SIGNAL_TYPE sigemt __P((int)) __attribute__((__noreturn__)); -SIGNAL_TYPE sigterm __P((int)) __attribute__((__noreturn__)); -SIGNAL_TYPE sigusr1 __P((int)) __attribute__((__noreturn__)); -SIGNAL_TYPE tstp __P((int)); +void put_str(const char *); +# endif +int quit(int); +int rand_dir(void); +int rand_num(int); +void redraw_screen(void); +void rmnl(char *); +void rollexpl(void); +void see(PLAYER *, int); +void sendcom(PLAYER *, int, ...); +void showexpl(int, int, char); +void showstat(PLAYER *); +void start_driver(void); +void stmonitor(PLAYER *); +void stplayer(PLAYER *, int); +char translate(char); +SIGNAL_TYPE cleanup(int) __attribute__((__noreturn__)); +SIGNAL_TYPE intr(int); +SIGNAL_TYPE sigalrm(int); +SIGNAL_TYPE sigemt(int) __attribute__((__noreturn__)); +SIGNAL_TYPE sigterm(int) __attribute__((__noreturn__)); +SIGNAL_TYPE sigusr1(int) __attribute__((__noreturn__)); +SIGNAL_TYPE tstp(int); diff --git a/hunt/huntd/makemaze.c b/hunt/huntd/makemaze.c index e4c5553..4b58f92 100644 --- a/hunt/huntd/makemaze.c +++ b/hunt/huntd/makemaze.c @@ -1,4 +1,4 @@ -/* $NetBSD: makemaze.c,v 1.3 2003/06/11 12:00:22 wiz Exp $ */ +/* $NetBSD: makemaze.c,v 1.4 2004/01/27 20:30:29 jsm Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. * All rights reserved. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: makemaze.c,v 1.3 2003/06/11 12:00:22 wiz Exp $"); +__RCSID("$NetBSD: makemaze.c,v 1.4 2004/01/27 20:30:29 jsm Exp $"); #endif /* not lint */ # include "hunt.h" @@ -40,10 +40,10 @@ __RCSID("$NetBSD: makemaze.c,v 1.3 2003/06/11 12:00:22 wiz Exp $"); # define ISCLEAR(y,x) (Maze[y][x] == SPACE) # define ODD(n) ((n) & 01) -static int candig __P((int, int)); -static void dig __P((int, int)); -static void dig_maze __P((int, int)); -static void remap __P((void)); +static int candig(int, int); +static void dig(int, int); +static void dig_maze(int, int); +static void remap(void); void makemaze() diff --git a/hunt/huntd/shots.c b/hunt/huntd/shots.c index 4122e5a..862aa78 100644 --- a/hunt/huntd/shots.c +++ b/hunt/huntd/shots.c @@ -1,4 +1,4 @@ -/* $NetBSD: shots.c,v 1.4 2003/06/11 12:00:23 wiz Exp $ */ +/* $NetBSD: shots.c,v 1.5 2004/01/27 20:30:29 jsm Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. * All rights reserved. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: shots.c,v 1.4 2003/06/11 12:00:23 wiz Exp $"); +__RCSID("$NetBSD: shots.c,v 1.5 2004/01/27 20:30:29 jsm Exp $"); #endif /* not lint */ # include @@ -43,21 +43,21 @@ __RCSID("$NetBSD: shots.c,v 1.4 2003/06/11 12:00:23 wiz Exp $"); # define PLUS_DELTA(x, max) if (x < max) x++; else x-- # define MINUS_DELTA(x, min) if (x > min) x--; else x++ -static void chkshot __P((BULLET *, BULLET *)); -static void chkslime __P((BULLET *, BULLET *)); -static void explshot __P((BULLET *, int, int)); -static void find_under __P((BULLET *, BULLET *)); -static int iswall __P((int, int)); -static void mark_boot __P((BULLET *)); -static void mark_player __P((BULLET *)); +static void chkshot(BULLET *, BULLET *); +static void chkslime(BULLET *, BULLET *); +static void explshot(BULLET *, int, int); +static void find_under(BULLET *, BULLET *); +static int iswall(int, int); +static void mark_boot(BULLET *); +static void mark_player(BULLET *); #ifdef DRONE -static void move_drone __P((BULLET *)); +static void move_drone(BULLET *); #endif -static void move_flyer __P((PLAYER *)); -static int move_normal_shot __P((BULLET *)); -static void move_slime __P((BULLET *, int, BULLET *)); -static void save_bullet __P((BULLET *)); -static void zapshot __P((BULLET *, BULLET *)); +static void move_flyer(PLAYER *); +static int move_normal_shot(BULLET *); +static void move_slime(BULLET *, int, BULLET *); +static void save_bullet(BULLET *); +static void zapshot(BULLET *, BULLET *); /* * moveshots: diff --git a/hunt/huntd/talk_ctl.h b/hunt/huntd/talk_ctl.h index 5cd995d..d789012 100644 --- a/hunt/huntd/talk_ctl.h +++ b/hunt/huntd/talk_ctl.h @@ -1,4 +1,4 @@ -/* $NetBSD: talk_ctl.h,v 1.5 2003/06/11 12:00:23 wiz Exp $ */ +/* $NetBSD: talk_ctl.h,v 1.6 2004/01/27 20:30:29 jsm Exp $ */ /* * Copyright (c) 1983-2003, Regents of the University of California. @@ -103,4 +103,4 @@ extern CTL_MSG msg; #define p_error(str) warn(str) #endif -void ctl_transact __P((struct in_addr, CTL_MSG, int, CTL_RESPONSE *)); +void ctl_transact(struct in_addr, CTL_MSG, int, CTL_RESPONSE *); diff --git a/include/signal.h b/include/signal.h index ba31c1c..ea2e940 100644 --- a/include/signal.h +++ b/include/signal.h @@ -1,6 +1,6 @@ /* signal.h - bsd-games wrapper for . * - * Copyright (c) 1997, 1998, 2000 Joseph Samuel Myers. + * Copyright (c) 1997, 1998, 2000, 2004 Joseph Samuel Myers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,10 +39,9 @@ #include_next -#ifndef __GLIBC__ /* glibc 2 has this; with libc5 we want to avoid - * . */ +#ifndef HAVE_sig_t #ifndef LINUX_BSD_GAMES_DEFINED_SIG_T -typedef __sighandler_t sig_t; +typedef void (*sig_t)(int); #define LINUX_BSD_GAMES_DEFINED_SIG_T 1 #endif #endif diff --git a/include/stdlib.h b/include/stdlib.h index bdbed6f..4836e53 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -1,6 +1,6 @@ /* stdlib.h - bsd-games wrapper for . * - * Copyright (c) 1998, 1999, 2000 Joseph Samuel Myers. + * Copyright (c) 1998, 1999, 2000, 2004 Joseph Samuel Myers. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,3 +37,7 @@ #ifndef HAVE_getloadavg extern int getloadavg(double loadavg[], int nelem); #endif + +#ifndef HAVE_getprogname +extern const char *getprogname(void); +#endif diff --git a/lib/getprogname.c b/lib/getprogname.c new file mode 100644 index 0000000..61e3dc6 --- /dev/null +++ b/lib/getprogname.c @@ -0,0 +1,40 @@ +/* lib/getprogname.c - bsd-games implementation of getprogname. + * + * 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. + */ + +#include + +#ifndef HAVE_getprogname +extern char *__progname; + +const char * +getprogname(void) +{ + return __progname; +} +#endif /* !defined(HAVE_getprogname) */ diff --git a/mille/mille.h b/mille/mille.h index 60bed8a..6fd86b9 100644 --- a/mille/mille.h +++ b/mille/mille.h @@ -1,4 +1,4 @@ -/* $NetBSD: mille.h,v 1.12 2003/08/07 09:37:25 agc Exp $ */ +/* $NetBSD: mille.h,v 1.13 2004/01/27 20:30:30 jsm Exp $ */ /* * Copyright (c) 1982, 1993 @@ -231,44 +231,44 @@ extern WINDOW *Board, *Miles, *Score; * functions */ -void account __P((CARD)); -void calcmove __P((void)); -int canplay __P((const PLAY *, const PLAY *, CARD)); -int check_ext __P((bool)); -void check_go __P((void)); -void check_more __P((void)); -void die __P((int)) __attribute__((__noreturn__)); -void domove __P((void)); -bool error __P((const char *, ...)); -void extrapolate __P((PLAY *)); -void finalscore __P((PLAY *)); -CARD getcard __P((void)); -void getmove __P((void)); -int getyn __P((int)); -int haspicked __P((const PLAY *)); -void init __P((void)); -int is_repair __P((CARD)); -int main __P((int, char **)); -void newboard __P((void)); -void newscore __P((void)); -int onecard __P((const PLAY *)); -int playcard __P((PLAY *)); -void prboard __P((void)); -void prompt __P((int)); -void prscore __P((bool)); -int readch __P((void)); -bool rest_f __P((const char *)); -int roll __P((int, int)); -void rub __P((int)); -int safety __P((CARD)); -bool save __P((void)); -void show_card __P((int, int, CARD, CARD *)); -void show_score __P((int, int, int, int *)); -void shuffle __P((void)); -void sort __P((CARD *)); -void undoex __P((int)); +void account(CARD); +void calcmove(void); +int canplay(const PLAY *, const PLAY *, CARD); +int check_ext(bool); +void check_go(void); +void check_more(void); +void die(int) __attribute__((__noreturn__)); +void domove(void); +bool error(const char *, ...); +void extrapolate(PLAY *); +void finalscore(PLAY *); +CARD getcard(void); +void getmove(void); +int getyn(int); +int haspicked(const PLAY *); +void init(void); +int is_repair(CARD); +int main(int, char **); +void newboard(void); +void newscore(void); +int onecard(const PLAY *); +int playcard(PLAY *); +void prboard(void); +void prompt(int); +void prscore(bool); +int readch(void); +bool rest_f(const char *); +int roll(int, int); +void rub(int); +int safety(CARD); +bool save(void); +void show_card(int, int, CARD, CARD *); +void show_score(int, int, int, int *); +void shuffle(void); +void sort(CARD *); +void undoex(int); #if defined(__linux__) && !defined(__GLIBC__) -bool varpush __P((int, ssize_t __P((int, const struct iovec *, size_t)))); +bool varpush(int, ssize_t (int, const struct iovec *, size_t)); #else -bool varpush __P((int, ssize_t __P((int, const struct iovec *, int)))); +bool varpush(int, ssize_t (int, const struct iovec *, int)); #endif diff --git a/mille/table.c b/mille/table.c index 9a54668..d220173 100644 --- a/mille/table.c +++ b/mille/table.c @@ -1,4 +1,4 @@ -/* $NetBSD: table.c,v 1.6 2003/08/07 09:37:26 agc Exp $ */ +/* $NetBSD: table.c,v 1.7 2004/01/27 20:30:30 jsm Exp $ */ /* * Copyright (c) 1982, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1982, 1993\n\ #if 0 static char sccsid[] = "@(#)table.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: table.c,v 1.6 2003/08/07 09:37:26 agc Exp $"); +__RCSID("$NetBSD: table.c,v 1.7 2004/01/27 20:30:30 jsm Exp $"); #endif #endif /* not lint */ @@ -51,7 +51,7 @@ __RCSID("$NetBSD: table.c,v 1.6 2003/08/07 09:37:26 agc Exp $"); # include "mille.h" -int main __P((int, char **)); +int main(int, char **); int main(argc, argv) diff --git a/mille/varpush.c b/mille/varpush.c index 68d2be1..687b4fc 100644 --- a/mille/varpush.c +++ b/mille/varpush.c @@ -1,4 +1,4 @@ -/* $NetBSD: varpush.c,v 1.7 2003/08/07 09:37:26 agc Exp $ */ +/* $NetBSD: varpush.c,v 1.8 2004/01/27 20:30:30 jsm Exp $ */ /* * Copyright (c) 1982, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)varpush.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: varpush.c,v 1.7 2003/08/07 09:37:26 agc Exp $"); +__RCSID("$NetBSD: varpush.c,v 1.8 2004/01/27 20:30:30 jsm Exp $"); #endif #endif /* not lint */ @@ -53,9 +53,9 @@ bool varpush(file, func) int file; #if defined(__linux__) && !defined(__GLIBC__) - ssize_t (*func) __P((int, const struct iovec *, size_t)); + ssize_t (*func)(int, const struct iovec *, size_t); #else - ssize_t (*func) __P((int, const struct iovec *, int)); + ssize_t (*func)(int, const struct iovec *, int); #endif { int temp; diff --git a/monop/cards.c b/monop/cards.c index 277d889..291e118 100644 --- a/monop/cards.c +++ b/monop/cards.c @@ -1,4 +1,4 @@ -/* $NetBSD: cards.c,v 1.13 2003/08/07 09:37:27 agc Exp $ */ +/* $NetBSD: cards.c,v 1.14 2004/01/27 20:30:30 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)cards.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: cards.c,v 1.13 2003/08/07 09:37:27 agc Exp $"); +__RCSID("$NetBSD: cards.c,v 1.14 2004/01/27 20:30:30 jsm Exp $"); #endif #endif /* not lint */ @@ -57,8 +57,8 @@ static const char *cardfile = "cards.pck"; static FILE *deckf; -static void set_up __P((DECK *)); -static void printmes __P((void)); +static void set_up(DECK *); +static void printmes(void); /* * This routine initializes the decks from the data file, diff --git a/monop/execute.c b/monop/execute.c index f1e6343..828d990 100644 --- a/monop/execute.c +++ b/monop/execute.c @@ -1,4 +1,4 @@ -/* $NetBSD: execute.c,v 1.10 2003/08/07 09:37:27 agc Exp $ */ +/* $NetBSD: execute.c,v 1.11 2004/01/27 20:30:30 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)execute.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: execute.c,v 1.10 2003/08/07 09:37:27 agc Exp $"); +__RCSID("$NetBSD: execute.c,v 1.11 2004/01/27 20:30:30 jsm Exp $"); #endif #endif /* not lint */ @@ -57,7 +57,7 @@ static char buf[257]; static bool new_play; /* set if move on to new player */ extern void *heapstart; -static void show_move __P((void)); +static void show_move(void); /* * This routine executes the given command by index number diff --git a/monop/getinp.c b/monop/getinp.c index 9c4f948..3fb739b 100644 --- a/monop/getinp.c +++ b/monop/getinp.c @@ -1,4 +1,4 @@ -/* $NetBSD: getinp.c,v 1.11 2003/08/07 09:37:27 agc Exp $ */ +/* $NetBSD: getinp.c,v 1.12 2004/01/27 20:30:30 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)getinp.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: getinp.c,v 1.11 2003/08/07 09:37:27 agc Exp $"); +__RCSID("$NetBSD: getinp.c,v 1.12 2004/01/27 20:30:30 jsm Exp $"); #endif #endif /* not lint */ @@ -47,7 +47,7 @@ __RCSID("$NetBSD: getinp.c,v 1.11 2003/08/07 09:37:27 agc Exp $"); static char buf[257]; -static int comp __P((const char *)); +static int comp(const char *); int getinp(prompt, list) diff --git a/monop/houses.c b/monop/houses.c index b5a2d8b..980f784 100644 --- a/monop/houses.c +++ b/monop/houses.c @@ -1,4 +1,4 @@ -/* $NetBSD: houses.c,v 1.7 2003/08/07 09:37:27 agc Exp $ */ +/* $NetBSD: houses.c,v 1.8 2004/01/27 20:30:30 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)houses.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: houses.c,v 1.7 2003/08/07 09:37:27 agc Exp $"); +__RCSID("$NetBSD: houses.c,v 1.8 2004/01/27 20:30:30 jsm Exp $"); #endif #endif /* not lint */ @@ -45,9 +45,9 @@ static char cur_prop[80]; static MON *monops[N_MON]; -static void buy_h __P((MON *)); -static void sell_h __P((MON *)); -static void list_cur __P((MON *)); +static void buy_h(MON *); +static void sell_h(MON *); +static void list_cur(MON *); /* * These routines deal with buying and selling houses */ diff --git a/monop/malloc.c b/monop/malloc.c index 7596d81..f5b0239 100644 --- a/monop/malloc.c +++ b/monop/malloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: malloc.c,v 1.2 2003/08/07 09:37:28 agc Exp $ */ +/* $NetBSD: malloc.c,v 1.3 2004/01/27 20:30:30 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)malloc.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: malloc.c,v 1.2 2003/08/07 09:37:28 agc Exp $"); +__RCSID("$NetBSD: malloc.c,v 1.3 2004/01/27 20:30:30 jsm Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -120,16 +120,16 @@ static u_int nmalloc[NBUCKETS]; static mutex_t malloc_mutex = MUTEX_INITIALIZER; -static void morecore __P((int)); -static int findbucket __P((union overhead *, int)); +static void morecore(int); +static int findbucket(union overhead *, int); #ifdef MSTATS -void mstats __P((const char *)); +void mstats(const char *); #endif #if defined(DEBUG) || defined(RCHECK) #define ASSERT(p) if (!(p)) botch(__STRING(p)) -static void botch __P((const char *)); +static void botch(const char *); /* * NOTE: since this may be called while malloc_mutex is locked, stdio must not diff --git a/monop/misc.c b/monop/misc.c index 27612a0..f9a3755 100644 --- a/monop/misc.c +++ b/monop/misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: misc.c,v 1.11 2003/08/07 09:37:28 agc Exp $ */ +/* $NetBSD: misc.c,v 1.12 2004/01/26 09:59:36 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: misc.c,v 1.11 2003/08/07 09:37:28 agc Exp $"); +__RCSID("$NetBSD: misc.c,v 1.12 2004/01/26 09:59:36 jsm Exp $"); #endif #endif /* not lint */ @@ -53,7 +53,7 @@ getyn(prompt) int com; for (;;) - if ((com=getinp(prompt, yn)) < 2) + if ((com=getinp(prompt, yncoms)) < 2) return com; else (*func[com-2])(); diff --git a/monop/monop.c b/monop/monop.c index 06b6264..d40f0a1 100644 --- a/monop/monop.c +++ b/monop/monop.c @@ -1,4 +1,4 @@ -/* $NetBSD: monop.c,v 1.14 2003/08/07 09:37:28 agc Exp $ */ +/* $NetBSD: monop.c,v 1.15 2004/01/27 20:30:30 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ #if 0 static char sccsid[] = "@(#)monop.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: monop.c,v 1.14 2003/08/07 09:37:28 agc Exp $"); +__RCSID("$NetBSD: monop.c,v 1.15 2004/01/27 20:30:30 jsm Exp $"); #endif #endif /* not lint */ @@ -49,11 +49,11 @@ __RCSID("$NetBSD: monop.c,v 1.14 2003/08/07 09:37:28 agc Exp $"); #include #include "monop.def" -int main __P((int, char *[])); -static void getplayers __P((void)); -static void init_players __P((void)); -static void init_monops __P((void)); -static void do_quit __P((int)); +int main(int, char *[]); +static void getplayers(void); +static void init_players(void); +static void init_monops(void); +static void do_quit(int); void *heapstart; /* diff --git a/monop/monop.def b/monop/monop.def index 63649ee..b5951b8 100644 --- a/monop/monop.def +++ b/monop/monop.def @@ -1,4 +1,4 @@ -/* $NetBSD: monop.def,v 1.7 2003/08/07 09:37:28 agc Exp $ */ +/* $NetBSD: monop.def,v 1.9 2004/01/27 20:30:30 jsm Exp $ */ /*- * Copyright (c) 1980, 1993 @@ -52,7 +52,7 @@ const char *name_list[MAX_PL+2], /* list of players' names */ "", /* 16 */ 0 }, - *const yn[] = { /* list of commands for yes/no answers */ + *const yncoms[] = { /* list of commands for yes/no answers */ "yes", /* 0 */ "no", /* 1 */ "quit", /* 2 */ "print", /* 3 */ "where", /* 4 */ "own holdings", /* 5 */ @@ -76,7 +76,7 @@ int player, /* current player number */ num_luck = sizeof lucky_mes / sizeof (char *); /* list of command functions */ -void (*const func[]) __P((void)) = { /* array of function calls for commands */ +void (*const func[])(void) = { /* array of function calls for commands */ quit, /* quit game |* 0 *| */ printboard, /* print board |* 1 *| */ where, /* where players are |* 2 *| */ diff --git a/monop/monop.ext b/monop/monop.ext index fe22751..65652f6 100644 --- a/monop/monop.ext +++ b/monop/monop.ext @@ -1,4 +1,4 @@ -/* $NetBSD: monop.ext,v 1.5 2003/08/07 09:37:29 agc Exp $ */ +/* $NetBSD: monop.ext,v 1.7 2004/01/27 20:30:30 jsm Exp $ */ /*- * Copyright (c) 1980, 1993 @@ -36,11 +36,11 @@ extern bool trading, spec, fixing, told_em; -extern const char *const yn[], *const comlist[], *name_list[], *const lucky_mes[]; +extern const char *const yncoms[], *const comlist[], *name_list[], *const lucky_mes[]; extern int num_play, player, num_doub, num_luck; -extern void (*const func[]) __P((void)); +extern void (*const func[])(void); extern DECK deck[2]; diff --git a/monop/monop.h b/monop/monop.h index 4b87996..0dd9257 100644 --- a/monop/monop.h +++ b/monop/monop.h @@ -1,4 +1,4 @@ -/* $NetBSD: monop.h,v 1.11 2003/08/07 09:37:29 agc Exp $ */ +/* $NetBSD: monop.h,v 1.12 2004/01/27 20:30:30 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -134,74 +134,74 @@ typedef struct prp_st UTIL_S; /* cards.c */ -void init_decks __P((void)); -void get_card __P((DECK *)); +void init_decks(void); +void get_card(DECK *); /* execute.c */ -void execute __P((int)); -void do_move __P((void)); -void move __P((int)); -void save __P((void)); -void restore __P((void)); -int rest_f __P((const char *)); +void execute(int); +void do_move(void); +void move(int); +void save(void); +void restore(void); +int rest_f(const char *); /* getinp.c */ -int getinp __P((const char *, const char *const [])); +int getinp(const char *, const char *const []); /* houses.c */ -void buy_houses __P((void)); -void sell_houses __P((void)); +void buy_houses(void); +void sell_houses(void); /* jail.c */ -void card __P((void)); -void ret_card __P((PLAY *)); -void pay __P((void)); -int move_jail __P((int, int )); -void printturn __P((void)); +void card(void); +void ret_card(PLAY *); +void pay(void); +int move_jail(int, int ); +void printturn(void); /* misc.c */ -int getyn __P((const char *)); -void notify __P((void)); -void next_play __P((void)); -int get_int __P((const char *)); -void set_ownlist __P((int)); -void is_monop __P((MON *, int)); -void is_not_monop __P((MON *)); -void list __P((void)); -void list_all __P((void)); -void quit __P((void)); +int getyn(const char *); +void notify(void); +void next_play(void); +int get_int(const char *); +void set_ownlist(int); +void is_monop(MON *, int); +void is_not_monop(MON *); +void list(void); +void list_all(void); +void quit(void); /* morg.c */ -void mortgage __P((void)); -void unmortgage __P((void)); -void force_morg __P((void)); +void mortgage(void); +void unmortgage(void); +void force_morg(void); /* print.c */ -void printboard __P((void)); -void where __P((void)); -void printsq __P((int, bool)); -void printhold __P((int)); +void printboard(void); +void where(void); +void printsq(int, bool); +void printhold(int); /* prop.c */ -void buy __P((int, SQUARE *)); -void add_list __P((int, OWN **, int)); -void del_list __P((int, OWN **, short)); -void bid __P((void)); -int prop_worth __P((PLAY *)); +void buy(int, SQUARE *); +void add_list(int, OWN **, int); +void del_list(int, OWN **, short); +void bid(void); +int prop_worth(PLAY *); /* rent.c */ -void rent __P((SQUARE *)); +void rent(SQUARE *); /* roll.c */ -int roll __P((int, int)); +int roll(int, int); /* spec.c */ -void inc_tax __P((void)); -void goto_jail __P((void)); -void lux_tax __P((void)); -void cc __P((void)); -void chance __P((void)); +void inc_tax(void); +void goto_jail(void); +void lux_tax(void); +void cc(void); +void chance(void); /* trade.c */ -void trade __P((void)); -void resign __P((void)); +void trade(void); +void resign(void); diff --git a/monop/morg.c b/monop/morg.c index cfdbff9..4b8e69f 100644 --- a/monop/morg.c +++ b/monop/morg.c @@ -1,4 +1,4 @@ -/* $NetBSD: morg.c,v 1.9 2003/08/07 09:37:29 agc Exp $ */ +/* $NetBSD: morg.c,v 1.10 2004/01/27 20:30:30 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)morg.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: morg.c,v 1.9 2003/08/07 09:37:29 agc Exp $"); +__RCSID("$NetBSD: morg.c,v 1.10 2004/01/27 20:30:30 jsm Exp $"); #endif #endif /* not lint */ @@ -69,11 +69,11 @@ static short square[MAX_PRP+2]; static int num_good,got_houses; -static int set_mlist __P((void)); -static void m __P((int)); -static int set_umlist __P((void)); -static void unm __P((int)); -static void fix_ex __P((int)); +static int set_mlist(void); +static void m(int); +static int set_umlist(void); +static void unm(int); +static void fix_ex(int); /* * This routine is the command level response the mortgage command. diff --git a/monop/print.c b/monop/print.c index 8446abc..9cd3c95 100644 --- a/monop/print.c +++ b/monop/print.c @@ -1,4 +1,4 @@ -/* $NetBSD: print.c,v 1.7 2003/08/07 09:37:29 agc Exp $ */ +/* $NetBSD: print.c,v 1.8 2004/01/27 20:30:30 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)print.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: print.c,v 1.7 2003/08/07 09:37:29 agc Exp $"); +__RCSID("$NetBSD: print.c,v 1.8 2004/01/27 20:30:30 jsm Exp $"); #endif #endif /* not lint */ @@ -42,7 +42,7 @@ __RCSID("$NetBSD: print.c,v 1.7 2003/08/07 09:37:29 agc Exp $"); static const char *header = "Name Own Price Mg # Rent"; -static void printmorg __P((const SQUARE *)); +static void printmorg(const SQUARE *); /* * This routine prints out the current board diff --git a/monop/prop.c b/monop/prop.c index dd0fd2c..2580a62 100644 --- a/monop/prop.c +++ b/monop/prop.c @@ -1,4 +1,4 @@ -/* $NetBSD: prop.c,v 1.8 2003/08/07 09:37:29 agc Exp $ */ +/* $NetBSD: prop.c,v 1.9 2004/01/27 20:30:30 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,14 +34,14 @@ #if 0 static char sccsid[] = "@(#)prop.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: prop.c,v 1.8 2003/08/07 09:37:29 agc Exp $"); +__RCSID("$NetBSD: prop.c,v 1.9 2004/01/27 20:30:30 jsm Exp $"); #endif #endif /* not lint */ #include #include "monop.ext" -static int value __P((SQUARE *)); +static int value(SQUARE *); /* * This routine deals with buying property, setting all the diff --git a/monop/trade.c b/monop/trade.c index e28a68e..ff60ca0 100644 --- a/monop/trade.c +++ b/monop/trade.c @@ -1,4 +1,4 @@ -/* $NetBSD: trade.c,v 1.8 2003/08/07 09:37:30 agc Exp $ */ +/* $NetBSD: trade.c,v 1.9 2004/01/27 20:30:30 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)trade.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: trade.c,v 1.8 2003/08/07 09:37:30 agc Exp $"); +__RCSID("$NetBSD: trade.c,v 1.9 2004/01/27 20:30:30 jsm Exp $"); #endif #endif /* not lint */ @@ -55,11 +55,11 @@ static int used[MAX_PRP]; static TRADE trades[2]; -static void get_list __P((int, int )); -static int set_list __P((OWN *)); -static void summate __P((void)); -static void do_trade __P((void)); -static void move_em __P((TRADE *, TRADE *)); +static void get_list(int, int ); +static int set_list(OWN *); +static void summate(void); +static void do_trade(void); +static void move_em(TRADE *, TRADE *); void trade() diff --git a/morse/morse.c b/morse/morse.c index 1141364..ba29d50 100644 --- a/morse/morse.c +++ b/morse/morse.c @@ -1,4 +1,4 @@ -/* $NetBSD: morse.c,v 1.11 2003/08/07 09:37:30 agc Exp $ */ +/* $NetBSD: morse.c,v 1.13 2004/02/13 23:16:11 jsm Exp $ */ /* * Copyright (c) 1988, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1993\n\ #if 0 static char sccsid[] = "@(#)morse.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: morse.c,v 1.11 2003/08/07 09:37:30 agc Exp $"); +__RCSID("$NetBSD: morse.c,v 1.13 2004/02/13 23:16:11 jsm Exp $"); #endif #endif /* not lint */ @@ -49,10 +49,6 @@ __RCSID("$NetBSD: morse.c,v 1.11 2003/08/07 09:37:30 agc Exp $"); #include #include -#define MORSE_COLON "--..--" -#define MORSE_PERIOD ".-.-.-" - - static const char *const digit[] = { "-----", @@ -95,10 +91,29 @@ static const char "--..", }; -int main __P((int, char *[])); -void morse __P((int)); -void decode __P((const char *)); -void show __P((const char *)); +const struct punc { + char c; + const char *morse; +} other[] = { + { '.', ".-.-.-" }, + { ',', "--..--" }, + { ':', "---..." }, + { '?', "..--.." }, + { '\'', ".----." }, + { '-', "-....-" }, + { '/', "-..-." }, + { '(', "-.--." }, + { ')', "-.--.-" }, + { '"', ".-..-." }, + { '=', "-...-" }, + { '+', ".-.-." }, + { '\0', NULL } +}; + +int main(int, char *[]); +void morse(int); +void decode(const char *); +void show(const char *); static int sflag; static int dflag; @@ -109,7 +124,7 @@ main(argc, argv) char **argv; { int ch; - char *s, *p; + char *p; /* Revoke setgid privileges */ setregid(getgid(), getgid()); @@ -133,46 +148,53 @@ main(argc, argv) if (dflag) { if (*argv) { do { - s=strchr(*argv, ','); - - if (s) - *s='\0'; - decode(*argv); } while (*++argv); - }else{ - char buf[1024]; - - while (fgets(buf, 1024, stdin)) { - s=buf; - - while (*s && isspace(*s)) - s++; - - if (*s) { - p=strtok(s, " \n\t"); - - while (p) { - s=strchr(p, ','); - - if (s) - *s='\0'; - - decode(p); - p=strtok(NULL, " \n\t"); + } else { + char foo[10]; /* All morse chars shorter than this */ + int isblank, i; + + i = 0; + isblank = 0; + while ((ch = getchar()) != EOF) { + if (ch == '-' || ch == '.') { + foo[i++] = ch; + if (i == 10) { + /* overrun means gibberish--print 'x' and + * advance */ + i = 0; + putchar('x'); + while ((ch = getchar()) != EOF && + (ch == '.' || ch == '-')) + ; + isblank = 1; } + } else if (i) { + foo[i] = '\0'; + decode(foo); + i = 0; + isblank = 0; + } else if (isspace(ch)) { + if (isblank) { + /* print whitespace for each double blank */ + putchar(' '); + isblank = 0; + } else + isblank = 1; } } } putchar('\n'); - }else{ + } else { if (*argv) do { for (p = *argv; *p; ++p) morse((int)*p); + show(""); } while (*++argv); else while ((ch = getchar()) != EOF) morse(ch); + show("...-.-"); /* SK */ } return 0; @@ -182,62 +204,54 @@ void decode(s) const char *s; { - if (strcmp(s, MORSE_COLON) == 0){ - putchar(','); - } else if (strcmp(s, MORSE_PERIOD) == 0){ - putchar('.'); - } else { - int found; - const char *const *a; - int size; - int i; - - found=0; - a=digit; - size=sizeof(digit)/sizeof(digit[0]); - for (i=0; i @@ -26,13 +26,16 @@ FILES+=${file} .endif .endfor -CLEANFILES+=map setup setup.lo host_phantglobs.lo ${ALLFILES} +CLEANFILES+=map setup setup.lo host_phantglobs.lo ${ALLFILES} files.stamp realall: ${FILES} -${FILES}: setup monsters.asc +${FILES}: files.stamp +files.stamp: setup monsters.asc ${_MKMSG_CREATE} ${FILES} + rm -f ${.TARGET} ./setup -m ${.CURDIR}/monsters.asc + touch ${.TARGET} setup: host_phantglobs.lo setup.lo ${LIBM} ${_MKTARGET_LINK} diff --git a/phantasia/fight.c b/phantasia/fight.c index 14094e4..a44b4d1 100644 --- a/phantasia/fight.c +++ b/phantasia/fight.c @@ -1,4 +1,4 @@ -/* $NetBSD: fight.c,v 1.7 2000/04/27 00:30:53 jdc Exp $ */ +/* $NetBSD: fight.c,v 1.8 2004/02/08 00:32:07 jsm Exp $ */ /* * fight.c Phantasia monster fighting routines diff --git a/phantasia/io.c b/phantasia/io.c index d2f182e..5a4c009 100644 --- a/phantasia/io.c +++ b/phantasia/io.c @@ -1,4 +1,4 @@ -/* $NetBSD: io.c,v 1.5 1999/09/08 21:45:29 jsm Exp $ */ +/* $NetBSD: io.c,v 1.6 2004/02/08 00:32:07 jsm Exp $ */ /* * io.c - input/output routines for Phantasia diff --git a/phantasia/main.c b/phantasia/main.c index d6c57eb..230fd0d 100644 --- a/phantasia/main.c +++ b/phantasia/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.11 2003/05/08 13:03:49 wiz Exp $ */ +/* $NetBSD: main.c,v 1.12 2004/01/01 16:03:46 jsm Exp $ */ /* * Phantasia 3.3.2 -- Interterminal fantasy game diff --git a/phantasia/misc.c b/phantasia/misc.c index aac1ec4..4dc71b3 100644 --- a/phantasia/misc.c +++ b/phantasia/misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: misc.c,v 1.9 2003/05/08 13:03:49 wiz Exp $ */ +/* $NetBSD: misc.c,v 1.10 2004/01/01 16:03:46 jsm Exp $ */ /* * misc.c Phantasia miscellaneous support routines diff --git a/phantasia/phantasia.6 b/phantasia/phantasia.6 index 5c5ddf2..94ff3e0 100644 --- a/phantasia/phantasia.6 +++ b/phantasia/phantasia.6 @@ -1,4 +1,4 @@ -.\" $NetBSD: phantasia.6,v 1.10 2003/05/18 09:30:08 wiz Exp $ +.\" $NetBSD: phantasia.6,v 1.11 2004/01/03 13:32:23 wiz Exp $ .\" .Dd April 1, 2001 .Dt PHANTASIA 6 @@ -54,9 +54,6 @@ Only characters above zero are saved. Characters unused for awhile will be purged. Characters are only placed on the scoreboard when they die. -.Sh AUTHORS -.An Edward Estes , -AT\*[Am]T Information Systems, Skokie, IL .Sh PARTICULARS .Ss Normal Play A number of the player's more important statistics are almost always @@ -1191,6 +1188,9 @@ Upon slaying a player in battle the winner gets the other's and treasures. .Em Rings do not work for inter-terminal battle. +.Sh AUTHORS +.An Edward Estes , +AT\*[Am]T Information Systems, Skokie, IL .Sh BUGS All screen formats assume at least 24 lines by at least 80 columns. No provisions are made for when any of the data items get too big diff --git a/pig/pig.c b/pig/pig.c index 8dcfe4f..7d79ca3 100644 --- a/pig/pig.c +++ b/pig/pig.c @@ -1,4 +1,4 @@ -/* $NetBSD: pig.c,v 1.9 2003/08/07 09:37:32 agc Exp $ */ +/* $NetBSD: pig.c,v 1.10 2004/01/27 20:30:30 jsm Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\ #if 0 static char sccsid[] = "@(#)pig.c 8.2 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: pig.c,v 1.9 2003/08/07 09:37:32 agc Exp $"); +__RCSID("$NetBSD: pig.c,v 1.10 2004/01/27 20:30:30 jsm Exp $"); #endif #endif /* not lint */ @@ -52,9 +52,9 @@ __RCSID("$NetBSD: pig.c,v 1.9 2003/08/07 09:37:32 agc Exp $"); #include #include -int main __P((int, char *[])); -void pigout __P((char *, int)); -void usage __P((void)) __attribute__((__noreturn__)); +int main(int, char *[]); +void pigout(char *, int); +void usage(void) __attribute__((__noreturn__)); int main(argc, argv) diff --git a/pom/pom.c b/pom/pom.c index ad47ca8..72844c1 100644 --- a/pom/pom.c +++ b/pom/pom.c @@ -1,4 +1,4 @@ -/* $NetBSD: pom.c,v 1.13 2003/08/07 09:37:32 agc Exp $ */ +/* $NetBSD: pom.c,v 1.14 2004/01/27 20:30:30 jsm Exp $ */ /* * Copyright (c) 1989, 1993 @@ -41,7 +41,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\ #if 0 static char sccsid[] = "@(#)pom.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: pom.c,v 1.13 2003/08/07 09:37:32 agc Exp $"); +__RCSID("$NetBSD: pom.c,v 1.14 2004/01/27 20:30:30 jsm Exp $"); #endif #endif /* not lint */ @@ -84,12 +84,12 @@ __RCSID("$NetBSD: pom.c,v 1.13 2003/08/07 09:37:32 agc Exp $"); #define Pzero 36.340410 /* lunar mean long of perigee at EPOCH */ #define Nzero 318.510107 /* lunar mean long of node at EPOCH */ -void adj360 __P((double *)); -double dtor __P((double)); -int main __P((int, char *[])); -double potm __P((double)); -time_t parsetime __P((char *)); -void badformat __P((void)) __attribute__((__noreturn__)); +void adj360(double *); +double dtor(double); +int main(int, char *[]); +double potm(double); +time_t parsetime(char *); +void badformat(void) __attribute__((__noreturn__)); int main(argc, argv) diff --git a/ppt/ppt.c b/ppt/ppt.c index a54bb92..4657e9c 100644 --- a/ppt/ppt.c +++ b/ppt/ppt.c @@ -1,4 +1,4 @@ -/* $NetBSD: ppt.c,v 1.15 2003/08/07 09:37:33 agc Exp $ */ +/* $NetBSD: ppt.c,v 1.16 2004/01/27 20:30:30 jsm Exp $ */ /* * Copyright (c) 1988, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1993\n\ #if 0 static char sccsid[] = "@(#)ppt.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: ppt.c,v 1.15 2003/08/07 09:37:33 agc Exp $"); +__RCSID("$NetBSD: ppt.c,v 1.16 2004/01/27 20:30:30 jsm Exp $"); #endif #endif /* not lint */ @@ -51,10 +51,10 @@ __RCSID("$NetBSD: ppt.c,v 1.15 2003/08/07 09:37:33 agc Exp $"); #define EDGE "___________" - void usage __P((void)); - int main __P((int, char *[])); -static void putppt __P((int)); - int getppt __P((const char *)); + void usage(void); + int main(int, char *[]); +static void putppt(int); + int getppt(const char *); void usage(void) diff --git a/primes/Makefile.bsd b/primes/Makefile.bsd index 2947e41..4235041 100644 --- a/primes/Makefile.bsd +++ b/primes/Makefile.bsd @@ -1,10 +1,9 @@ -# $NetBSD: Makefile,v 1.6 2002/09/18 06:16:41 lukem Exp $ +# $NetBSD: Makefile,v 1.7 2004/02/08 13:16:25 jsm Exp $ # @(#)Makefile 8.1 (Berkeley) 5/31/93 -NOMAN= # defined - PROG= primes SRCS= pattern.c pr_tbl.c primes.c +MAN= primes.6 DPADD= ${LIBM} LDADD= -lm diff --git a/primes/Makefrag b/primes/Makefrag index f5444ea..82518c2 100644 --- a/primes/Makefrag +++ b/primes/Makefrag @@ -1,6 +1,6 @@ # Makefrag - makefile fragment for primes # -# Copyright (c) 1997, 1998, 1999 Joseph Samuel Myers. +# Copyright (c) 1997, 1998, 1999, 2004 Joseph Samuel Myers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -29,9 +29,9 @@ primes_DEFS := -D_GNU_SOURCE primes_DIRS := $(GAMESDIR) $(MAN6DIR) -primes_all: primes/primes +primes_all: primes/primes primes/primes.6 primes_install: primes_all $(INSTALL_BINARY) primes/primes $(INSTALL_PREFIX)$(GAMESDIR)/primes $(HIDE_GAME) primes - $(INSTALL_MANUAL) factor.6 primes.6 + $(INSTALL_MANUAL) primes/primes.6 diff --git a/primes/primes.6 b/primes/primes.6 new file mode 100644 index 0000000..14d5101 --- /dev/null +++ b/primes/primes.6 @@ -0,0 +1,89 @@ +.\" $NetBSD: primes.6,v 1.2 2004/02/09 23:25:47 wiz Exp $ +.\" +.\" Copyright (c) 1989, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" This code is derived from software contributed to Berkeley by +.\" Landon Curt Noll. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)factor.6 8.1 (Berkeley) 5/31/93 +.\" +.\" +.\" By: Landon Curt Noll chongo@toad.com, ...!{sun,tolsoft}!hoptoad!chongo +.\" +.\" chongo /\oo/\ +.\" +.Dd February 8, 2004 +.Dt PRIMES 6 +.Os +.Sh NAME +.Nm primes +.Nd generate primes +.Sh SYNOPSIS +.Nm primes +.Op Ar start Op Ar stop +.Sh DESCRIPTION +The +.Nm +utility prints primes in ascending order, one per line, starting +at or above +.Ar start +and continuing until, but not including +.Ar stop . +The +.Ar start +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 +When the +.Nm +utility is invoked with no arguments, +.Ar start +is read from standard input. +.Ar stop +is taken to be 4294967295. +The +.Ar start +value may be preceded by a single +.Sq \&+ . +The +.Ar start +value is terminated by a non-digit character (such as a newline). +The input line must not be longer than 255 characters. +.Sh DIAGNOSTICS +Out of range or invalid input results in +an appropriate error message +being written to standard error. +.Sh BUGS +.Nm +won't get you a world record. diff --git a/primes/primes.c b/primes/primes.c index 2d73cb1..2d93594 100644 --- a/primes/primes.c +++ b/primes/primes.c @@ -1,4 +1,4 @@ -/* $NetBSD: primes.c,v 1.11 2003/08/07 09:37:33 agc Exp $ */ +/* $NetBSD: primes.c,v 1.12 2004/01/27 20:30:30 jsm Exp $ */ /* * Copyright (c) 1989, 1993 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\ #if 0 static char sccsid[] = "@(#)primes.c 8.5 (Berkeley) 5/10/95"; #else -__RCSID("$NetBSD: primes.c,v 1.11 2003/08/07 09:37:33 agc Exp $"); +__RCSID("$NetBSD: primes.c,v 1.12 2004/01/27 20:30:30 jsm Exp $"); #endif #endif /* not lint */ @@ -103,10 +103,10 @@ extern const ubig *pr_limit; /* largest prime in the prime array */ extern const char pattern[]; extern const int pattern_size; /* length of pattern array */ -int main __P((int, char *[])); -void primes __P((ubig, ubig)); -ubig read_num_buf __P((void)); -void usage __P((void)) __attribute__((__noreturn__)); +int main(int, char *[]); +void primes(ubig, ubig); +ubig read_num_buf(void); +void usage(void) __attribute__((__noreturn__)); int main(argc, argv) diff --git a/quiz/quiz.c b/quiz/quiz.c index b6616eb..7627874 100644 --- a/quiz/quiz.c +++ b/quiz/quiz.c @@ -1,4 +1,4 @@ -/* $NetBSD: quiz.c,v 1.19 2003/08/07 09:37:34 agc Exp $ */ +/* $NetBSD: quiz.c,v 1.20 2004/01/27 20:30:30 jsm Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\ #if 0 static char sccsid[] = "@(#)quiz.c 8.3 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: quiz.c,v 1.19 2003/08/07 09:37:34 agc Exp $"); +__RCSID("$NetBSD: quiz.c,v 1.20 2004/01/27 20:30:30 jsm Exp $"); #endif #endif /* not lint */ @@ -65,16 +65,16 @@ static QE qlist; static int catone, cattwo, tflag; static u_int qsize; -char *appdstr __P((char *, const char *, size_t)); -void downcase __P((char *)); -void get_cats __P((char *, char *)); -void get_file __P((const char *)); -int main __P((int, char *[])); -const char *next_cat __P((const char *)); -void quiz __P((void)); -void score __P((u_int, u_int, u_int)); -void show_index __P((void)); -void usage __P((void)) __attribute__((__noreturn__)); +char *appdstr(char *, const char *, size_t); +void downcase(char *); +void get_cats(char *, char *); +void get_file(const char *); +int main(int, char *[]); +const char *next_cat(const char *); +void quiz(void); +void score(u_int, u_int, u_int); +void show_index(void); +void usage(void) __attribute__((__noreturn__)); int main(argc, argv) diff --git a/quiz/quiz.h b/quiz/quiz.h index 3bfe044..9884b50 100644 --- a/quiz/quiz.h +++ b/quiz/quiz.h @@ -1,4 +1,4 @@ -/* $NetBSD: quiz.h,v 1.6 2003/08/07 09:37:34 agc Exp $ */ +/* $NetBSD: quiz.h,v 1.7 2004/01/27 20:30:30 jsm Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -54,6 +54,6 @@ typedef struct qentry { extern char rxperr[]; -int rxp_compile __P((const char *)); -char *rxp_expand __P((void)); -int rxp_match __P((const char *)); +int rxp_compile(const char *); +char *rxp_expand(void); +int rxp_match(const char *); diff --git a/quiz/rxp.c b/quiz/rxp.c index 47c82d8..fa1f07f 100644 --- a/quiz/rxp.c +++ b/quiz/rxp.c @@ -1,4 +1,4 @@ -/* $NetBSD: rxp.c,v 1.11 2003/08/07 09:37:34 agc Exp $ */ +/* $NetBSD: rxp.c,v 1.12 2004/01/27 20:30:30 jsm Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)rxp.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: rxp.c,v 1.11 2003/08/07 09:37:34 agc Exp $"); +__RCSID("$NetBSD: rxp.c,v 1.12 2004/01/27 20:30:30 jsm Exp $"); #endif #endif /* not lint */ @@ -82,9 +82,9 @@ typedef short Rxp_t; /* type for regexp tokens */ static Rxp_t rxpbuf[RXP_LINE_SZ]; /* compiled regular expression buffer */ char rxperr[128]; /* parser error message */ -static int rxp__compile __P((const char *, int)); -static char *rxp__expand __P((int)); -static int rxp__match __P((const char *, int, Rxp_t *, Rxp_t *, const char *)); +static int rxp__compile(const char *, int); +static char *rxp__expand(int); +static int rxp__match(const char *, int, Rxp_t *, Rxp_t *, const char *); int rxp_compile(s) diff --git a/rain/rain.c b/rain/rain.c index 4da1dba..9ae8605 100644 --- a/rain/rain.c +++ b/rain/rain.c @@ -1,4 +1,4 @@ -/* $NetBSD: rain.c,v 1.14 2003/08/07 09:37:35 agc Exp $ */ +/* $NetBSD: rain.c,v 1.16 2004/02/08 22:21:57 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ #if 0 static char sccsid[] = "@(#)rain.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: rain.c,v 1.14 2003/08/07 09:37:35 agc Exp $"); +__RCSID("$NetBSD: rain.c,v 1.16 2004/02/08 22:21:57 jsm Exp $"); #endif #endif /* not lint */ @@ -59,8 +59,8 @@ __RCSID("$NetBSD: rain.c,v 1.14 2003/08/07 09:37:35 agc Exp $"); volatile sig_atomic_t sig_caught = 0; -int main __P((int, char **)); -void onsig __P((int)); +int main(int, char **); +void onsig(int); int @@ -92,7 +92,6 @@ main(argc, argv) } initscr(); - leaveok(stdscr, TRUE); cols = COLS - 4; lines = LINES - 4; @@ -103,6 +102,7 @@ main(argc, argv) (void)signal(SIGTSTP, onsig); (void)signal(SIGTERM, onsig); + curs_set(0); for (j = 4; j >= 0; --j) { xpos[j] = random() % cols + 2; ypos[j] = random() % lines + 2; diff --git a/random/random.c b/random/random.c index 5a3fbcd..a97736f 100644 --- a/random/random.c +++ b/random/random.c @@ -1,4 +1,4 @@ -/* $NetBSD: random.c,v 1.8 2003/08/07 09:37:35 agc Exp $ */ +/* $NetBSD: random.c,v 1.9 2004/01/27 20:30:30 jsm Exp $ */ /* * Copyright (c) 1994 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1994\n\ #if 0 static char sccsid[] = "@(#)random.c 8.6 (Berkeley) 6/1/94"; #else -__RCSID("$NetBSD: random.c,v 1.8 2003/08/07 09:37:35 agc Exp $"); +__RCSID("$NetBSD: random.c,v 1.9 2004/01/27 20:30:30 jsm Exp $"); #endif #endif /* not lint */ @@ -59,8 +59,8 @@ __RCSID("$NetBSD: random.c,v 1.8 2003/08/07 09:37:35 agc Exp $"); #define MAXRANDOM 2147483647 -int main __P((int, char **)); -void usage __P((void)) __attribute__((__noreturn__)); +int main(int, char **); +void usage(void) __attribute__((__noreturn__)); int main(argc, argv) diff --git a/robots/auto.c b/robots/auto.c index 29bba25..c2babc4 100644 --- a/robots/auto.c +++ b/robots/auto.c @@ -1,4 +1,4 @@ -/* $NetBSD: auto.c,v 1.5 2002/01/31 17:35:52 christos Exp $ */ +/* $NetBSD: auto.c,v 1.6 2004/01/27 20:30:30 jsm Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -67,16 +67,16 @@ #define CONSDEBUG(a) -static int distance __P((int, int, int, int)); -static int xinc __P((int)); -static int yinc __P((int)); -static const char *find_moves __P((void)); -static COORD *closest_robot __P((int *)); -static COORD *closest_heap __P((int *)); -static char move_towards __P((int, int)); -static char move_away __P((COORD *)); -static char move_between __P((COORD *, COORD *)); -static int between __P((COORD *, COORD *)); +static int distance(int, int, int, int); +static int xinc(int); +static int yinc(int); +static const char *find_moves(void); +static COORD *closest_robot(int *); +static COORD *closest_heap(int *); +static char move_towards(int, int); +static char move_away(COORD *); +static char move_between(COORD *, COORD *); +static int between(COORD *, COORD *); /* distance(): * return "move" number distance of the two coordinates diff --git a/robots/main.c b/robots/main.c index 6fb8827..ddc28cf 100644 --- a/robots/main.c +++ b/robots/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.19 2003/08/07 09:37:36 agc Exp $ */ +/* $NetBSD: main.c,v 1.20 2004/01/27 20:30:30 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -39,13 +39,13 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: main.c,v 1.19 2003/08/07 09:37:36 agc Exp $"); +__RCSID("$NetBSD: main.c,v 1.20 2004/01/27 20:30:30 jsm Exp $"); #endif #endif /* not lint */ # include "robots.h" -int main __P((int, char **)); +int main(int, char **); extern const char *Scorefile; extern int Max_per_uid; diff --git a/robots/robots.h b/robots/robots.h index 85ca4f1..b08909a 100644 --- a/robots/robots.h +++ b/robots/robots.h @@ -1,4 +1,4 @@ -/* $NetBSD: robots.h,v 1.16 2003/08/07 09:37:37 agc Exp $ */ +/* $NetBSD: robots.h,v 1.18 2004/01/27 20:30:30 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -32,12 +32,12 @@ */ # include +# include # include # include # include # include # include -# include # include # include # include @@ -120,27 +120,27 @@ extern jmp_buf End_move; * functions types */ -void add_score __P((int)); -bool another __P((void)); -char automove __P((void)); -int cmp_sc __P((const void *, const void *)); -bool do_move __P((int, int)); -bool eaten __P((const COORD *)); -void flush_in __P((void)); -void get_move __P((void)); -void init_field __P((void)); -bool jumping __P((void)); -void make_level __P((void)); -void move_robots __P((int)); -bool must_telep __P((void)); -void play_level __P((void)); -int query __P((const char *)); -void quit __P((int)) __attribute__((__noreturn__)); -void reset_count __P((void)); -int rnd __P((int)); -COORD *rnd_pos __P((void)); -void score __P((int)); -void set_name __P((SCORE *)); -void show_score __P((void)); -int sign __P((int)); -void telmsg __P((int)); +void add_score(int); +bool another(void); +char automove(void); +int cmp_sc(const void *, const void *); +bool do_move(int, int); +bool eaten(const COORD *); +void flush_in(void); +void get_move(void); +void init_field(void); +bool jumping(void); +void make_level(void); +void move_robots(int); +bool must_telep(void); +void play_level(void); +int query(const char *); +void quit(int) __attribute__((__noreturn__)); +void reset_count(void); +int rnd(int); +COORD *rnd_pos(void); +void score(int); +void set_name(SCORE *); +void show_score(void); +int sign(int); +void telmsg(int); diff --git a/robots/score.c b/robots/score.c index ad33760..4c87bd4 100644 --- a/robots/score.c +++ b/robots/score.c @@ -1,4 +1,4 @@ -/* $NetBSD: score.c,v 1.16 2003/08/07 09:37:37 agc Exp $ */ +/* $NetBSD: score.c,v 1.17 2004/01/27 20:30:30 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: score.c,v 1.16 2003/08/07 09:37:37 agc Exp $"); +__RCSID("$NetBSD: score.c,v 1.17 2004/01/27 20:30:30 jsm Exp $"); #endif #endif /* not lint */ @@ -49,8 +49,8 @@ static SCORE Top[MAXSCORES]; static u_int32_t numscores, max_uid; -static void read_score __P((int)); -static void write_score __P((int)); +static void read_score(int); +static void write_score(int); /* * read_score: diff --git a/sail/extern.h b/sail/extern.h index b03e009..f228840 100644 --- a/sail/extern.h +++ b/sail/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.25 2003/08/07 09:37:42 agc Exp $ */ +/* $NetBSD: extern.h,v 1.27 2004/02/08 00:32:48 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -32,6 +32,7 @@ */ #include + #include "machdep.h" /* program mode */ diff --git a/sail/main.c b/sail/main.c index 232a34a..5f030bd 100644 --- a/sail/main.c +++ b/sail/main.c @@ -44,8 +44,8 @@ __RCSID("$NetBSD: main.c,v 1.21 2003/08/07 09:37:43 agc Exp $"); #endif /* not lint */ #include -#include #include +#include #include #include #include diff --git a/sail/misc.c b/sail/misc.c index 5a421b0..fe6ca52 100644 --- a/sail/misc.c +++ b/sail/misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: misc.c,v 1.13 2003/08/07 09:37:43 agc Exp $ */ +/* $NetBSD: misc.c,v 1.14 2004/02/08 00:32:48 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,13 +34,14 @@ #if 0 static char sccsid[] = "@(#)misc.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: misc.c,v 1.13 2003/08/07 09:37:43 agc Exp $"); +__RCSID("$NetBSD: misc.c,v 1.14 2004/02/08 00:32:48 jsm Exp $"); #endif #endif /* not lint */ +#include + #include #include -#include #include #include #include diff --git a/sail/pl_1.c b/sail/pl_1.c index 6239ddd..f80f502 100644 --- a/sail/pl_1.c +++ b/sail/pl_1.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_1.c,v 1.17 2003/08/07 09:37:43 agc Exp $ */ +/* $NetBSD: pl_1.c,v 1.18 2004/01/27 20:23:36 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)pl_1.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: pl_1.c,v 1.17 2003/08/07 09:37:43 agc Exp $"); +__RCSID("$NetBSD: pl_1.c,v 1.18 2004/01/27 20:23:36 jsm Exp $"); #endif #endif /* not lint */ @@ -129,12 +129,12 @@ choke(int n __attribute__((__unused__))) void child(int n __attribute__((__unused__))) { - union wait status; + int status; int pid; signal(SIGCHLD, SIG_IGN); do { - pid = wait3((int *)&status, WNOHANG, (struct rusage *)0); + pid = wait3(&status, WNOHANG, (struct rusage *)0); if (pid < 0 || (pid > 0 && !WIFSTOPPED(status))) hasdriver = 0; } while (pid > 0); diff --git a/sail/sync.c b/sail/sync.c index 861a4b1..cb7a078 100644 --- a/sail/sync.c +++ b/sail/sync.c @@ -1,4 +1,4 @@ -/* $NetBSD: sync.c,v 1.21 2003/08/07 09:37:45 agc Exp $ */ +/* $NetBSD: sync.c,v 1.22 2004/01/27 20:27:59 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,10 +34,13 @@ #if 0 static char sccsid[] = "@(#)sync.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: sync.c,v 1.21 2003/08/07 09:37:45 agc Exp $"); +__RCSID("$NetBSD: sync.c,v 1.22 2004/01/27 20:27:59 jsm Exp $"); #endif #endif /* not lint */ +#include +#include + #include #include #include @@ -45,9 +48,6 @@ __RCSID("$NetBSD: sync.c,v 1.21 2003/08/07 09:37:45 agc Exp $"); #include #include #include -#include -#include -#include #include #include #include "extern.h" diff --git a/snake/snake/snake.c b/snake/snake/snake.c index 10045d5..5e1ece5 100644 --- a/snake/snake/snake.c +++ b/snake/snake/snake.c @@ -1,4 +1,4 @@ -/* $NetBSD: snake.c,v 1.18 2003/08/07 09:37:45 agc Exp $ */ +/* $NetBSD: snake.c,v 1.20 2004/02/08 00:33:31 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ #if 0 static char sccsid[] = "@(#)snake.c 8.2 (Berkeley) 1/7/94"; #else -__RCSID("$NetBSD: snake.c,v 1.18 2003/08/07 09:37:45 agc Exp $"); +__RCSID("$NetBSD: snake.c,v 1.20 2004/02/08 00:33:31 jsm Exp $"); #endif #endif /* not lint */ @@ -115,29 +115,29 @@ FILE *logfile; int lcnt, ccnt; /* user's idea of screen size */ int chunk; /* amount of money given at a time */ -void chase __P((struct point *, struct point *)); -int chk __P((const struct point *)); -void drawbox __P((void)); -void flushi __P((void)); -void home __P((void)); -void length __P((int)); -void logit __P((const char *)); -int main __P((int, char **)); -void mainloop __P((void)) __attribute__((__noreturn__)); -struct point *point __P((struct point *, int, int)); -int post __P((int, int)); -int pushsnake __P((void)); -void right __P((const struct point *)); -void setup __P((void)); -void snap __P((void)); -void snrand __P((struct point *)); -void spacewarp __P((int)); -void stop __P((int)) __attribute__((__noreturn__)); -int stretch __P((const struct point *)); -void surround __P((struct point *)); -void suspend __P((void)); -void win __P((const struct point *)); -void winnings __P((int)); +void chase(struct point *, struct point *); +int chk(const struct point *); +void drawbox(void); +void flushi(void); +void home(void); +void length(int); +void logit(const char *); +int main(int, char **); +void mainloop(void) __attribute__((__noreturn__)); +struct point *point(struct point *, int, int); +int post(int, int); +int pushsnake(void); +void right(const struct point *); +void setup(void); +void snap(void); +void snrand(struct point *); +void spacewarp(int); +void stop(int) __attribute__((__noreturn__)); +int stretch(const struct point *); +void surround(struct point *); +void suspend(void); +void win(const struct point *); +void winnings(int); int main(argc, argv) diff --git a/snake/snscore/snscore.c b/snake/snscore/snscore.c index 8741c0f..5867c39 100644 --- a/snake/snscore/snscore.c +++ b/snake/snscore/snscore.c @@ -1,4 +1,4 @@ -/* $NetBSD: snscore.c,v 1.14 2003/08/07 09:37:47 agc Exp $ */ +/* $NetBSD: snscore.c,v 1.15 2004/01/27 20:30:30 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ #if 0 static char sccsid[] = "@(#)snscore.c 8.1 (Berkeley) 7/19/93"; #else -__RCSID("$NetBSD: snscore.c,v 1.14 2003/08/07 09:37:47 agc Exp $"); +__RCSID("$NetBSD: snscore.c,v 1.15 2004/01/27 20:30:30 jsm Exp $"); #endif #endif /* not lint */ @@ -61,7 +61,7 @@ struct player { char *name; } players[MAXPLAYERS], temp; -int main __P((void)); +int main(void); int main() diff --git a/substfiles2 b/substfiles2 index 4f9ebdb..5f7aae3 100644 --- a/substfiles2 +++ b/substfiles2 @@ -1,7 +1,7 @@ # substfiles2 - list of files in which parameters are to be substituted. # These ones get substituted during the make process. # -# Copyright (c) 1997, 1998, 1999, 2000, 2003 Joseph Samuel Myers. +# Copyright (c) 1997, 1998, 1999, 2000, 2003, 2004 Joseph Samuel Myers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -46,5 +46,6 @@ robots/robots.6 rogue/rogue.6 snake/snake/snake.6 tetris/tetris.6 +trek/trek.6 wtf/wtf.6 wtf/wtf diff --git a/substscr b/substscr index 35ae97b..877f0df 100755 --- a/substscr +++ b/substscr @@ -1,7 +1,7 @@ #!/bin/sh # substscr - substitute parameters to create a file from a .in. # -# Copyright (c) 1999 Joseph Samuel Myers. +# Copyright (c) 1999, 2004 Joseph Samuel Myers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -42,7 +42,7 @@ # Fourth argument is the target file. -# The target gets its permissions from the source. +# The target gets its execute permissions from the source. set -e @@ -59,7 +59,6 @@ target="$4" if echo $action |grep -q g; then echo "Generating $target from $source" rm -f $target - cp "$source" "$target" # set permissions case "$style" in (c) @@ -84,6 +83,10 @@ if echo $action |grep -q g; then esac sed -f subst.sed <"$source" >>"$target" + + if [ -x "$source" ]; then + chmod a+x "$target" + fi fi if echo $action |grep -q r; then diff --git a/tests/factor.2147483647111311 b/tests/factor.2147483647111311 new file mode 100644 index 0000000..ddcec23 --- /dev/null +++ b/tests/factor.2147483647111311 @@ -0,0 +1 @@ +2147483647111311: 3 3 3 131 607148331103 diff --git a/tests/factor.6172538568 b/tests/factor.6172538568 new file mode 100644 index 0000000..11133b9 --- /dev/null +++ b/tests/factor.6172538568 @@ -0,0 +1 @@ +6172538568: 2 2 2 3 7 17 2161253 diff --git a/tests/factor.8675309 b/tests/factor.8675309 new file mode 100644 index 0000000..d6a5670 --- /dev/null +++ b/tests/factor.8675309 @@ -0,0 +1 @@ +8675309: 8675309 diff --git a/tests/factor.99999999999991 b/tests/factor.99999999999991 new file mode 100644 index 0000000..ec937bd --- /dev/null +++ b/tests/factor.99999999999991 @@ -0,0 +1 @@ +99999999999991: 7 13 769231 1428571 diff --git a/tests/factor.test b/tests/factor.test index f590231..2e75422 100755 --- a/tests/factor.test +++ b/tests/factor.test @@ -1,7 +1,7 @@ #!/bin/sh # tests/factor.test - test functionality of factor. # -# Copyright (c) 1999, 2003 Joseph Samuel Myers. +# Copyright (c) 1999, 2003, 2004 Joseph Samuel Myers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -56,14 +56,34 @@ EOF compare test.out tests/factor.123456 rm -f test.out +testno 5 +factor/factor 8675309 >test.out 2>&1 || failtest +compare test.out tests/factor.8675309 +rm -f test.out + if grep -q HAVE_OPENSSL include/bsd-games.h; then - testno 5 + testno 6 + factor/factor 6172538568 >test.out 2>&1 || failtest + compare test.out tests/factor.6172538568 + rm -f test.out + + testno 7 factor/factor 987654321987654 >test.out 2>&1 || failtest compare test.out tests/factor.987654321987654 rm -f test.out - testno 6 + testno 8 factor/factor 987654321987654321987 >test.out 2>&1 || failtest compare test.out tests/factor.987654321987654321987 rm -f test.out + + testno 9 + factor/factor 99999999999991 >test.out 2>&1 || failtest + compare test.out tests/factor.99999999999991 + rm -f test.out + + testno 10 + factor/factor 2147483647111311 >test.out 2>&1 || failtest + compare test.out tests/factor.2147483647111311 + rm -f test.out fi diff --git a/tests/morse.SOS b/tests/morse.SOS index 22e6d98..a9547b2 100644 --- a/tests/morse.SOS +++ b/tests/morse.SOS @@ -1,3 +1,5 @@ - ..., - ---, - ..., + ... + --- + ... + + ...-.- diff --git a/tests/morse.foo b/tests/morse.foo index 96556d3..0e086cb 100644 --- a/tests/morse.foo +++ b/tests/morse.foo @@ -1,3 +1,5 @@ - dit dit daw dit, - daw daw daw, - daw daw daw, + dit dit daw dit + daw daw daw + daw daw daw + + dit dit dit daw dit daw diff --git a/tests/morse.sos b/tests/morse.sos index 77ef9f9..a206396 100644 --- a/tests/morse.sos +++ b/tests/morse.sos @@ -1 +1 @@ -sos +SOS diff --git a/tests/morse.test b/tests/morse.test index 90d26fc..016de25 100755 --- a/tests/morse.test +++ b/tests/morse.test @@ -1,7 +1,7 @@ #!/bin/sh # morse.test - test functionality of morse. # -# Copyright (c) 1999 Joseph Samuel Myers. +# Copyright (c) 1999, 2004 Joseph Samuel Myers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -33,20 +33,37 @@ set -e testexec morse morse/morse -# morse is somewhat broken and should probably be replaced with the -# OpenBSD version. This limits the tests we can do until we fix it. - testno 1 morse/morse foo >test.out 2>&1 || failtest compare test.out tests/morse.foo rm -f test.out testno 2 +echo foo |morse/morse >test.out 2>&1 || failtest +compare test.out tests/morse.foo +rm -f test.out + +testno 3 morse/morse -s SOS >test.out 2>&1 || failtest compare test.out tests/morse.SOS rm -f test.out -testno 3 +testno 4 +echo SOS |morse/morse -s >test.out 2>&1 || failtest +compare test.out tests/morse.SOS +rm -f test.out + +testno 5 morse/morse -d test.out 2>&1 || failtest compare test.out tests/morse.sos rm -f test.out + +testno 6 +echo "This is a test." |morse/morse -s >test.out 2>&1 || failtest +compare test.out tests/morse.testsent +rm -f test.out + +testno 7 +morse/morse -d test.out 2>&1 || failtest +compare test.out tests/morse.testsentd +rm -f test.out diff --git a/tests/morse.testsent b/tests/morse.testsent new file mode 100644 index 0000000..d2bcdd3 --- /dev/null +++ b/tests/morse.testsent @@ -0,0 +1,17 @@ + - + .... + .. + ... + + .. + ... + + .- + + - + . + ... + - + .-.-.- + + ...-.- diff --git a/tests/morse.testsentd b/tests/morse.testsentd new file mode 100644 index 0000000..d3adb5d --- /dev/null +++ b/tests/morse.testsentd @@ -0,0 +1 @@ +THIS IS A TEST. diff --git a/tests/pom.2003fm1 b/tests/pom.2003fm1 new file mode 100644 index 0000000..6b7376c --- /dev/null +++ b/tests/pom.2003fm1 @@ -0,0 +1 @@ +Sat 2003 Jan 18 11:00:00 (UTC): The Moon was Full diff --git a/tests/pom.2003fm2 b/tests/pom.2003fm2 new file mode 100644 index 0000000..5acd382 --- /dev/null +++ b/tests/pom.2003fm2 @@ -0,0 +1 @@ +Mon 2003 Dec 8 21:00:00 (UTC): The Moon was Full diff --git a/tests/pom.2003fq1 b/tests/pom.2003fq1 new file mode 100644 index 0000000..7c5dfa9 --- /dev/null +++ b/tests/pom.2003fq1 @@ -0,0 +1 @@ +Fri 2003 Jan 10 13:00:00 (UTC): The Moon was at the First Quarter diff --git a/tests/pom.2003fq2 b/tests/pom.2003fq2 new file mode 100644 index 0000000..a0a5625 --- /dev/null +++ b/tests/pom.2003fq2 @@ -0,0 +1 @@ +Sun 2003 Nov 30 17:00:00 (UTC): The Moon was at the First Quarter diff --git a/tests/pom.2003lq1 b/tests/pom.2003lq1 new file mode 100644 index 0000000..c239766 --- /dev/null +++ b/tests/pom.2003lq1 @@ -0,0 +1 @@ +Sat 2003 Jan 25 09:00:00 (UTC): The Moon was at the Last Quarter diff --git a/tests/pom.2003lq2 b/tests/pom.2003lq2 new file mode 100644 index 0000000..8720649 --- /dev/null +++ b/tests/pom.2003lq2 @@ -0,0 +1 @@ +Tue 2003 Dec 16 18:00:00 (UTC): The Moon was at the Last Quarter diff --git a/tests/pom.2003nm1 b/tests/pom.2003nm1 new file mode 100644 index 0000000..28f9418 --- /dev/null +++ b/tests/pom.2003nm1 @@ -0,0 +1 @@ +Thu 2003 Jan 2 20:00:00 (UTC): The Moon was New diff --git a/tests/pom.2003nm2 b/tests/pom.2003nm2 new file mode 100644 index 0000000..2c82cf2 --- /dev/null +++ b/tests/pom.2003nm2 @@ -0,0 +1 @@ +Sun 2003 Nov 23 23:00:00 (UTC): The Moon was New diff --git a/tests/pom.2003ph1 b/tests/pom.2003ph1 new file mode 100644 index 0000000..5eecf6b --- /dev/null +++ b/tests/pom.2003ph1 @@ -0,0 +1 @@ +Thu 2003 Jan 2 00:00:00 (UTC): The Moon was Waning Crescent (1% of Full) diff --git a/tests/pom.2003ph2 b/tests/pom.2003ph2 new file mode 100644 index 0000000..10ee220 --- /dev/null +++ b/tests/pom.2003ph2 @@ -0,0 +1 @@ +Mon 2003 Jan 6 00:00:00 (UTC): The Moon was Waxing Crescent (11% of Full) diff --git a/tests/pom.2003ph3 b/tests/pom.2003ph3 new file mode 100644 index 0000000..1f2f0b2 --- /dev/null +++ b/tests/pom.2003ph3 @@ -0,0 +1 @@ +Sat 2003 Jan 11 00:00:00 (UTC): The Moon was Waxing Gibbous (54% of Full) diff --git a/tests/pom.2003ph4 b/tests/pom.2003ph4 new file mode 100644 index 0000000..6e7aa77 --- /dev/null +++ b/tests/pom.2003ph4 @@ -0,0 +1 @@ +Wed 2003 Jan 22 00:00:00 (UTC): The Moon was Waning Gibbous (85% of Full) diff --git a/tests/pom.2003ph5 b/tests/pom.2003ph5 new file mode 100644 index 0000000..780239e --- /dev/null +++ b/tests/pom.2003ph5 @@ -0,0 +1 @@ +Mon 2003 Sep 1 00:00:00 (UTC): The Moon was Waxing Crescent (23% of Full) diff --git a/tests/pom.2003ph6 b/tests/pom.2003ph6 new file mode 100644 index 0000000..d6c3952 --- /dev/null +++ b/tests/pom.2003ph6 @@ -0,0 +1 @@ +Sun 2003 Sep 7 00:00:00 (UTC): The Moon was Waxing Gibbous (85% of Full) diff --git a/tests/pom.2003ph7 b/tests/pom.2003ph7 new file mode 100644 index 0000000..f1f4728 --- /dev/null +++ b/tests/pom.2003ph7 @@ -0,0 +1 @@ +Mon 2003 Sep 15 00:00:00 (UTC): The Moon was Waning Gibbous (83% of Full) diff --git a/tests/pom.2003ph8 b/tests/pom.2003ph8 new file mode 100644 index 0000000..1b6c498 --- /dev/null +++ b/tests/pom.2003ph8 @@ -0,0 +1 @@ +Mon 2003 Sep 22 00:00:00 (UTC): The Moon was Waning Crescent (20% of Full) diff --git a/tests/pom.test b/tests/pom.test index 01aff41..ad8065b 100755 --- a/tests/pom.test +++ b/tests/pom.test @@ -1,7 +1,7 @@ #!/bin/sh # pom.test - test functionality of pom. # -# Copyright (c) 1999 Joseph Samuel Myers. +# Copyright (c) 1999, 2004 Joseph Samuel Myers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -33,15 +33,15 @@ set -e testexec pom pom/pom -# Test dates from Astronomical Almanac 1998, rounded to nearest hour. -# Should add dates from other years. +export TZ=UTC0 -# We should also test the fraction illuminated given by the program, but -# it isn't really accurate enough to do this reliably and the Astronomical -# Almanac only gives these figures to 2 decimal places (like pom) so I don't -# know which are border cases and which are good tests. +# Should add dates from years before 1998. -export TZ=UTC0 +# Test dates from Astronomical Almanac 1998, rounded to nearest hour. +# We should also test the fraction illuminated given by the program, +# but the Astronomical Almanac 1998 only gives these figures to 2 +# decimal places (like pom) so I don't know which are border cases and +# which are good tests. testno 1 pom/pom 1998010514 >test.out 2>&1 || failtest @@ -82,3 +82,89 @@ testno 8 pom/pom 1998111100 >test.out 2>&1 || failtest compare test.out tests/pom.1998lq2 rm -f test.out + +# Test dates from Astronomical Almanac 2003, rounded to nearest hour, +# and fractions of illumination at the start of the day. + +testno 9 +pom/pom 2003010220 >test.out 2>&1 || failtest +compare test.out tests/pom.2003nm1 +rm -f test.out + +testno 10 +pom/pom 2003011013 >test.out 2>&1 || failtest +compare test.out tests/pom.2003fq1 +rm -f test.out + +testno 11 +pom/pom 2003011811 >test.out 2>&1 || failtest +compare test.out tests/pom.2003fm1 +rm -f test.out + +testno 12 +pom/pom 2003012509 >test.out 2>&1 || failtest +compare test.out tests/pom.2003lq1 +rm -f test.out + +testno 13 +pom/pom 2003112323 >test.out 2>&1 || failtest +compare test.out tests/pom.2003nm2 +rm -f test.out + +testno 14 +pom/pom 2003113017 >test.out 2>&1 || failtest +compare test.out tests/pom.2003fq2 +rm -f test.out + +testno 15 +pom/pom 2003120821 >test.out 2>&1 || failtest +compare test.out tests/pom.2003fm2 +rm -f test.out + +testno 16 +pom/pom 2003121618 >test.out 2>&1 || failtest +compare test.out tests/pom.2003lq2 +rm -f test.out + +testno 17 +pom/pom 2003010200 >test.out 2>&1 || failtest +compare test.out tests/pom.2003ph1 +rm -f test.out + +testno 18 +pom/pom 2003010600 >test.out 2>&1 || failtest +compare test.out tests/pom.2003ph2 +rm -f test.out + +testno 19 +pom/pom 2003011100 >test.out 2>&1 || failtest +compare test.out tests/pom.2003ph3 +rm -f test.out + +testno 20 +pom/pom 2003012200 >test.out 2>&1 || failtest +compare test.out tests/pom.2003ph4 +rm -f test.out + +testno 21 +pom/pom 2003090100 >test.out 2>&1 || failtest +compare test.out tests/pom.2003ph5 +rm -f test.out + +testno 22 +pom/pom 2003090700 >test.out 2>&1 || failtest +compare test.out tests/pom.2003ph6 +rm -f test.out + +testno 23 +pom/pom 2003091500 >test.out 2>&1 || failtest +compare test.out tests/pom.2003ph7 +rm -f test.out + +testno 24 +pom/pom 2003092200 >test.out 2>&1 || failtest +compare test.out tests/pom.2003ph8 +rm -f test.out + +# Note that the output of pom differs for dates in the past and the +# future, so future dates are not good tests. diff --git a/tetris/input.h b/tetris/input.h index 5ff868b..856c66a 100644 --- a/tetris/input.h +++ b/tetris/input.h @@ -1,4 +1,4 @@ -/* $NetBSD: input.h,v 1.4 2003/08/07 09:37:48 agc Exp $ */ +/* $NetBSD: input.h,v 1.5 2004/01/27 20:30:30 jsm Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -34,6 +34,6 @@ * @(#)input.h 8.1 (Berkeley) 5/31/93 */ -int rwait __P((struct timeval *)); -int tgetchar __P((void)); -void tsleep __P((void)); +int rwait(struct timeval *); +int tgetchar(void); +void tsleep(void); diff --git a/tetris/scores.c b/tetris/scores.c index 544d581..d731e25 100644 --- a/tetris/scores.c +++ b/tetris/scores.c @@ -1,4 +1,4 @@ -/* $NetBSD: scores.c,v 1.12 2003/08/07 09:37:48 agc Exp $ */ +/* $NetBSD: scores.c,v 1.13 2004/01/27 20:30:30 jsm Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -75,11 +75,11 @@ static int nscores; static int gotscores; static struct highscore scores[NUMSPOTS]; -static int checkscores __P((struct highscore *, int)); -static int cmpscores __P((const void *, const void *)); -static void getscores __P((FILE **)); -static void printem __P((int, int, struct highscore *, int, const char *)); -static char *thisuser __P((void)); +static int checkscores(struct highscore *, int); +static int cmpscores(const void *, const void *); +static void getscores(FILE **); +static void printem(int, int, struct highscore *, int, const char *); +static char *thisuser(void); /* * Read the score file. Can be called from savescore (before showscores) diff --git a/tetris/scores.h b/tetris/scores.h index eac47aa..2a5baa4 100644 --- a/tetris/scores.h +++ b/tetris/scores.h @@ -1,4 +1,4 @@ -/* $NetBSD: scores.h,v 1.3 2003/08/07 09:37:48 agc Exp $ */ +/* $NetBSD: scores.h,v 1.4 2004/01/27 20:30:30 jsm Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -48,5 +48,5 @@ struct highscore { #define MAXSCORES 9 /* maximum high score entries per person */ #define EXPIRATION (5L * 365 * 24 * 60 * 60) -void savescore __P((int)); -void showscores __P((int)); +void savescore(int); +void showscores(int); diff --git a/tetris/screen.c b/tetris/screen.c index db7a90e..687cd91 100644 --- a/tetris/screen.c +++ b/tetris/screen.c @@ -1,4 +1,4 @@ -/* $NetBSD: screen.c,v screen.c,v 1.18 2003/08/07 09:37:48 agc Exp $ */ +/* $NetBSD: screen.c,v screen.c,v 1.19 2004/01/27 20:30:30 jsm Exp $ */ /* For Linux: still using old termcap interface from version 1.13. */ /*- @@ -61,10 +61,10 @@ static cell curscreen[B_SIZE]; /* 1 => standout (or otherwise marked) */ static int curscore; static int isset; /* true => terminal is in game mode */ static struct termios oldtt; -static void (*tstp) __P((int)); +static void (*tstp)(int); -static void scr_stop __P((int)); -static void stopset __P((int)) __attribute__((__noreturn__)); +static void scr_stop(int); +static void stopset(int) __attribute__((__noreturn__)); /* @@ -251,7 +251,7 @@ scr_set() struct winsize ws; struct termios newtt; sigset_t sigset, osigset; - void (*ttou) __P((int)); + void (*ttou)(int); sigemptyset(&sigset); sigaddset(&sigset, SIGTSTP); diff --git a/tetris/screen.h b/tetris/screen.h index 070440f..964b00d 100644 --- a/tetris/screen.h +++ b/tetris/screen.h @@ -1,4 +1,4 @@ -/* $NetBSD: screen.h,v 1.7 2003/08/07 09:37:48 agc Exp $ */ +/* $NetBSD: screen.h,v 1.8 2004/01/27 20:30:30 jsm Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -45,10 +45,10 @@ extern char *SOstr; /* begin standout mode */ */ #define putpad(s) tputs(s, 1, put) -int put __P((int)); /* just calls putchar; for tputs */ -void scr_clear __P((void)); -void scr_end __P((void)); -void scr_init __P((void)); -void scr_msg __P((char *, int)); -void scr_set __P((void)); -void scr_update __P((void)); +int put(int); /* just calls putchar; for tputs */ +void scr_clear(void); +void scr_end(void); +void scr_init(void); +void scr_msg(char *, int); +void scr_set(void); +void scr_update(void); diff --git a/tetris/tetris.c b/tetris/tetris.c index 7fad938..ba830bf 100644 --- a/tetris/tetris.c +++ b/tetris/tetris.c @@ -1,4 +1,4 @@ -/* $NetBSD: tetris.c,v 1.16 2003/08/07 09:37:48 agc Exp $ */ +/* $NetBSD: tetris.c,v 1.17 2004/01/27 20:30:30 jsm Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -74,11 +74,11 @@ gid_t gid, egid; char key_msg[100]; int showpreview; -static void elide __P((void)); -static void setup_board __P((void)); - int main __P((int, char **)); - void onintr __P((int)) __attribute__((__noreturn__)); - void usage __P((void)) __attribute__((__noreturn__)); +static void elide(void); +static void setup_board(void); + int main(int, char **); + void onintr(int) __attribute__((__noreturn__)); + void usage(void) __attribute__((__noreturn__)); /* * Set up the initial board. The bottom display row is completely set, diff --git a/tetris/tetris.h b/tetris/tetris.h index 68268f2..6b3664b 100644 --- a/tetris/tetris.h +++ b/tetris/tetris.h @@ -1,4 +1,4 @@ -/* $NetBSD: tetris.h,v 1.9 2003/08/07 09:37:49 agc Exp $ */ +/* $NetBSD: tetris.h,v 1.10 2004/01/27 20:30:30 jsm Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -169,6 +169,6 @@ extern gid_t gid, egid; extern char key_msg[100]; extern int showpreview; -int fits_in __P((const struct shape *, int)); -void place __P((const struct shape *, int, int)); -void stop __P((const char *)) __attribute__((__noreturn__)); +int fits_in(const struct shape *, int); +void place(const struct shape *, int, int); +void stop(const char *) __attribute__((__noreturn__)); diff --git a/trek/Makefrag b/trek/Makefrag index 9c62364..f903670 100644 --- a/trek/Makefrag +++ b/trek/Makefrag @@ -1,6 +1,6 @@ # Makefrag - makefile fragment for trek # -# Copyright (c) 1997, 1998 Joseph Samuel Myers. +# Copyright (c) 1997, 1998, 2004 Joseph Samuel Myers. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -26,11 +26,12 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. -trek_DIRS := $(GAMESDIR) $(MAN6DIR) +trek_DIRS := $(GAMESDIR) $(MAN6DIR) $(DOCDIR) -trek_all: trek/trek trek/trek.6 +trek_all: trek/trek trek/trek.6 trek/USD.doc/trek.me trek_install: trek_all $(INSTALL_BINARY) trek/trek $(INSTALL_PREFIX)$(GAMESDIR)/trek $(HIDE_GAME) trek $(INSTALL_MANUAL) trek/trek.6 + $(INSTALL_DATA) trek/USD.doc/trek.me $(INSTALL_PREFIX)$(DOCDIR)/trek.me diff --git a/trek/README.linux b/trek/README.linux deleted file mode 100644 index 1fe554a..0000000 --- a/trek/README.linux +++ /dev/null @@ -1,8 +0,0 @@ -1997-05-18 - -The full trek manual is in USD.doc/trek.me; this is not installed by -the Makefile. You may wish to install it somewhere; if you do, -remember to update the reference to /usr/doc/trek in the man page. - -Joseph Myers -jsm@polyomino.org.uk diff --git a/trek/compkl.c b/trek/compkl.c index ecc6979..85a9485 100644 --- a/trek/compkl.c +++ b/trek/compkl.c @@ -1,4 +1,4 @@ -/* $NetBSD: compkl.c,v 1.5 2003/08/07 09:37:50 agc Exp $ */ +/* $NetBSD: compkl.c,v 1.6 2004/01/27 20:30:30 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)compkl.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: compkl.c,v 1.5 2003/08/07 09:37:50 agc Exp $"); +__RCSID("$NetBSD: compkl.c,v 1.6 2004/01/27 20:30:30 jsm Exp $"); #endif #endif /* not lint */ @@ -52,7 +52,7 @@ __RCSID("$NetBSD: compkl.c,v 1.5 2003/08/07 09:37:50 agc Exp $"); ** move. */ -static void sortkl __P((void)); +static void sortkl(void); void compkldist(f) diff --git a/trek/computer.c b/trek/computer.c index 818b5b9..57f4846 100644 --- a/trek/computer.c +++ b/trek/computer.c @@ -1,4 +1,4 @@ -/* $NetBSD: computer.c,v 1.9 2003/08/07 09:37:50 agc Exp $ */ +/* $NetBSD: computer.c,v 1.10 2004/01/27 20:30:30 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)computer.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: computer.c,v 1.9 2003/08/07 09:37:50 agc Exp $"); +__RCSID("$NetBSD: computer.c,v 1.10 2004/01/27 20:30:30 jsm Exp $"); #endif #endif /* not lint */ @@ -104,8 +104,8 @@ struct cvntab Cputab[] = { NULL, NULL, NULL, 0 } }; -static int kalc __P((int, int, int, int, double *)); -static void prkalc __P((int, double)); +static int kalc(int, int, int, int, double *); +static void prkalc(int, double); /*ARGSUSED*/ void diff --git a/trek/dumpgame.c b/trek/dumpgame.c index f0d4cbd..0e09e56 100644 --- a/trek/dumpgame.c +++ b/trek/dumpgame.c @@ -1,4 +1,4 @@ -/* $NetBSD: dumpgame.c,v 1.8 2003/08/07 09:37:51 agc Exp $ */ +/* $NetBSD: dumpgame.c,v 1.9 2004/01/27 20:30:31 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)dumpgame.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: dumpgame.c,v 1.8 2003/08/07 09:37:51 agc Exp $"); +__RCSID("$NetBSD: dumpgame.c,v 1.9 2004/01/27 20:30:31 jsm Exp $"); #endif #endif /* not lint */ @@ -53,7 +53,7 @@ struct dump int count; }; -static int readdump __P((int)); +static int readdump(int); struct dump Dump_template[] = diff --git a/trek/getpar.c b/trek/getpar.c index 125cb9c..5d56832 100644 --- a/trek/getpar.c +++ b/trek/getpar.c @@ -1,4 +1,4 @@ -/* $NetBSD: getpar.c,v 1.11 2003/08/07 09:37:51 agc Exp $ */ +/* $NetBSD: getpar.c,v 1.12 2004/01/27 20:30:31 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)getpar.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: getpar.c,v 1.11 2003/08/07 09:37:51 agc Exp $"); +__RCSID("$NetBSD: getpar.c,v 1.12 2004/01/27 20:30:31 jsm Exp $"); #endif #endif /* not lint */ @@ -44,7 +44,7 @@ __RCSID("$NetBSD: getpar.c,v 1.11 2003/08/07 09:37:51 agc Exp $"); #include "getpar.h" #include "trek.h" -static int testterm __P((void)); +static int testterm(void); /** ** get integer parameter diff --git a/trek/getpar.h b/trek/getpar.h index 23b2bab..8363697 100644 --- a/trek/getpar.h +++ b/trek/getpar.h @@ -1,4 +1,4 @@ -/* $NetBSD: getpar.h,v 1.8 2003/11/17 11:16:10 wiz Exp $ */ +/* $NetBSD: getpar.h,v 1.9 2004/01/27 20:30:31 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -31,7 +31,7 @@ * @(#)getpar.h 8.1 (Berkeley) 5/31/93 */ -typedef void (*cmdfun) __P((int)); +typedef void (*cmdfun)(int); struct cvntab /* used for getcodpar() parameter list */ { const char *abrev; @@ -40,11 +40,11 @@ struct cvntab /* used for getcodpar() parameter list */ int value2; }; -int getintpar __P((const char *)); -double getfltpar __P((const char *)); -int getynpar __P((const char *)); -const struct cvntab *getcodpar __P((const char *, const struct cvntab[])); -void getstrpar __P((const char *, char *, int, const char *)); -int testnl __P((void)); -void skiptonl __P((int)); -int readdelim __P((int)); +int getintpar(const char *); +double getfltpar(const char *); +int getynpar(const char *); +const struct cvntab *getcodpar(const char *, const struct cvntab[]); +void getstrpar(const char *, char *, int, const char *); +int testnl(void); +void skiptonl(int); +int readdelim(int); diff --git a/trek/main.c b/trek/main.c index 345a732..f4f679d 100644 --- a/trek/main.c +++ b/trek/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.11 2003/08/07 09:37:52 agc Exp $ */ +/* $NetBSD: main.c,v 1.12 2004/01/27 20:30:31 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: main.c,v 1.11 2003/08/07 09:37:52 agc Exp $"); +__RCSID("$NetBSD: main.c,v 1.12 2004/01/27 20:30:31 jsm Exp $"); #endif #endif /* not lint */ @@ -157,7 +157,7 @@ uid_t Mother = 51 + (51 << 8); jmp_buf env; -int main __P((int, char **)); +int main(int, char **); int main(argc, argv) diff --git a/trek/torped.c b/trek/torped.c index e270b6d..893a706 100644 --- a/trek/torped.c +++ b/trek/torped.c @@ -1,4 +1,4 @@ -/* $NetBSD: torped.c,v 1.7 2003/08/07 09:37:54 agc Exp $ */ +/* $NetBSD: torped.c,v 1.8 2004/01/27 20:30:31 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)torped.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: torped.c,v 1.7 2003/08/07 09:37:54 agc Exp $"); +__RCSID("$NetBSD: torped.c,v 1.8 2004/01/27 20:30:31 jsm Exp $"); #endif #endif /* not lint */ @@ -63,7 +63,7 @@ __RCSID("$NetBSD: torped.c,v 1.7 2003/08/07 09:37:54 agc Exp $"); ** the misfire damages your torpedo tubes. */ -static int randcourse __P((int)); +static int randcourse(int); /*ARGSUSED*/ void diff --git a/trek/trek.6 b/trek/trek.6.in similarity index 99% rename from trek/trek.6 rename to trek/trek.6.in index 083cacf..e3cc135 100644 --- a/trek/trek.6 +++ b/trek/trek.6.in @@ -78,7 +78,7 @@ the game will tell you what it expects if you just type in a question mark. .Sh AUTHOR .An Eric Allman .Sh SEE ALSO -.Pa /usr/share/doc/usd/31.trek +.Pa @docdir@/trek.me .Sh COMMAND SUMMARY .Bl -item -compact .It diff --git a/trek/trek.h b/trek/trek.h index 31efa6a..5a824dc 100644 --- a/trek/trek.h +++ b/trek/trek.h @@ -1,4 +1,4 @@ -/* $NetBSD: trek.h,v 1.9 2003/08/07 09:37:55 agc Exp $ */ +/* $NetBSD: trek.h,v 1.10 2004/01/27 20:30:31 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -374,155 +374,155 @@ extern struct Etc_struct Etc; extern int Trace; /* abandon.c */ -void abandon __P((int)); +void abandon(int); /* attack.c */ -void attack __P((int)); +void attack(int); /* autover.c */ -void autover __P((void)); +void autover(void); /* capture.c */ -void capture __P((int)); -struct kling *selectklingon __P((void)); +void capture(int); +struct kling *selectklingon(void); /* cgetc.c */ -char cgetc __P((int)); +char cgetc(int); /* check_out.c */ -int check_out __P((int)); +int check_out(int); /* checkcond.c */ -void checkcond __P((void)); +void checkcond(void); /* compkl.c */ -void compkldist __P((int)); +void compkldist(int); /* computer.c */ -void computer __P((int)); +void computer(int); /* damage.c */ -void damage __P((int, double)); +void damage(int, double); /* damaged.c */ -int damaged __P((int)); +int damaged(int); /* dcrept.c */ -void dcrept __P((int)); +void dcrept(int); /* destruct.c */ -void destruct __P((int)); +void destruct(int); /* dock.c */ -void dock __P((int)); -void undock __P((int)); +void dock(int); +void undock(int); /* dumpgame.c */ -void dumpgame __P((int)); -int restartgame __P((void)); +void dumpgame(int); +int restartgame(void); /* dumpme.c */ -void dumpme __P((int)); +void dumpme(int); /* dumpssradio.c */ -int dumpssradio __P((void)); +int dumpssradio(void); /* events.c */ -int events __P((int)); +int events(int); /* externs.c */ /* getcodi.c */ -int getcodi __P((int *, double *)); +int getcodi(int *, double *); /* help.c */ -void help __P((int)); +void help(int); /* impulse.c */ -void impulse __P((int)); +void impulse(int); /* initquad.c */ -void initquad __P((int)); -void sector __P((int *, int *)); +void initquad(int); +void sector(int *, int *); /* kill.c */ -void killk __P((int, int )); -void killb __P((int, int )); -void kills __P((int, int , int)); -void killd __P((int, int , int)); +void killk(int, int ); +void killb(int, int ); +void kills(int, int , int); +void killd(int, int , int); /* klmove.c */ -void klmove __P((int)); +void klmove(int); /* lose.c */ -void lose __P((int)) __attribute__((__noreturn__)); +void lose(int) __attribute__((__noreturn__)); /* lrscan.c */ -void lrscan __P((int)); +void lrscan(int); /* move.c */ -double move __P((int, int, double, double)); +double move(int, int, double, double); /* nova.c */ -void nova __P((int, int )); +void nova(int, int ); /* out.c */ -void out __P((int)); +void out(int); /* phaser.c */ -void phaser __P((int)); +void phaser(int); /* play.c */ -void myreset __P((int)) __attribute__((__noreturn__)); -void play __P((void)) __attribute__((__noreturn__)); +void myreset(int) __attribute__((__noreturn__)); +void play(void) __attribute__((__noreturn__)); /* ram.c */ -void ram __P((int, int )); +void ram(int, int ); /* ranf.c */ -int ranf __P((int)); -double franf __P((void)); +int ranf(int); +double franf(void); /* rest.c */ -void rest __P((int)); +void rest(int); /* schedule.c */ -struct event *schedule __P((int, double, int, int , int)); -void reschedule __P((struct event *, double)); -void unschedule __P((struct event *)); -struct event *xsched __P((int, int, int, int , int )); -void xresched __P((struct event *, int, int)); +struct event *schedule(int, double, int, int , int); +void reschedule(struct event *, double); +void unschedule(struct event *); +struct event *xsched(int, int, int, int , int ); +void xresched(struct event *, int, int); /* score.c */ -long score __P((void)); +long score(void); /* setup.c */ -void setup __P((void)); +void setup(void); /* setwarp.c */ -void setwarp __P((int)); +void setwarp(int); /* shield.c */ -void shield __P((int)); +void shield(int); /* snova.c */ -void snova __P((int, int )); +void snova(int, int ); /* srscan.c */ -void srscan __P((int)); +void srscan(int); /* systemname.c */ -const char *systemname __P((const struct quad *)); +const char *systemname(const struct quad *); /* torped.c */ -void torped __P((int)); +void torped(int); /* visual.c */ -void visual __P((int)); +void visual(int); /* warp.c */ -void dowarp __P((int)); -void warp __P((int, int, double)); +void dowarp(int); +void warp(int, int, double); /* win.c */ -void win __P((void)) __attribute__((__noreturn__)); +void win(void) __attribute__((__noreturn__)); diff --git a/wargames/wargames.6 b/wargames/wargames.6 index 1c992a9..1913fcb 100644 --- a/wargames/wargames.6 +++ b/wargames/wargames.6 @@ -1,4 +1,4 @@ -.\" $NetBSD: wargames.6,v 1.4 2002/09/26 18:32:05 wiz Exp $ +.\" $NetBSD: wargames.6,v 1.5 2004/01/01 16:06:21 jsm Exp $ .\" .\" Copyright (c) 1998 Joey Hess .\" All rights reserved. diff --git a/worm/worm.6 b/worm/worm.6 index 11110b3..5bd501c 100644 --- a/worm/worm.6 +++ b/worm/worm.6 @@ -1,4 +1,4 @@ -.\" $NetBSD: worm.6,v 1.10 2003/08/07 09:37:56 agc Exp $ +.\" $NetBSD: worm.6,v 1.11 2004/01/01 16:06:57 jsm Exp $ .\" .\" Copyright (c) 1989, 1993 .\" The Regents of the University of California. All rights reserved. diff --git a/worm/worm.c b/worm/worm.c index 3e00fa4..668c679 100644 --- a/worm/worm.c +++ b/worm/worm.c @@ -1,4 +1,4 @@ -/* $NetBSD: worm.c,v 1.24 2003/08/07 09:37:56 agc Exp $ */ +/* $NetBSD: worm.c,v 1.25 2004/01/27 20:30:31 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ #if 0 static char sccsid[] = "@(#)worm.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: worm.c,v 1.24 2003/08/07 09:37:56 agc Exp $"); +__RCSID("$NetBSD: worm.c,v 1.25 2004/01/27 20:30:31 jsm Exp $"); #endif #endif /* not lint */ @@ -80,17 +80,17 @@ int visible_len; int lastch; char outbuf[BUFSIZ]; -void crash __P((void)) __attribute__((__noreturn__)); -void display __P((const struct body *, char)); -int main __P((int, char **)); -void leave __P((int)) __attribute__((__noreturn__)); -void life __P((void)); -void newpos __P((struct body *)); -void process __P((int)); -void prize __P((void)); -int rnd __P((int)); -void setup __P((void)); -void wake __P((int)); +void crash(void) __attribute__((__noreturn__)); +void display(const struct body *, char); +int main(int, char **); +void leave(int) __attribute__((__noreturn__)); +void life(void); +void newpos(struct body *); +void process(int); +void prize(void); +int rnd(int); +void setup(void); +void wake(int); int main(argc, argv) diff --git a/worms/worms.c b/worms/worms.c index 3607f88..e78f1b4 100644 --- a/worms/worms.c +++ b/worms/worms.c @@ -1,4 +1,4 @@ -/* $NetBSD: worms.c,v 1.12 2003/08/07 09:37:57 agc Exp $ */ +/* $NetBSD: worms.c,v 1.14 2004/02/08 22:21:57 jsm Exp $ */ /* * Copyright (c) 1980, 1993 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\ #if 0 static char sccsid[] = "@(#)worms.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: worms.c,v 1.12 2003/08/07 09:37:57 agc Exp $"); +__RCSID("$NetBSD: worms.c,v 1.14 2004/02/08 22:21:57 jsm Exp $"); #endif #endif /* not lint */ @@ -179,9 +179,9 @@ static struct worm { volatile sig_atomic_t sig_caught = 0; -int main __P((int, char **)); -void nomem __P((void)) __attribute__((__noreturn__)); -void onsig __P((int)); +int main(int, char **); +void nomem(void) __attribute__((__noreturn__)); +void onsig(int); int main(argc, argv) @@ -241,7 +241,7 @@ main(argc, argv) sizeof(struct worm))) || !(mp = malloc((size_t)1024))) nomem(); initscr(); - leaveok(stdscr, TRUE); + curs_set(0); CO = COLS; LI = LINES; last = CO - 1; diff --git a/wtf/acronyms b/wtf/acronyms index 068be76..e6b0f7e 100644 --- a/wtf/acronyms +++ b/wtf/acronyms @@ -1,4 +1,4 @@ -$NetBSD: acronyms,v 1.129 2003/11/22 18:01:46 jschauma Exp $ +$NetBSD: acronyms,v 1.135 2004/01/14 13:46:26 keihan Exp $ AFAICR as far as I can recall AFAICT as far as I can tell @@ -18,6 +18,9 @@ ATM at the moment AWOL absent without official leave AYBABTU all your base are belong to us B/C because +B/S bullshit +B/W between +BBIAB be back in a bit BBL [I'll] be back later BBS be back soon BBT be back tomorrow @@ -27,10 +30,12 @@ BIAF back in a few BIALW back in a little while BIAS back in a second BIAW back in a while +BOATILAS bend over and take it like a slut BOFH bastard operator from hell BOGAHICA bend over, grab ankles, here it comes again BOHICA bend over here it comes again BRB [I'll] be right back +BS bullshit BTDT been there, done that BTTH boot to the head BTW by the way @@ -54,6 +59,7 @@ ETLA extended three letter acronym EWAG experienced wild-ass guess FAQ frequently asked question FCFS first come first served +FIGJAM fuck I'm good, just ask me FIIK fuck[ed] if I know FIIR fuck[ed] if I remember FM fucking magic @@ -100,6 +106,7 @@ ISTM it seems to me ISTR I seem to recall ITYM I think you mean IYSS if you say so +IWBNI it would be nice if J/K just kidding JIC just in case JK just kidding @@ -127,6 +134,8 @@ NFC no fucking clue NFI no fucking idea NFW no fucking way NIH not invented here +NMF not my fault +NMP not my problem NOYB none of your business NOYFB none of your fucking business NP no problem @@ -153,6 +162,7 @@ PPL pretty please PTV parental tunnel vision QED quod erat demonstrandum RFC request for comments +RIP rest in peace RL real life RLC rod length check ROFL rolling on floor laughing @@ -162,6 +172,7 @@ RP responsible person RSN real soon now RTFB read the fine/fucking book RTFC read the fine/fucking code +RTFD read the fine/fucking documentation RTFM read the fine/fucking manual RTFMP read the fine/fucking man page RTFS read the fine/fucking source @@ -174,6 +185,7 @@ SMLSFB so many losers, so few bullets SMOP simple matter of programming SNAFU situation normal, all fucked up SNERT snot-nosed egotistical rude teenager +SNMP sorry, not my problem SNR signal to noise ratio SO significant other SOB son of [a] bitch @@ -190,6 +202,8 @@ TANSTAAFL there ain't no such thing as a free lunch TBC to be continued TBD to be {decided,determined,done} TBOMK the best of my knowledge +THNX thanks +THX thanks TIA thanks in advance TINC there is no cabal TLA three letter acronym @@ -202,6 +216,7 @@ TTBOMK to the best of my knowledge TTFN ta ta for now TTYL talk to you later TWIAVBP the world is a very big place +TY thank you TYVM thank you very much U/L upload UTSL use the source, Luke @@ -219,6 +234,7 @@ WRT with respect to WTF {what,where,who,why} the fuck WTH {what,where,who,why} the hell WYSIWYG what you see is what you get +YALIMO you are lame, in my opinion YHBT you have been trolled YHL you have lost YKWIM you know what I mean diff --git a/wtf/acronyms.comp b/wtf/acronyms.comp index 7e807c8..85b5ced 100644 --- a/wtf/acronyms.comp +++ b/wtf/acronyms.comp @@ -1,4 +1,4 @@ -$NetBSD: acronyms.comp,v 1.28 2003/12/02 18:14:17 sketch Exp $ +$NetBSD: acronyms.comp,v 1.37 2004/01/15 03:35:20 grant Exp $ ABI application binary interface ACPI advanced configuration and power interface @@ -6,10 +6,12 @@ ADC analog [to] digital converter AGP accelerated graphics port ANSI American National Standards Institute API application programming interface +ARP address resolution protocol APIC advanced programmable interrupt controller AT advanced technology ATA advanced technology attachment ATAPI advanced technology attachment packet interface +ATM asynchronous transfer mode ATX advanced technology extended BEDO burst extended data output BGP border gateway protocol @@ -21,10 +23,12 @@ CAV constant angular velocity (as opposed to CLV) CD compact disc CDRAM cache dynamic random access memory CGA color graphics array +CGI common gateway interface CHS cylinder/head/sector CIDR classless inter-domain routing CLI command line interface CLV constant linear velocity (as opposed to CAV) +COFF common object file format CPU central processing unit CRLF carriage return line feed CRT cathode ray tube @@ -34,6 +38,7 @@ DAC digital [to] analog converter DDC display data channel DDR double data rate DDWG digital display working group +DHCP dynamic host configuration protocol DMA direct memory access DNS domain name system DRAM dynamic random access memory @@ -47,9 +52,11 @@ EDO extended data out EEPROM electrically erasable programmable read only memory EGA enhanced graphics array EISA extended industry standard architecture +ELF executable and linking format EPP enhanced parallel port EPROM erasable programmable read only memory ESDRAM enhanced synchronous dynamic random access memory +FAT file allocation table FBRAM frame buffer random access memory FFS fast file system FLOPS floating [point] operations per second @@ -96,22 +103,31 @@ LAN local area network LBA logical block addressing LCD liquid crystal display LDAP lightweight directory access protocol +LED light emitting diode +LIR local internet registry LSB least significant bit [or: byte] LUN logical unit number MAC media access control MBR master boot record MDRAM multibank dynamic random access memory +MIDI musical instrument digital interface +MIME multipurpose internet mail extensions MIPS million instructions per second MMU memory management unit +MPEG moving picture experts group MSB most significant bit [or: byte] MTA mail transfer agent MTU maximum transmission unit MUA mail user agent NAT network address translation +NFS network file system NIC network interface card NIS network information service NUMA non uniform memory access +OEM original equipment manufacturer +OSF open software foundation OTP one time password +PAM pluggable authentication modules PAX portable archive exchange PCI peripheral component interconnect PCMCIA Personal Computer Memory Card International Association @@ -126,6 +142,7 @@ POP post office protocol POSIX portable operating system interface [for] unix POST power on self test PPP point-to-point protocol +PPPOA point-to-point protocol over ATM PPPOE point-to-point protocol over ethernet PROM programmable read only memory PTE page table entry @@ -141,6 +158,7 @@ ROM read only memory RPM revolutions per minute RTF rich text format S/PDIF sony/phillips digital interface +SACD super audio compact disc SAM serial access memory SASI Shugart Associates system interface (predecessor to SCSI) SATA serial advanced technology attachment @@ -151,6 +169,7 @@ SLDRAM synchronous-link dynamic random access memory SMART self-monitoring analysis and reporting technology SMP symmetric multiprocessing SMTP simple mail transfer protocol +SNMP simple network management protocol SPD serial presence detect SRAM static random access memory SSH secure shell @@ -159,7 +178,9 @@ SVGA super video graphics array TCL tool command language TCP transmission control protocol TFT thin film transistor +TIFF tagged image file format TLA top level aggregator +TLB transition lookaside buffer TLD top level domain TMDS transition minimized differential signaling TTY teletype @@ -172,11 +193,15 @@ URL uniform resource locator USB universal serial bus USWC uncacheable speculative write combining UUCP unix-to-unix copy protocol +VAX virtual address extension VCM virtual channel memory VESA video electronics standards association VGA video graphics array +VM virtual memory VPN virtual private network VRAM video random access memory +WAN wide area network +WAP wireless application protocol WRAM window random access memory WWW world wide web XGA extended graphics array diff --git a/wump/wump.c b/wump/wump.c index da7a630..67a9a2c 100644 --- a/wump/wump.c +++ b/wump/wump.c @@ -1,4 +1,4 @@ -/* $NetBSD: wump.c,v 1.15 2003/08/07 09:37:57 agc Exp $ */ +/* $NetBSD: wump.c,v 1.16 2004/01/27 20:30:31 jsm Exp $ */ /* * Copyright (c) 1989, 1993 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\ #if 0 static char sccsid[] = "@(#)wump.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: wump.c,v 1.15 2003/08/07 09:37:57 agc Exp $"); +__RCSID("$NetBSD: wump.c,v 1.16 2004/01/27 20:30:31 jsm Exp $"); #endif #endif /* not lint */ @@ -112,30 +112,30 @@ int arrow_num = NUMBER_OF_ARROWS; /* arrow inventory */ char answer[20]; /* user input */ -int bats_nearby __P((void)); -void cave_init __P((void)); -void clear_things_in_cave __P((void)); -void display_room_stats __P((void)); -int gcd __P((int, int)); -int getans __P((const char *)); -void initialize_things_in_cave __P((void)); -void instructions __P((void)); -int int_compare __P((const void *, const void *)); -void jump __P((int)); -void kill_wump __P((void)); -int main __P((int, char **)); -int move_to __P((const char *)); -void move_wump __P((void)); -void no_arrows __P((void)); -void pit_kill __P((void)); -int pit_nearby __P((void)); -void pit_survive __P((void)); -int shoot __P((char *)); -void shoot_self __P((void)); -int take_action __P((void)); -void usage __P((void)) __attribute__((__noreturn__)); -void wump_kill __P((void)); -int wump_nearby __P((void)); +int bats_nearby(void); +void cave_init(void); +void clear_things_in_cave(void); +void display_room_stats(void); +int gcd(int, int); +int getans(const char *); +void initialize_things_in_cave(void); +void instructions(void); +int int_compare(const void *, const void *); +void jump(int); +void kill_wump(void); +int main(int, char **); +int move_to(const char *); +void move_wump(void); +void no_arrows(void); +void pit_kill(void); +int pit_nearby(void); +void pit_survive(void); +int shoot(char *); +void shoot_self(void); +int take_action(void); +void usage(void) __attribute__((__noreturn__)); +void wump_kill(void); +int wump_nearby(void); int main(argc, argv)