Commit Graph

1769 Commits

Author SHA1 Message Date
joerg
f10218e541 \@ is not a valid escape sequence. 2009-04-09 03:52:54 +00:00
christos
6fb300657f Avoid hardcoded "too large" constant that caused FPE on the vax.
XXX: Should pullup to 5.0
2009-03-31 18:48:16 +00:00
dholland
d7038c0ebc Simplify previous; suggested by Paul Goyette 2009-03-15 22:19:23 +00:00
dholland
b2008ab5d1 Fix sign-compare problem that crept in due to working from an old tree.
Whoops. won't happen again...
2009-03-15 20:11:24 +00:00
jnemeth
fbf3f5b411 grammar fix 2009-03-15 05:44:57 +00:00
dholland
87d1d157b3 Rework curses handling.
The most visible change is that the scrolling buffer of messages now
actually scrolls and keeps history, and you type on the bottom line only.
For now you can page through the history with ^P/^N; that's not ideal but
one can't fix everything all at once.

Use resizeable array code (roughly the same that I floated a while ago
in connection with make) to hold the scroll.
2009-03-15 03:33:56 +00:00
dholland
5368eaecca Move newturn() from pl_7 to pl_2.
pl_7 was mostly curses/display stuff, is going to be all display stuff.
pl_2 is where the main loop lives.
2009-03-15 00:50:47 +00:00
dholland
842019525c Move all curses bits to pl_7.c. 2009-03-15 00:35:42 +00:00
dholland
81060ec63a Fix usage message 2009-03-14 23:51:35 +00:00
dholland
cb17dc26ee chdir to /var/games/sail while running, to simplify name handling. 2009-03-14 23:47:18 +00:00
dholland
86056f1213 Don't crosswire the two kinds of path names, and don't croak on
scenario numbers > 99.
2009-03-14 23:12:20 +00:00
dholland
0c94ee2110 Turns out the W_FILE message wasn't ever used. 2009-03-14 22:54:05 +00:00
dholland
e544d2b874 Create some abstraction for sending messages.
Make a send and receive function for each possible message.
Make these have useful argument signatures.
Hide the list of message codes inside sync.c.
2009-03-14 22:52:52 +00:00
dholland
32aeef110b Don't use perror() 2009-03-14 20:14:56 +00:00
dholland
2a767ad336 constify the version string 2009-03-14 20:10:43 +00:00
dholland
49bf5e73fa Sprinkle some "bool". And don't use '\0' to mean 'false'. 2009-03-14 20:04:43 +00:00
dholland
ac571eb080 Use \a instead of \7 for BEL. 2009-03-14 19:57:14 +00:00
dholland
4c26b16462 Prune a comment referring to objects that (AFAICT) didn't even exist in -r1.1. 2009-03-14 19:55:16 +00:00
dholland
3b67879708 Don't cast the return value of calloc(). 2009-03-14 19:36:42 +00:00
dholland
b8c43a1f9c Lines <= 80 chars, remove trailing whitespace, other formatting adjustments.
No functional change.
2009-03-14 19:35:13 +00:00
dholland
9a83480957 Remove some unnecessary casts. 2009-03-14 18:41:21 +00:00
dholland
25e9926383 String buffer cleanup. sprintf bad. 2009-03-14 18:32:47 +00:00
dholland
1bb89ee28f Don't use char for random state variables; use int or bool. 2009-03-14 17:10:01 +00:00
joerg
6ffb688fd8 Fix list markup. Use .Ic for key as suggested by wiz. 2009-03-11 16:37:06 +00:00
joerg
aee82d7c52 Fix preamble 2009-03-11 13:06:10 +00:00
joerg
a62737a7d9 Remove redundant .br 2009-03-11 13:05:59 +00:00
joerg
c173c17186 Fix markup 2009-03-11 13:05:46 +00:00
joerg
25e7748736 Fix preamble 2009-03-11 13:01:49 +00:00
joerg
e8103a8e17 Fix markup 2009-03-11 13:00:37 +00:00
dholland
265bf6cfdf sprintf -> snprintf 2009-03-09 04:38:39 +00:00
dholland
6b7874a086 Move HISTORY to proper place. 2009-03-02 10:16:54 +00:00
dholland
442e8c0016 Edit. Sync with reality, at least partway. Bump date. 2009-03-02 10:14:41 +00:00
wiz
a14b6c39ff Sort options. End sentence with a dot. 2009-03-02 09:39:10 +00:00
dholland
3a16d1fa6d mdocify. Partly merged from OpenBSD. Not by any means perfect yet. 2009-03-02 09:23:57 +00:00
dholland
f521abdfac More fixes from OpenBSD: use err instead of perror, don't hork on EOF
during the initial setup questions.
2009-03-02 07:33:30 +00:00
dholland
53cddab9f9 Check for failure of fgets when reading the captain's name, and don't
allow it to be empty. From OpenBSD.
2009-03-02 07:21:56 +00:00
dholland
51cc47ce79 Use errx() to send fatal error messages. From OpenBSD. 2009-03-02 07:17:24 +00:00
dholland
ffb1e863de Use errx/warnx instead of printing to stderr. From OpenBSD. 2009-03-02 06:54:01 +00:00
dholland
96e08ad443 Use err(3) and errx(3), not perror and fprintf to stderr. From OpenBSD. 2009-03-02 06:44:22 +00:00
dholland
da767c0864 Braces around a nested if, for clarity; suggested by diffing against OpenBSD. 2009-03-02 06:43:53 +00:00
dholland
b34a85f960 Fix bogus conditional caught by today's make. It looks as if MKHIDEGAME
has never worked since it was introduced in 2002... clearly a lot of
people care about that.

