Home | History | Annotate | Download | only in worms
History log of /src/games/worms/worms.6
RevisionDateAuthorComments
 1.18  26-Apr-2023  kre Add a little optional colour, optionally distinguish worm heads,
and optionally randomise worm lengths. Just exit instead of
continuing with a nonsense display if the window shrinks (and
for consistency if it grows).

Most of the ideas and code from RVP. Bugs and man page mangling
from me.
 1.17  18-Apr-2023  kre Correct some unfortunate behaviour in extreme cases pointed out by RVP.
(Very long worms in a smallish window could result in the max number of
worms being 0...)

While here (also suggested by RVP) seed the random number generator,
also add a -S option to set the seed (note: while this is documented
in the updated man page, it does not appear in the usage message in
case of an error ... not likely to be used often enough to include there).

Also some minor improvements suggested by RVP:
delete the prototype for main()
exit curses mode before abort() (which should not happen, but...)
no need to return (->exit) after abort() as modern abort() can
never return.

In addition, check for extraneous (ignored) (non-option) args.
Check for absurdly small or big screens (the worm placement algorithm
doesn't work well for lines of columns < 3, and the abort() mentioned
above actually happens if one of those is == 1).

More flavours of worms added.

Some minor man page wording improvements.
 1.16  14-Oct-2020  nia branches: 1.16.6;
worms(6): Use a reasonable default delay for non-1980s terminals.

This is still fast, but not unreasonably fast.
 1.15  12-Aug-2012  wiz - improve wording
- sort option list
- add argument names in option list and descriptions and adjust table width
- improve punctuation
- bump date

From Bug Hunting.
 1.14  11-Mar-2009  joerg branches: 1.14.6;
Fix preamble
 1.13  07-Aug-2003  agc branches: 1.13.40;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22269, verified by myself.
 1.12  26-Sep-2002  wiz New sentences begin on new lines.
Patch from Richard Elz, slightly improved by yours truly.
 1.11  02-Apr-2001  wiz Whitespace and/or punctuation fixes.
 1.10  30-Jul-1999  hubertf This patch converts worms(6) to use curses, thereby
simplifying the code and improving its portability. It also adds a
delay option from OpenBSD, to allow reasonable speed display on fast
terminals, adds use of const, and fixes signal handling and use of
errx() where appropriate.

Patch supplied in PR 6661 by Joseph Myers <jsm28@cam.ac.uk>.
 1.9  10-Mar-1999  erh Fix .Bl/.El imbalance.
 1.8  28-Apr-1998  fair Change occurrences of "UNIX" to .Ux or .At as appropriate.
 1.7  12-Oct-1997  lukem WARNSify
 1.6  22-Apr-1995  cgd un-munge import; it apparently didn't import properly.
 1.5  22-Apr-1995  cgd rough cleanup of import. RCS Ids
 1.4  31-Jan-1995  jtc Make man page and usage message agree with the code.
Fix from Hubert Feyrer.
 1.3  05-Aug-1993  jtc Update to use new -mandoc macros.
 1.2  01-Aug-1993  mycroft Add RCS indentifiers.
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2  22-Apr-1995  cgd src/games/worms from Lite
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.13.40.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.14.6.1  30-Oct-2012  yamt sync with head
 1.16.6.1  25-Apr-2023  martin Pull up following revision(s) (requested by kre in ticket #148):

games/worms/worms.c: revision 1.24
games/worms/worms.c: revision 1.25
games/worms/worms.c: revision 1.26
games/worms/worms.c: revision 1.27
games/worms/worms.c: revision 1.28
games/worms/worms.c: revision 1.29
games/worms/worms.6: revision 1.17

Garbage collect "char *mp" - it used to point at memory malloc()'d
to hold the termcap entry, back when worms used termcap rather than
curses, and termcap was termcap, rather that a terminfo wannabe.

This should have been removed when worms was converted to curses in
1999, but wasn't, so worms has been doing a meaningless malloc(1024)
and never using the result, ever since.

While here, since the line needed changing anyway to remove mp,
change a malloc() of a product into calloc() so it can deal with
any possible (admittedly extremely unlikely here) integer overflows.

NFCI

80 column police.

If this code were just a few chars over the limit, it might get
let off with a warning, but 214 in an 80 zone is way beyond that.
Six months loss of coding licence, and a 214000 character fine.

NFCI.

(I verified the the code was unchanged by joining the resulting
lines back into one again, and then diff'ing that line against
the original - it is identical).

When worms default delay was changed from 0, to 20ms (Oct 2020)
it lost the ability to run flat out (no sleeps) - which while not
very useful for actually observing the behaviour of various Nematoda,
can be useful when 'worms' is being used to generate cpu heat - it
turns out to be a simple tool to make all of the app itself, the
xterm it runs in (when running under X) and the X server, all more
or less continuously busy - a trivial perpetual CPU load generator.

Changing that was not a simple matter of just allowing -d 0..1000
rather than -d 1..1000 which had always been the limits on -d, as
previously, simply by excluding 0, common error checking wasn't
essential. -djunk would return 0 which was invalid, and so an error
- - that it was invalid because 0 < 1, rather than because "junk" is not
a number wasn't material.

Now we need some slightly more elaborate error checking code for the
- -d value, and if we're going to do that, may as well do the same for
the -l and -n options, which also take numeric values. That is, it
will no longer be possible to say:

worms -n "5 worms"

Just the number is allowed (but -d now allows a "ms" or "us" suffix).

While here, place a reasonable upper limit (depending upon the
screen size, and worm length) upon the number of worms, so they
have somewhere to go, rather than just on top of each other.

exit(1) from the errx() rather than 0, in the case that curses
initscr() fails (doesn't seem right that it should appear as a
successful run of worms, if it never managed to start).

A couple more minor 80 column violations are handled, without
further penalty, in this update (one simply vanishes, the other
is wrapped).

Note that this sounds like a lot, but it is really all just minor
internal bookkeeping updates - the only real advertised user visible
change is the ability to use -d0 which just restores that which was
the default (though it could never be set via the option) until Oct 2020
- - so really all that's happening is replacing minor functionality lost
then, while leaving the change of the default delay that that change
made, untouched.

No man page update required (that never excluded -d0).

Correct some unfortunate behaviour in extreme cases pointed out by RVP.
(Very long worms in a smallish window could result in the max number of
worms being 0...)

While here (also suggested by RVP) seed the random number generator,
also add a -S option to set the seed (note: while this is documented
in the updated man page, it does not appear in the usage message in
case of an error ... not likely to be used often enough to include there).

Also some minor improvements suggested by RVP:
delete the prototype for main()
exit curses mode before abort() (which should not happen, but...)
no need to return (->exit) after abort() as modern abort() can
never return.

In addition, check for extraneous (ignored) (non-option) args.

Check for absurdly small or big screens (the worm placement algorithm
doesn't work well for lines of columns < 3, and the abort() mentioned
above actually happens if one of those is == 1).

More flavours of worms added.

Some minor man page wording improvements.

Typo in an error message (pointed out by RVP; Thanks)

Another err message typo! (found this one myself!!)

RSS XML Feed