Commit Graph

1489 Commits

Author SHA1 Message Date
dholland 97464386e1 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.)
2008-02-24 02:43:18 +00:00
dholland b51259daf4 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.
2008-02-24 01:57:34 +00:00
dholland a6c98779b0 Remove last traces of old save/load code. We no longer need a private
copy of malloc.
2008-02-24 01:41:14 +00:00
dholland 67021c2ac7 Sort out the memory leak fix properly. 2008-02-24 01:37:57 +00:00
dholland fe527d1ba8 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.
2008-02-24 01:30:56 +00:00
dholland 98e588be9a 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.
2008-02-23 22:28:46 +00:00
dholland 693812a822 Fix from OpenBSD: don't say "1 houses". 2008-02-23 22:20:35 +00:00
dholland 4e54ceffce Bug fixes from OpenBSD:
- don't truncate unreasonably long player names when bidding;
   - don't allow players to bid more cash than they have.
2008-02-23 22:17:02 +00:00
dholland 7913f644df Bug fix: having $0 does not mean you need to mortgage something. Plus some
tidyup.
From OpenBSD.
2008-02-23 22:06:30 +00:00
dholland d49f907ead 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
2008-02-23 21:48:46 +00:00
dholland 5ed7a7102f Sanity fixes for input handling. Suggested by OpenBSD, but different code. 2008-02-23 21:35:13 +00:00
dholland 52f0089409 A first stab at supporting the housing shortage rules. From OpenBSD.
(note: this is not fully correct - I will fix it when I finish merging)
2008-02-23 21:07:52 +00:00
dholland c844dfca6b Don't increment booleans. From OpenBSD 2008-02-23 20:18:46 +00:00
dholland ff1acb6483 Sanity fixes for input buffer handling. From OpenBSD 2008-02-23 20:12:15 +00:00
dholland 61715c12c2 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.
2008-02-23 19:54:06 +00:00
dholland 82ff30a443 Rename ->last_card to ->top_card to match OpenBSD (and also to make
somewhat more sense...)
2008-02-23 19:49:21 +00:00
dholland 8b5e597afa Move ret_card() to cards.c, where it more rationally belongs. From OpenBSD. 2008-02-23 19:09:00 +00:00
dholland 32e86dd423 A few more whitespace/KNF. I keep hoping I've found them all... 2008-02-20 05:08:46 +00:00
dholland 1958cbf73e Add the sizes to the extern array declarations. This may not be
necessary, but it's safe and reduces unnecessary divergence.
From OpenBSD.
2008-02-20 04:50:12 +00:00
dholland a03fcca33d Use random() rather than rand(). Suggested by diffing against OpenBSD. 2008-02-20 04:48:10 +00:00
dholland 72aa2a5043 Remove unused swap() macro. 2008-02-20 04:10:34 +00:00
dholland fff414b851 Don't misuse random strings as printf formats, even where it's harmless.
Found by diffing against OpenBSD.
2008-02-20 04:10:01 +00:00
dholland b63df5c6e0 One more (hopefully the last) whitespace fix. 2008-02-19 10:48:47 +00:00
dholland 3a2a525c4b getinp() no longer magically treats the prompt arg as a printf format, so
don't escape % as %%. From OpenBSD.
2008-02-19 10:47:40 +00:00
dholland e084c0089c Move function heading comments to something vaguely like the right place. 2008-02-19 10:46:21 +00:00
dholland 16168c2070 KNF/whitespace nits. No functional changes. 2008-02-19 09:45:02 +00:00
dholland eefb74f4dc Fix bugs in debug printouts. From OpenBSD. 2008-02-19 09:34:40 +00:00
dholland c4dc2f9e61 Don't use sprintf; use snprintf. 2008-02-19 09:32:34 +00:00
dholland 0419d05bfc Don't use perror(); use err/warn instead.
Suggested by diffing against OpenBSD.
2008-02-19 09:30:26 +00:00
dholland 98ff506f59 Fix capitalization of street names. from pjanzen@openbsd 2008-02-19 09:28:05 +00:00
dholland a7f37f4351 More typo fixes 2008-02-19 09:25:21 +00:00
dholland b113ea6af6 Fix formatting bug apparently introduced when the page was mdoc'd. (Had
.Nm, should have been .Pp.)