It should work now, but because it's evidently never been tested it
may also require setlist adjustments.
2009-01-18 20:22:45 +00:00
tnn
f341bbffe8 use %zu to print size_t 2009-01-18 13:30:33 +00:00
lukem
c6144e484f fix -Wsign-compare issues 2009-01-18 00:24:29 +00:00
wiz
a3fb1878ab Fix fiance/fiancee confusion. Fix another typo.
Jason McIntyre <jmc@kerhand.co.uk>.
2008-12-02 14:21:26 +00:00
wiz
999da72c23 Fix insure -> ensure confusion. From Jason McIntyre <jmc@kerhand.co.uk>. 2008-12-02 14:21:02 +00:00
christos
e62c26811d PR/39923: Valery Ushakov: trek(6) can spin, consuming 100% CPU on powerpc
On systems where char is unsigned the number of black holes can end up being
very large (instead of negative).
2008-11-14 21:10:44 +00:00
mrg
acc852a217 more MKSHARE == no fixes:
- move installation of atf pkg-config files out of share/atf/
- don't install spell or ching share files
- update some directory entries to not have 'share' tag

now my MKLINT=no MKSHARE=no MKPROFILE=no builds work again.
2008-10-30 21:37:55 +00:00
apb
e269763779 Use uint32_t and include <stdint.h>, instead of using u_int32_t
and including <sys/types.h>.
2008-10-19 07:56:42 +00:00
agc
c66caa9ca7 Make this build on Mac OS X. 2008-09-29 12:30:12 +00:00
apb
9536f79402 Install unstr:
* in games/fortune/Makefile, add unstr to SUBDIR;
* in games/fortune/unstr/Makefile, include ../../Makefile.inc;
* in games/fortune/strfile/Makefile, add MLINKS for unstr man page;
* in distrib/sets/lists/games/mi, add new files.
2008-09-26 18:56:43 +00:00
apb
520cbbf81f Build strfile both as a host tool and as an installed program:
* in games/fortune/strfile/Makefile, build strfile as a
  regular program instead of as a host tool;
