Module Name: src Committed By: kre Date: Sat Apr 15 15:21:56 UTC 2023
Modified Files: src/games/worms: worms.c Log Message: 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). To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/games/worms/worms.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.