dholland [Sun, 24 Feb 2008 06:03:35 +0000 (06:03 +0000)]
Fix some more lint. (There's plenty to go around.)
If we try to load a game and it bombs, keep prompting for another one,
because if we try to continue with a half-loaded game we'll probably
end up in trouble.
dholland [Sun, 24 Feb 2008 02:43:18 +0000 (02:43 +0000)]
Abolish the initdeck program and the weird little binary file it generates.
The card deck data is now compiled in. (And it always should have been,
even back when memory usage counted. It's small.)
This changes the save format slightly. (I am riding the previous
breakage an hour ago and not providing compat. There should be no
further breakage.)
dholland [Sun, 24 Feb 2008 01:57:34 +0000 (01:57 +0000)]
Source files should be named *.c or *.h, not random other things.
Fold monop.ext (which was extern data decls) into monop.h and deck.h.
Fold monop.def (which had definitions for the extern data) into monop.c.
Fold brd.dat/mon.dat/prop.dat (which were array initializers for some of
the data) into monop.c.
Rearrange includes accordingly. No functional change.
dholland [Sun, 24 Feb 2008 01:30:56 +0000 (01:30 +0000)]
New save/load code. Related to (but not the same as) the new save/load
code in OpenBSD.
Note: this breaks compatibility with old save files. However, the old
save files were missing critical information, had a completely insane
format, and didn't work anyway.
I will be riding this breakage with another breakage within a day or
two when I fix the insanity in the card deck handling.
dholland [Sat, 23 Feb 2008 22:28:46 +0000 (22:28 +0000)]
Fixes from OpenBSD.
- If a player goes bankrupt buying a property (which shouldn't be
allowed, but I guess it is), don't cause them to resign to themselves.
- Use "NULL", not "0", for pointers.
- Avoid undefined behavior adjusting the current player after resigning.
- Don't leak the memory used to store player names.
The last of these is disabled for the moment because we have the pointers
in question tagged const. Will see to this when I'm finished merging.
dholland [Sat, 23 Feb 2008 21:48:46 +0000 (21:48 +0000)]
More fixes from OpenBSD:
- initialize in the proper order
- don't allow 1-player games
- make the check for players named "done" work properly
- a couple other minor things
dholland [Sat, 23 Feb 2008 19:54:06 +0000 (19:54 +0000)]
Improve the behavior of get-out-of-jail-free cards by returning them to
the bottom of the deck when used. There are still a few other problems.
From OpenBSD.
dholland [Sun, 3 Feb 2008 21:24:58 +0000 (21:24 +0000)]
Once upon a time, larn 12.0 had functions named getchar() and putchar()
that conflicted with libc. We changed them to lgetchar() and xputchar()
respectively; larn 12.2 changed them to ttgetch() and ttputch(). After
reflecting on this for a while I've decided to adopt the larn 12.2
names; not so much for compatibility but for consistency going forward.
So, massrename them. Also make ttputch() static.
dholland [Sun, 3 Feb 2008 20:01:24 +0000 (20:01 +0000)]
A long time ago, larn had code to prohibit playing it during work hours.
Most of this code was removed ages ago, probably when dm(6) was invented;
long before -r1.1 in the NetBSD tree in any event.
Now remove the last fragment of it.
Also nuke the file of US holidays 1987-1993 that we've been carrying
around for no reason.
matt [Sat, 2 Feb 2008 18:15:14 +0000 (18:15 +0000)]
Add a -d flag so that primes will print the difference between the current
prime and the previous prime. [I needed that for some reason I don't recall
and these changes lying about. Since they might be useful/interesting to
someone, I might as well as commit them.]
dholland [Mon, 28 Jan 2008 05:48:57 +0000 (05:48 +0000)]
Call srandom() as well as initializing the private random generator
(which is crappy and should be removed, but that's for another day...)
This way e.g. fortune cookies no longer appear always in the same order.
dholland [Mon, 28 Jan 2008 04:04:17 +0000 (04:04 +0000)]
Apparently the reason the printf arguments were all wrong is that larn
had its own private and not-quite-standard implementation of printf.
Remove it surgically with a chainsaw.
dholland [Mon, 28 Jan 2008 03:39:30 +0000 (03:39 +0000)]
Add gcc printf format checking, and fix the abundant problems this revealed.
(It appears that someone sometime thought that you use %d to print a long.)
dholland [Mon, 28 Jan 2008 02:37:50 +0000 (02:37 +0000)]
Work around gcc signedness warning: if you check for uid_t < 0, gcc warns
because it's unsigned, but I don't really want to rely on uid_t being
unsigned on every platform this code might propagate to.
dholland [Mon, 28 Jan 2008 01:38:59 +0000 (01:38 +0000)]
Build with WARNS=4. (All fixes are cosmetic, except that it's definitely
bad karma to shadow a local variable with another of the same name in a
nested block...)
dholland [Mon, 14 Jan 2008 03:50:01 +0000 (03:50 +0000)]
ANSIfy. Remove unnecessary casts. Clean up for -Wsign-compare. Make more
things file-static. Other minor tidyups, and fix a couple minor bugs found
along the way.
dholland [Thu, 27 Dec 2007 23:52:59 +0000 (23:52 +0000)]
Comprehensive (or at least extensive) string handling cleanup for rogue.
This patch dates (mostly) back to 2002; the critical parts of it were
handled back then by security-officer. As far as I know, there's
nothing exploitable fixed herein.
A slightly earlier version of this patch was reviewed by Christian Biere
when I filed it as PR 34750.
dogcow [Tue, 18 Dec 2007 08:45:03 +0000 (08:45 +0000)]
more __dead fallout: these two files are built for the native host, not
for the target host - and thus do not necessarily have __dead defined in
<sys/cdefs.h>.
dogcow [Sat, 17 Nov 2007 00:10:55 +0000 (00:10 +0000)]
A terrible kludge: don't compile/link malloc.c if arch=sun2. My apologies
to the legions of sun2 monop fans who will probably be unable to save/restore
games.
tls [Mon, 28 May 2007 12:06:17 +0000 (12:06 +0000)]
Add new Makefile knob, USE_FORT, which extends USE_SSP by turning on the
FORTIFY_SOURCE feature of libssp, thus checking the size of arguments to
various string and memory copy and set functions (as well as a few system
calls and other miscellany) where known at function entry. RedHat has
evidently built all "core system packages" with this option for some time.
This option should be used at the top of Makefiles (or Makefile.inc where
this is used for subdirectories) but after any setting of LIB.
This is only useful for userland code, and cannot be used in libc or in
any code which includes the libc internals, because it overrides certain
libc functions with macros. Some effort has been made to make USE_FORT=yes
work correctly for a full-system build by having the bsd.sys.mk logic
disable the feature where it should not be used (libc, libssp iteself,
the kernel) but no attempt has been made to build the entire system with
USE_FORT and doing so will doubtless expose numerous bugs and misfeatures.
Adjust the system build so that all programs and libraries that are setuid,
directly handle network data (including serial comm data), perform
authentication, or appear likely to have (or have a history of having)
data-driven bugs (e.g. file(1)) are built with USE_FORT=yes by default,
with the exception of libc, which cannot use USE_FORT and thus uses
only USE_SSP by default. Tested on i386 with no ill results; USE_FORT=no
per-directory or in a system build will disable if desired.
hubertf [Wed, 24 Jan 2007 13:17:42 +0000 (13:17 +0000)]
- Don't call basename $0 at many places. Use variable $PROGNAME
- Better check when neither $ACRONYMDB is define nor files in
/usr/share/misc/ are found
- Replace cat | fgrep to using fgrep only
- Replace sort | uniq to using sort -u
By Slava Semushin <slava.semushin@gmail.com> in private email.