* add tools/strfile directory to build strfile as a host tool;
* in tools/Makefile, add strfile to SUBDIR list;
* in BSD.*.mk, define TOOL_STRFILE variable;
* in games/fortune/datfiles/Makefile, use TOOL_STRFILE when creating
  databases at build time;
* in distrib/sets/lists/games/mi, mention usr/games/strfile.
2008-09-26 18:23:09 +00:00
apb
cec0ed4e41 Make this pass WARNS=4:
* u_int32_t -> uint32_t, and remove ifdef test.
* add function prototypes.
2008-09-26 13:46:48 +00:00
gmcgarry
81f725f1e0 Both legs of the conditional operator must return the same type. 2008-08-29 00:37:38 +00:00
gmcgarry
3c9a95916d Wrap compiler-specific flags with HAVE_GCC and HAVE_PCC as necessary. Add a few flags for PCC. 2008-08-29 00:02:21 +00:00
drochner
432ec04420 if initscr() fails, exit with a message rather than crash in the
next curses call
2008-08-08 16:10:47 +00:00
lukem
f0bccc0f62 Remove the \n and tabs from the __COPYRIGHT() strings. 2008-07-21 13:24:38 +00:00
lukem
2fe2731d3f Remove the \n and tabs from the __COPYRIGHT() strings. 2008-07-20 00:52:39 +00:00
dholland
16e3bec279 Clarify how one is supposed to use the pointers returned by getutentries()
(the utmpentry.c code), specifically with respect to who owns them and
when to free them. Now they're owned by utmpentry.c, only. Abolish the
freeutentries() function, which was the wrong abstraction; add instead
endutentries(), which flushes out the internally managed memory.

Update callers as necessary. Some (e.g. talkd) had been leaking memory;
others (e.g. syslogd) had been accidentally freeing and reloading utmp
more often than necessary. There are a couple untidy bits in users and
rwhod that someone should look after sometime, maybe.

Fixes PR bin/35131, which was about talkd's memory leak.
2008-07-13 20:07:48 +00:00
gmcgarry
686556951e Add test for HAVE_PCC with HAVE_GCC which turn off compiler warning flags. 2008-07-12 12:29:42 +00:00
mrg
c2b95373bf remove clause #3 from my license where there are no other
copyright holders involved.
2008-05-29 14:51:25 +00:00
wiz
ac20026091 2-clause my license. 2008-05-08 15:31:07 +00:00
lukem
66176dfdff Rename MKPRIVATELIB to LIBISPRIVATE, to make it clearer that this is
a variable that is used by in-tree Makefiles to control behaviour.
(MKsomevar variables are generally intended to be controlled by the end-user)
2008-05-03 14:48:30 +00:00
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
wiz
9abcd2ffbe Fix a tip: use pkg_info, not pkg_add to find out which executables
belong to a package.
2008-03-25 10:50:34 +00:00
jmmv
442ab2406b Add a tip explaining how to run the tests in /usr/tests. 2008-03-23 19:48:57 +00:00
reed
0b1fe5192d In example, change dd count size and also chmod so others can't read swap. 2008-03-22 14:39:57 +00:00
reed
4be51e0191 Add five more tips. 2008-03-21 21:45:30 +00:00
reed
b89951ff87 Add "netbsd-tips" fortune database with 23 initial fortunes --
actually hints or suggestions or tips on using NetBSD.
Please share your brief NetBSD usage tips.
If you want to discuss or share suggestions, have a look
at http://wiki.netbsd.se/netbsd-tips wiki page.
2008-03-21 21:09:48 +00:00
dholland
a2e3e41dc6 Don't crash if we're asked to restore from /dev/null. (woops) 2008-02-24 06:12:49 +00:00
dholland
5ec0096cd0 Fix a bit more lint. 2008-02-24 06:07:06 +00:00
dholland
c0cbd1abb5 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.
2008-02-24 06:03:35 +00:00
dholland
a537df81a5 Don't cast the return value of calloc. 2008-02-24 05:53:33 +00:00
christos
dc11f84d61 fix some lint 2008-02-24 03:56:48 +00:00
christos
7cafbb8e59 need errno.h 2008-02-24 03:52:09 +00:00
dholland
aab0bc87a0 Update for today's changes: 1-player games are not allowed, and cards.pck
no longer appears.
2008-02-24 03:50:07 +00:00
dholland
8015839b21 Fix the OpenBSD housing shortage code. 2008-02-24 03:26:26 +00:00
dholland
15d2107a88 ret_card(), which I moved earlier, was consequently filed under the wrong
source file name. fix.
2008-02-24 03:01:13 +00:00
dholland
ad6f43e622 We do not need special code for pdp11. Also, because random() returns all
good bits (unlike rand()) we can simplify this.
2008-02-24 02:58:33 +00:00
dholland
c303095d59 Typo patrol 2008-02-24 02:55:20 +00:00
dholland
295acf7fa6 This file is also no longer used. 2008-02-24 02:53:18 +00:00
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
christos
3d98aa3f4b fix spelling of accidentally; from Zapher 2006-11-24 19:37:02 +00:00
reed
57c4a8a6b0 Check that -w width is not above maximum. (It already checks for zero or
negative.) Using width above DWIDTH may cause overflow as noted by Gruzicki
Wlodek on bugtraq.