Also bump date; for some reason this hadn't been done since the original
import.
2008-02-19 09:24:43 +00:00
dholland df819b0896 Remove transient thingy that wasn't supposed to see the light of day, and
finish dealing with some local variables that shadow a global. (hi dholland)
2008-02-19 09:05:55 +00:00
dholland 5538b1cced Fix (another) typo in comment 2008-02-19 08:26:10 +00:00
dholland c1dc5a85f2 Fix typo in comment 2008-02-19 08:07:51 +00:00
dholland 591ca18c53 Split some code from moreobj.c into action.c, as per larn 12.2. 2008-02-19 06:05:26 +00:00
he 75194e6a79 Typo correction: s/than/that/ in one instance. 2008-02-15 09:24:52 +00:00
dholland f5334b0815 More assorted cleanup merged from larn 12.2. 2008-02-04 01:07:01 +00:00
dholland c310e89d2d 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.
2008-02-03 21:24:58 +00:00
dholland e87aa9031c Don't create files mode 666 in /var. (The code in question is not enabled
by default, though.)
2008-02-03 20:41:53 +00:00
dholland 5c10491064 Larn does not need its own private versions of functions from <ctype.h>.
Also, remove the function gettokstr(), which is not used. From larn 12.2.
2008-02-03 20:11:04 +00:00
dholland b6e0b3d3c9 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.
2008-02-03 20:01:24 +00:00
dholland ef066a156b Some assorted minor cleanups, from larn 12.2. 2008-02-03 19:29:50 +00:00
dholland d7ba3de791 Make a bunch of functions static. Merged from larn 12.2. 2008-02-03 19:20:40 +00:00
dholland ded3829627 Use mkstemp to make the temporary files used when you win. 2008-02-03 03:49:15 +00:00
dholland 511d1e002c Since games are (now) setgid, not setuid, it is no longer necessary to
manipulate the effective uid, only the effective gid.
2008-02-03 03:45:55 +00:00
wiz 1b89543c7f Document -d. 2008-02-03 03:29:17 +00:00
matt c0033b9584 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.]
2008-02-02 18:15:14 +00:00
matt 375a7f707b Fix typo: sive -> sieve. 2008-02-02 17:45:05 +00:00
dholland b67b08da79 Pedanticism about time_t (not really a bug, but now it won't show up when
audited.)
2008-01-31 05:22:45 +00:00
dholland d64494c758 Fix y2038 bug: time_t != int. 2008-01-31 05:19:44 +00:00
dholland d4f48e67da Make the default WARNS for games 4. The only game that needs to set WARNS
to anything else now is rogue, so clear WARNS from the other makefiles.
2008-01-28 07:03:58 +00:00
dholland d759c4a5e3 build with WARNS=4 2008-01-28 07:01:01 +00:00
dholland 3c439f438f Make hack build with WARNS=4. 2008-01-28 06:55:41 +00:00
dholland c074bb6654 Make this build with WARNS=4 by not reusing names from <math.h>. 2008-01-28 06:20:15 +00:00
dholland 0f032c1fb8 Make this build with WARNS=4 by not reusing names from ctype.h. 2008-01-28 06:18:23 +00:00
dholland 4e5cdff5fd Make this build with WARNS=4. 2008-01-28 06:16:13 +00:00
dholland 712442be18 make mille build with WARNS=4 2008-01-28 05:55:10 +00:00
dholland 398690b6f4 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.
2008-01-28 05:48:57 +00:00
dholland 9cc7e27481 Larn now builds with WARNS=4. 2008-01-28 05:38:53 +00:00
dholland 3d81345939 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.
2008-01-28 04:04:17 +00:00
dholland 8ce4d17196 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.)
2008-01-28 03:39:30 +00:00
dholland 733dc966d8 clean for WARNS=4 2008-01-28 03:23:29 +00:00
dholland 3bf4735ba0 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.
2008-01-28 02:37:50 +00:00
dholland a627b0395f Build with WARNS=4. Sort out the game's shadowing of its own variables,
which fixes at least one bug.
2008-01-28 01:58:01 +00:00
dholland bded8baaa8 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...)
2008-01-28 01:38:59 +00:00
dholland 80def703dc Build with WARNS=4. 2008-01-28 01:15:55 +00:00
dholland 68bfa787b0 This builds with WARNS=4; set it in the Makefile so it stays that way. 2008-01-28 01:10:23 +00:00
dholland d463e4dba6 Build with WARNS=4. 2008-01-28 01:06:19 +00:00
he 0d14187892 I'm guessing that there should be no space between the hyphen and
the second word in "hand-lettered".
2008-01-25 13:40:56 +00:00
lukem e26888b7e9 Only pull in <sys/cdefs.h> on NetBSD, to fix build on Solaris 10.
Tweak replacement definition of __dead.
2008-01-16 23:23:25 +00:00
dholland 130a8172b6 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.
2008-01-14 03:50:01 +00:00
dholland 23c02a454f Whitespace/KNF nits. 2008-01-14 00:23:51 +00:00
dholland 9f6d905aba Fun with parts of speech: `stupid' here is an adjective, not a noun. 2008-01-03 02:01:26 +00:00
dholland e94a5bc9f9 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.
2007-12-27 23:52:59 +00:00
dogcow 7a14aed5b2 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>.
2007-12-18 08:45:03 +00:00
perry 8b0f9554ff convert __attribute__s to applicable cdefs.h macros 2007-12-15 19:44:37 +00:00
perry 36c7456d7c include sys/cdefs.h so that __attribute__ can be fixed later 2007-12-15 16:32:05 +00:00
dogcow e283c9fc02 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.
2007-11-17 00:10:55 +00:00
ragge 4d90c6e639 __attribute -> __attribute__ 2007-09-16 18:39:54 +00:00
hubertf e5fa46c791 Teach wtf(6) about pkgsrc's help facility:
% cd /usr/pkgsrc/audio/qsynth
% wtf subst
subst: ===> mk/subst.mk:
# This Makefile fragment implements a general text replacement facility.
...
2007-08-06 21:14:36 +00:00
rillig 54195a73e6 Increased WARNS to 4, since it passes both gcc333 and gcc411 on i386. 2007-06-06 06:10:50 +00:00
tls 4147a3c54a 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.
2007-05-28 12:06:17 +00:00
mouse 2609539fc5 Per PR 36185, OKed by martin@ 2007-04-22 02:09:02 +00:00
hubertf b1eaefe397 Xref shuffle(1) from random(6), and vice versa 2007-03-20 16:12:40 +00:00
ad 1458eba0f6 NetBSD JIHBED 2007-02-26 06:49:00 +00:00
ad 7545be4439 NetBSD: Dead on Target
-- Gimpy
2007-02-26 06:30:45 +00:00
hubertf be5e286e64 - 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.
2007-01-24 13:17:42 +00:00
chuck f90603d08a Update my previous commit to better match the original code, including
the check for 'bs'...   my previous commit should have included the
following text:
  fixes problem introduced in 1.13 where the setting of "BC" (backspace char)
  was left to libterm rather than being done by hack itself.  the problem
  with this was that hack was directly setting BC to \b if there was no
  "bc" in the termcap entry, but libterm does not do this.   this resulted in
  the xputs(BC) calls in nocmov() and backsp() incorrectly doing nothing, thus
  messing up the display.  added new var BC_BS to provide the old behavior
  for nocmov() and backsp().
2007-01-17 02:35:28 +00:00
chuck bfec35be7a mrg's changes in 1.13 broke hack's display code. 2007-01-17 02:12:19 +00:00
hubertf 61daec5724 Replve duplicate #includes
From Slava Semushin <slava.semushin@gmail.com>, via private mail
2007-01-17 00:30:23 +00:00
hubertf b4df40b17b - ANSIfy
- Use return instead of exit() in main()
 - Use EXIT_{SUCCESS,FAILURE} constants instead of 0/1

No functional changes. Patch submitted in private mail by
Slava Semushin <slava.semushin@gmail.com>
2007-01-12 22:43:05 +00:00
wiz 2957444796 Fix some typos in ENIAC quote. From Zafer Aydogan and myself. 2006-12-25 18:46:48 +00:00
wiz 9b8796fcbe Spell "tomorrow" correctly. From Zafer Aydogan. 2006-12-25 18:43:03 +00:00
wiz 88306df899 Bump date for previous. Use mdoc macros. 2006-12-23 09:47:30 +00:00
reed 9fdd8e989b Add example of using -w. 2006-12-14 02:29:59 +00:00
wiz 09cb1d6f1c s/existance/existence/, from Zafer. 2006-11-24 22:52:16 +00:00
wiz 6919c6578c s/independant/independent/, from Zafer. 2006-11-24 22:04:21 +00:00
wiz 40d5f88af4 s/exceded/exceeded/, from Zafer. 2006-11-24 21:14:55 +00:00
christos 1665d5e960 fix spelling of accommodate; from Zapher. 2006-11-24 19:46:58 +00:00