While here replace one use of 132 with DWIDTH.
2006-11-22 16:15:42 +00:00
mrg
fd5635ed7a don't discard const. GCC 4.1-20061021 doesn't like that... 2006-10-22 08:09:24 +00:00
elad
ac3f498792 Typo, from David A. Holland on #NetBSD-code, thanks! 2006-10-08 20:12:27 +00:00
elad
444bc3c8be Input validation, from David A. Holland on #NetBSD-code 2006-10-07 18:29:02 +00:00
elad
1232ea27c4 PR/18906: roskens at elfin dot net: misc. select() to poll() updates.
Adapted to -current by myself, thanks for the patch!
2006-10-07 17:27:57 +00:00
jmcneill
a6a54c10d8 PR# 4305: [dM] boggle uses very incomplete wordlist. 2006-09-24 01:38:57 +00:00
christos
5e676b6bff PR/34175: Zafer Aydogan: touch the window to cause a refresh after help
Also use CTRL instead of \xxx
2006-08-09 14:29:40 +00:00
hubertf
33a2a79b24 Attribute ``A language that doesn't affect the way you think about
programming is not worth knowing.'' to Alan Perlis, per Diomidis Spinellis'
blog at http://www.spinellis.gr/blog/20060424/
2006-06-24 13:32:45 +00:00
reed
5fe28dc7e5 Fix typo or mispelling. 2006-06-17 04:58:14 +00:00
jnemeth
4ce238c9c6 Increase username length to match modern systems, and create #defines for a
couple of lengths.
2006-06-07 09:36:39 +00:00
jnemeth
ca1e1e9c7c Actually accept "?" argument as documented in the manpage.
Don't attempt to ignore an untrappable signal.
Fix 6 possible buffer overflows.
2006-06-07 09:35:03 +00:00
jnemeth
c8e9ec4ee2 Don't follow symlinks on systems that have O_NOFOLLOW.
Don't bother looping with lockf() since first iteration would return.
Prevent two buffer overflows.
2006-06-07 09:30:35 +00:00
jnemeth
c7bfb55e4e prevent "stack" overflow 2006-06-07 09:24:26 +00:00
jnemeth
29088d6b12 bracket else block 2006-06-07 09:22:52 +00:00
jnemeth
f05caa1c39 WARNS=4 2006-06-07 09:21:06 +00:00
drochner
3f13a4cf7b Better check data read from tetris.scores before use as array indices etc.
This is CVE-2006-1539, files against Gentoo Linux, the patch is from
Gentoo.
A standard NetBSD installation is not as much risk because tetris is
sgid "games", and users shouldn't be in that group.
2006-06-01 16:12:27 +00:00
dan
f96b430610 read config more strictly, from Maximillian Dornseif 2006-05-25 07:11:54 +00:00
mrg
06b50ed8b9 don't try to switch a char and have a case of EOF - use an int. 2006-05-18 18:42:59 +00:00
christos
2854829efb Remove dup Hitler fortune. One of the two fortunes I moved yesterday, was
already in the offensive set. From a NetBSD fan who prefers to be anonymous.
2006-05-17 14:47:58 +00:00
christos
4440541abb PR/33495: Daniel Weiss: Offensive quote in netbsd fortune package
- Move 2 offensive to women Adolf Hitler quotes to fortune2-o
- s/Adolph/Adolf/
2006-05-16 20:13:50 +00:00
christos
bd02d883c4 Add a virtual destructor to avoid "future ABI issues". I love c++. 2006-05-14 06:38:04 +00:00
christos
ef47ce8264 add virtual destructors so that g++ shuts up. 2006-05-14 03:21:52 +00:00
christos
939d9a18de Don't use iostream just for the usage message. Use stdio instead. 2006-05-14 03:21:23 +00:00
christos
47169552b3 XXX: GCC uninitialized 2006-05-14 03:15:50 +00:00
christos
a108a3f479 Coverity CID 3382: Fix memory leak. 2006-05-13 22:45:11 +00:00
christos
4b679b2a7f Coverity CID 3383: Fix memory leak. 2006-05-13 22:43:02 +00:00
christos
dad51bf4f0 Coverity CID 3508: Fix file leak. 2006-05-13 22:29:53 +00:00
christos
2576ae5fca Coverity CID 3269: Fix memory leak. 2006-05-13 22:28:04 +00:00
mrg
aadd7d4847 sprinkle some -fno-strict-aliasing and -Wno-pointer-sign with GCC4. 2006-05-11 23:16:28 +00:00
mrg
524d5f27c4 lrint() -> larn_lrint(). 2006-05-11 10:23:24 +00:00
mrg
4bc6feceb6 end the argument list to exec*(3) with a NULL instead of a bare '0', as
the latter isn't a pointer context in these varargs functions.
2006-05-11 00:22:52 +00:00
mrg
8e969ac070 UC, PC and BC are provided my libtermcap, don't duplicate them. 2006-05-11 00:18:31 +00:00
mrg
bb1dac937d avoid a pointer sign difference. 2006-05-11 00:17:07 +00:00
mrg
0c37c63edc change (mostly) int to socklen_t. GCC 4 doesn't like that int and
socklen_t are different signness.
2006-05-09 20:18:05 +00:00
groo
cdb6398a72 Credit Alan Perlis for ``give him a lollipop'' programming language quote.
Hat tip: Jerry Leichter.
2006-04-26 00:52:21 +00:00
christos
1ce9f4326d Coverity CID 3032: Prevent double free: Next to the call of page_more()
there is a comment saying /* does fclose */, but the next line calls
fclose(fp);. Go figure.
2006-04-24 20:08:54 +00:00
snj
a640fe8c43 It's "its." 2006-04-24 19:00:29 +00:00
snj
bf5ceaae16 It's "its." 2006-04-24 18:00:53 +00:00
drochner
d8da09bdaf fix buffer overflow (CVE-2006-1744), from Debian 2006-04-20 10:57:26 +00:00
groo
bfdee53d40 Grammar nit. Never mind that it's still not true. 2006-04-06 19:47:23 +00:00
christos
a7a74df4fa Coverity CID 2788: If no room gets returned, don't try to place a monster. 2006-04-02 00:13:29 +00:00
christos
8710461ab4 Coverity CID 2791: Fix file pointer leak. 2006-04-02 00:08:12 +00:00
jnemeth
e61c7de467 Coverity CID 2452: possible negative array index; CID 1518 and CID 1517: possible overrun of static array 2006-03-30 05:04:22 +00:00
jnemeth
1c3223f073 Coverity CID 1288: possible negative array index 2006-03-30 04:41:15 +00:00
jnemeth
67f465476e Coverity CID 993: dereference of NULL pointer 2006-03-30 04:27:24 +00:00
jnemeth
cc2349eefc Coverity CID 1293: not checking for an error return 2006-03-30 04:19:38 +00:00
jnemeth
fa4599a211 Coverity CID 1287: not checking for error return 2006-03-30 04:10:04 +00:00
jnemeth
995d4b331f Coverity CID 1327: check for error return 2006-03-30 01:32:27 +00:00
jnemeth
a3fb5aa745 Bah! Compare, don't assign! 2006-03-30 01:31:13 +00:00
jnemeth
dce307414d Coverity CID 1328: check for error return 2006-03-30 01:28:46 +00:00
jnemeth
f413c2ba58 Coverity CID 1326: check for error return 2006-03-30 01:25:52 +00:00
jnemeth
db7b70f433 Fix Coverity issue 891 -- FORWARD_NULL.
Approved by christos@.
2006-03-29 01:21:07 +00:00
jnemeth
83f277c49a Fix Coverity issues 2366 and 2365 -- REVERSE_INULL.
Approved by Christos@.
2006-03-29 01:19:51 +00:00
jnemeth
2ad8d2c6cd Fix Coverity issue 2584 -- USE_AFTER_FREE and issue 889 -- FORWARD_NULL.
Approved by christos@.
2006-03-29 01:18:39 +00:00
christos
93eceea780 Add missing parens. 2006-03-22 15:24:52 +00:00
christos
549b5ed9d1 Simplify (Masao Uebayashi) 2006-03-22 05:03:10 +00:00
christos
8b7bfd1f64 Coverity CID 692: Another && that should be ||. Boy... 2006-03-22 04:24:14 +00:00
christos
1990635dbb Coverity CID 558: && should be obviously || 2006-03-22 04:22:05 +00:00
christos
df3594a46a Coverity CID 2735: Remove dead code. 2006-03-21 20:25:55 +00:00
christos
dd3fe9b2dc Coverity CID 2737: Handle linked-lists properly. Use calloc instead of malloc
so that we don't end up storing garbage accidentally and the next pointer is
initialized. If there is an inconsistency in the file abort instead
of dereferencing NULL.
2006-03-21 17:14:15 +00:00
rtr
90b0b10c77 remove duplicate #include <stdlib.h> 2006-03-20 12:32:21 +00:00
he
3ac2299da5 Now that we use exit(2), we need to include <stdlib.h> for its definition. 2006-03-19 12:09:39 +00:00
christos
c08f926ecb include <stdlib.h> to get a prototype for exit 2006-03-19 06:02:50 +00:00
christos
e92d4ac1fa Coverity CID 1197: Don't pass -1 to close. 2006-03-19 01:00:35 +00:00
christos
4140928aa1 Coverity CID 1467: Elide static buffer overflow. 2006-03-19 00:56:12 +00:00
christos
989c7cd825 Coverity CID 868: Fix possible NULL deref (after INFTIM passes :-) 2006-03-19 00:50:28 +00:00
christos
2197ff9156 Coverity CID 980: Prevent an impossible NULL point deref. 2006-03-19 00:41:46 +00:00
christos
0e8c6c24b2 Coverity CID 2073: Fix memory leak. 2006-03-19 00:37:15 +00:00
christos
0255deb434 Coverity CID 999: Prevent NULL deref. 2006-03-19 00:32:18 +00:00
christos
d7b2adb029 Coverity CID 695: Remove impossible condition. This changes the scoring as
it was probably intended originally.
2006-03-19 00:29:27 +00:00
christos
c29d845a03 Coverity CID 998: Possible NULL pointer deref. Actually this was a bug
where a house to be sold would be skipped. Change the sell loop to be like
the buy side loop.
2006-03-19 00:19:31 +00:00
christos
ad05902b98 fix typo 2006-03-19 00:18:47 +00:00
christos
a195251302 Coverity CID 1004: Fix NULL deref. 2006-03-19 00:05:05 +00:00
christos
db0d71974c Coverity CID 1005: Fix NULL deref and incorrect variable use. 2006-03-19 00:03:18 +00:00
christos
abe5f75745 Coverity CID 1443: Prevent static overrun. 2006-03-19 00:00:19 +00:00
christos
f25329586b Coverity CID 827: Prevent NULL pointer deref. 2006-03-18 23:54:17 +00:00
christos
02549e79e2 Coverity CID 1699: Fix memory leaks. 2006-03-18 23:51:51 +00:00
christos
ffe2beb426 Coverity CID 2544: Fix memory leak. 2006-03-18 23:44:05 +00:00
christos
f09b76be8d Coverity CID 1786: Close file. 2006-03-18 23:38:12 +00:00
christos
f80221a1cd Coverity CID 570: Remove impossible check. 2006-03-18 23:35:51 +00:00
christos
44fa0e017a Coverity CID 1195: Check for possible negative index. 2006-03-18 23:33:38 +00:00
christos
8319a6a7da Coverity CID 777: Fix NULL pointer deref and de-obfuscate code. 2006-03-18 23:31:19 +00:00
christos
c873d1eb57 Coverity CID 1230: Remove spurious close(). 2006-03-18 23:25:30 +00:00
christos
e0b976a0ae Coverity CID 1294: Avoid negative variable used as index. 2006-03-18 23:23:33 +00:00
christos
2a67d42737 Coverity CID 1295: Don't allow cchose to return a negative number. It is
used as an index.
2006-03-18 23:14:45 +00:00
rtr
969e2244d4 fclose() open FILE * even though we are returning to fail anyway.
silences coverity, CID 1590 / run 5
2006-03-18 09:40:46 +00:00
rtr
0c0f6ae5dc don't access out of bounds element of static alloc array.
found by Coverity, CID 1519 / Run 5

XXX possible that intention was to start with i = 0.
2006-03-18 05:16:46 +00:00
abs
a3edf3e145 If none of the boarding parties are set do not fall off the end of the
list. Addresses Coverity CID 1507. Also put pointers before shorts in
a struct rather than mixing them up
2006-03-18 01:43:52 +00:00
abs
e0d5463807 add more "ifdef notdef" around unused sections - addresses Coverity CID 564 2006-03-17 23:36:38 +00:00
abs
b4f3ebd201 Add a missing bp->b_score not null check - addresses Coverity CID 1003 2006-03-17 23:34:37 +00:00
abs
2c2c60a0ef if getpwuid() returns null, print out the uid rather than dereferencing
Addresses Coverity CID 930
2006-03-17 23:22:59 +00:00
abs
f0ff12503e Fix overrun in players[] array. Addresses Coverty CID 1457 2006-03-17 23:15:02 +00:00
abs
b317f83344 If getpwuid() returns null, its not usually a good idea to dereference
that to try to assign a default value. Just copy the default value into
the final destination.
Addresses Coverty CID 925
2006-03-17 23:11:47 +00:00
abs
f4f2f41178 Call fclose() appropriately if there is a problem with the save file.
Coverty CID 2063
2006-03-17 23:04:01 +00:00
simonb
5cfbf7bf76 Use MKPRIVATELIB instead of NOLINKLIB/NOMAN/NOPIC/NOLINT. 2006-02-25 12:04:23 +00:00
simonb
feaaa5ed4c Change DPADD from LIBTERM (which doesn't exist) and LIBCOMPAT (which it
doesn't use) to LIBTERMCAP (which it does use).
2006-02-25 11:56:51 +00:00
wiz
f19f5c87cc Fix typo in the instructions. 2006-02-25 02:06:08 +00:00
wiz
5fcd22e873 Remove duplicate and uncredited "Plan for the Improvement of English
Spelling", which is also in the file "fortunes".
2006-02-25 01:40:22 +00:00
jnemeth
df4822d1f0 Correct The Hitchhiker's Guide to the Galaxy entry about dolphins as per
page 119 of the book.
2006-02-20 03:00:27 +00:00
elad
c53cd0c067 moduli utils moved from games to usr.bin. 2006-01-24 19:01:45 +00:00
elad
c1ef323e1a Remove qsiefe/qsafe from games. Will be put back in usr.bin. 2006-01-24 18:51:20 +00:00
wiz
cfebedec7e Bump date for previous. 2006-01-22 21:22:30 +00:00
wiz
5e86832ad4 Drop trailing whitespace. Remove superfluous .br. 2006-01-22 00:32:54 +00:00
elad
271a419065 better handle ^d in getinp(), so we dont loop endlessly.
i have no idea why i wanted to play this game.
2006-01-20 21:40:08 +00:00
elad
202106feb9 oops, make this install to /usr/games and not /...
noted by hannken@, thanks.
2006-01-20 14:19:31 +00:00
elad
d4bdf04e28 Descend to moduli too. 2006-01-19 23:25:19 +00:00
elad
0e71d2c846 Add qsieve and qsafe, two programs used for generating the moduli file.
These were written by William Allen Simpson and submitted in PR 21983,
and are added with minor adjustments and nits from christos@ and myself.

Approved by christos@ and groo@.
2006-01-19 23:23:58 +00:00
garbled
19fe295582 Fix some minor buglets in wump:
1) Don't put two pits in the same room.
2) Don't put bats and pits in the same room.  (you will never hit the bat)
3) Don't start the player in a room with a pit or bad, if possible.  Some
caves are so crowded the loop may go on forever, so we give up after 100
tries to put them in a safe location (as long as it's not with the wumpus).
4) Make the manpage reflect reality WRT the default number of rooms.

Bug #3 pointed out by salo.
2006-01-19 21:20:35 +00:00
garbled
b2fc76e5cb Apply patch from PR bin/26501 to fix hang in wump if you play too many
games in a row.  Also modify change made in rev 1.18 to work correctly.
take_action() returns 1 if the player dies, causing the game to allways
exit after any death, now the game correctly asks if the player would
like to play again.
2006-01-19 20:15:31 +00:00
christos
1e463fb58d Simplify error checking. 2005-11-19 18:01:42 +00:00
rillig
c64619d462 Replaced one instance of err() with errx(), as the value of errno might not
be correct at that time.
2005-11-19 14:22:21 +00:00
mjl
7c7f1fe0ab Typos, duplicate words, consistent formatting. 2005-10-29 22:49:36 +00:00
mjl
4866f93355 Remove trailing spaces, double spaces between words, fix some typos. 2005-10-29 22:35:41 +00:00
mjl
6b25b3147c Correct typos. 2005-10-29 17:04:10 +00:00
rillig
40245fbcfd Removed the unnecessary #include <ctype.h>. 2005-10-18 20:13:04 +00:00
rpaulo
4b939f034f Fix two lines which were broken by previous commit. Noticed by Thomas
Klausner.
2005-10-12 15:33:41 +00:00
rpaulo
099795b92c misc/31566: Jaap Boender: update African and Asian capitals to the
current situation.
2005-10-12 15:14:27 +00:00
rillig
1e30fb707b Added an empty line to conform to KNF. 2005-10-08 18:18:18 +00:00
wiz
0c305c1a7e Drop trailing whitespace. 2005-09-15 02:10:37 +00:00