Commit Graph

1705 Commits

Author SHA1 Message Date
dholland b740fff70b Remove the need for -Wno-pointer-sign. Object diffs checked. 2009-07-26 03:02:38 +00:00
dholland 8a0aa42d77 Use random() instead of rand(), and seed with time instead of pid. 2009-07-20 06:43:18 +00:00
dholland a4cc1f4f06 Assorted minor cleanups, no functional change:
- u_int* -> uint*
   - don't make private typedefs of system structures
   - use curses TRUE and FALSE only with curses booleans, otherwise
     true and false;
   - includes cleanup
   - group globals in extern.c by functionality

Object file diffs inspected.
2009-07-20 06:39:06 +00:00
dholland d547a06ea3 A bit more whitespace. 2009-07-20 06:09:29 +00:00
dholland 62c771fd10 Whitespace. 2009-07-20 06:00:56 +00:00
dholland 30870bd58b ANSIfy. Use __dead. Object diffs checked. 2009-07-20 05:44:02 +00:00
dholland d99ff15344 ANSIfy. Also, we now have RANDOM_MAX; use it. Object diffs checked... 2009-07-20 05:33:35 +00:00
roy 7027866a09 Rename internal getline() function to get_line() so it does
conflict with the soon to be added getline(3) libc function.
2009-07-13 19:05:39 +00:00
dholland 81eafd7899 Remove config options for 4.2BSD and 4.3BSD, and associated code. Highly
obsolete, and I doubt most of it still worked anyway.
2009-07-04 07:51:34 +00:00
dholland 57ba7791b7 Remove the non-curses screen handling, since it relies on knowing
about various internals of SVR4 curses, old BSD curses, and/or other
unclean things. (Yes, the non-curses handling still used bits of
curses. Fie.)
2009-07-04 07:10:22 +00:00
dholland cda8e486de Remove config for the return type of signal handlers, which is also a
long-dead issue.
2009-07-04 06:38:34 +00:00
dholland 765594d234 Remove references to config #defines for the thoroughly obsolete
4.2BSD syslog API.
2009-07-04 06:31:31 +00:00
dholland c41c818a00 more whitespace 2009-07-04 06:19:05 +00:00
dholland b2987dcaa0 Various minor fixes, mostly from OpenBSD. 2009-07-04 06:15:27 +00:00
dholland 9a53db3705 Notes on the protocol used by hunt, from OpenBSD. 2009-07-04 05:06:06 +00:00
dholland cb89af2bfc Whitespace. 2009-07-04 05:01:16 +00:00
dholland b2f99339f0 Whitespace. 2009-07-04 04:29:54 +00:00
dholland db04762fba Sigh, more of the same (missed two) 2009-07-04 03:29:20 +00:00
dholland b00a6a7437 __attribute__((__noreturn__)) -> __dead 2009-07-04 03:27:57 +00:00
dholland fbca3d8cfa ANSIfy function declarations. 2009-07-04 01:58:57 +00:00
dholland d9fe3edadc Remove two more bogus casts. These *do* create object diffs on amd64,
for no clear reason, but it looks like the diffs are harmless.
2009-07-04 01:44:28 +00:00
dholland 07f4ebf08e Remove bogus casts. Two object file diffs inspected and found to be harmless. 2009-07-04 01:23:55 +00:00
dholland 6ffae66268 Remove a pile of bogus casts. One object file diff, crosschecked and
found harmless.
2009-07-04 01:01:18 +00:00
dholland 165c915b22 Fix two serious string-handling bugs (one exploitable, one probably
exploitable) and also add proper checking/paranoia in several other
places.
2009-06-29 23:05:33 +00:00
dholland 0ed1b742e0 sprintf -> snprintf 2009-06-28 21:12:10 +00:00
dholland 4c08f5f97e Fix possible remote DoS of a running hunt game, and prevent a possible
theoretical attack involving >= 1 billion ammo.
2009-06-28 18:59:37 +00:00
dholland b8c355d789 a bit more const 2009-06-07 21:04:54 +00:00
dholland a7a3b831c7 sprinkle some more const 2009-06-07 20:31:10 +00:00
dholland 8d5216e80d remove unnecessary casts 2009-06-07 20:25:38 +00:00
dholland 907fca1b3e sprintf -> snprintf, plus some use of strlcpy/strlcat where appropriate
XXX: there's still one sprintf left which will take some hacking to expunge.
2009-06-07 20:13:18 +00:00
dholland 1fa8a9a633 ANSIfy function declarations. All object file diffs inspected. 2009-06-07 18:30:39 +00:00
dholland a3c372524a Rectify non-compiling code that appears when DEBUG is defined. 2009-06-04 07:01:16 +00:00
dholland a1be1bdddd Set WARNS=4 here. This got missed on my previous WARNS sweep in games.
Everything appears to compile ok with WARNS=4 anyway though.
2009-06-04 06:51:11 +00:00
dholland 99d95061d4 Remove global scratch string buffer. Don't zoom off the end while reading
user input, either.
2009-06-04 06:47:36 +00:00
dholland 60843edfc7 Remove remaining references to sprintf. 2009-06-04 06:41:50 +00:00
dholland b8bb3787da Make a couple of the logging/printing functions printf-alikes. This removes
most of the calls to sprintf.
2009-06-04 06:27:47 +00:00
dholland 04ecbfca8b attribute noreturn -> __dead 2009-06-04 05:52:30 +00:00
dholland 02e6a3b1d0 sprintf -> snprintf 2009-06-04 05:51:12 +00:00
dholland 891dcf008d Increase spending on vowels. No object file diffs. 2009-06-04 05:43:29 +00:00
dholland 881e77fbe7 ANSIfy function declarations.x 2009-06-04 05:27:04 +00:00
dholland 54163608bb sprintf -> snprintf 2009-06-04 04:48:04 +00:00
dholland e5909fd6fe Don't use a variable-size array here. There's not really that much point. 2009-06-01 04:03:26 +00:00
dholland 135a0700ed Rearrange where the alternate definition of __dead goes.
It can't be before "include.h" as that includes a bunch of system headers,
but it can't be after either as it also includes a bunch of local headers.
Therefore, it needs to be *in* include.h.
2009-05-27 17:44:38 +00:00
dholland 4a5716eb31 Edit some. 2009-05-26 01:34:32 +00:00
dholland 1830cfcf79 Assorted fixes (mostly grammar, some markup) from OpenBSD. 2009-05-26 00:58:59 +00:00
dholland bee0eddc6b Paranoia about lengths of login names. From pjanzen of OpenBSD. 2009-05-26 00:30:16 +00:00
dholland 0cf018c12d Avoid SIGSEGV on users not in password file. From pjanzen of OpenBSD. 2009-05-26 00:27:23 +00:00
dholland 2e221153bc sprintf -> snprintf 2009-05-26 00:00:56 +00:00
dholland 951f1a50bf attribute noreturn -> __dead 2009-05-25 23:48:32 +00:00
dholland 18d676539b We don't need a private #define "unsgn" for "unsigned", especially since
it was used exactly once.
2009-05-25 23:44:04 +00:00
dholland 85fc4e7c13 Use the time to call srandom(), not getpid(). 2009-05-25 23:41:23 +00:00
dholland 3a7e6d0da5 KNF/whitespace: format preprocessor directives correctly. 2009-05-25 23:34:50 +00:00
dholland 905e2f95c6 ANSIfy function declarations. Object file diffs checked. 2009-05-25 23:24:54 +00:00
dholland ebb769ae0b sprintf -> snprintf 2009-05-25 23:14:33 +00:00
dholland c7a109cc7b ANSIfy function declarations. Object file diffs cross-checked. 2009-05-25 23:08:45 +00:00
dholland c1d5bd0853 attribute noreturn -> __dead 2009-05-25 22:35:01 +00:00
dholland e32a40eb27 Clean up scorefile handling.
This was writing time_t to disk. Worse, the time_t member was at an
unaligned offset in the structure in question, so after the time_t
change the structure layout depended on compiler-inserted structure
padding. This gives three legacy formats: one with 32-bit time, one
with 64-bit time, and one with 64-bit time and 4 bytes of structure
padding.

And of course the file didn't have a header or version coding or
anything.

The new code writes a structure of well-defined size that should not
receive unexpected padding, and gives the file a header and version
number. It reads that format and any of the three legacy formats,
figuring out which one it's dealing with by inspecting the file
contents. For good measure, it also now handles opposite-endian files,
doesn't bail out unceremoniously unless necessary, and won't croak if
the file is corrupt and e.g. contains unterminated strings.

(Was it worth going to this length? Maybe not. But it didn't seem
right to just leave it, and it's not clear where to stop halfway.)
2009-05-25 08:33:57 +00:00
dholland bbc67e0f7a ANSIfy function declarations.
Some object file diffs, but they are harmless. (Mostly they seem to
come from internal counters in gcc... and in one case the order of two
instructions was harmlessly swapped, which is odd and annoying.)
2009-05-25 04:33:53 +00:00
dholland 8842f79b56 Remove description of -a option and optional log file name, since
neither has done anything in a long long time. Add previously
undocumented -s/-f (slow vs. fast) options, although I question the
utility thereof and suspect they should just be removed.

Bump date (first time since 1993)
2009-05-25 00:53:46 +00:00
dholland b398836923 sprintf -> snprintf 2009-05-25 00:46:01 +00:00
dholland 96ebfddf0f sprintf -> snprintf. 2009-05-25 00:43:34 +00:00
dholland 869c9375c3 "abbreviation" has two Bs. 2009-05-25 00:39:45 +00:00
dholland 3ae4e09ad9 Use random() instead of rand(), so we get something like random
numbers out.

This changes the "tournament codes"; that is, the same code will give
you a different game now from what it used to. (This is because the
codes are basically random seeds.) I really really doubt anyone cares
about this, especially since the tournament feature appears to be
undocumented.
2009-05-25 00:37:27 +00:00
dholland 014e646e3e Remove obviously botched test for "fast mode" based on terminal speed.
Default to "fast mode" as ~nobody has a 300 baud terminal any more.
("Fast mode" apparently controls whether short-range scans are printed
by default at certain times.)
2009-05-25 00:29:08 +00:00
dholland 4d0e1ebeea Use getopt to handle the remaining (all currently undocumented) options. 2009-05-25 00:25:58 +00:00
dholland fdeec4afb6 Remove last traces of undocumented -p option (apparently related to
process priority) and documented -a option, neither of which have
done anything since CSRG days.
2009-05-25 00:20:22 +00:00
dholland 5f12e3fad3 Don't give special privileges to uid 13107. 2009-05-25 00:12:32 +00:00
dholland b9b8495125 __attribute__((__noreturn__)) -> __dead 2009-05-25 00:07:14 +00:00
dholland 01781d3f3f Null for pointers, not 0. 2009-05-25 00:05:56 +00:00
dholland a16adbcbde Fix score printing so columns line up. 2009-05-25 00:03:18 +00:00
dholland db2522cfd8 Abolish cgetc(). It contained one line of code, which was wrong.
Call getchar() directly, and handle EOF properly instead of looping
(in some cases) or pretending that EOF is 0 (which it isn't).
2009-05-24 23:20:22 +00:00
dholland df31a803d8 Remove unnecessary initialization that silenced a compiler warning in 1997. 2009-05-24 23:00:46 +00:00
dholland 3ac047a655 Sprinkle some blank lines for readability. 2009-05-24 22:57:37 +00:00
dholland 61357867d7 Split up lines > 80 chars. Object files unchanged. 2009-05-24 22:55:03 +00:00
dholland fffd2fba77 Don't use literal ^G's in string constants. Use \a. 2009-05-24 21:55:24 +00:00
dholland 50b862e21c KNF: brace and comment placement. Object files identical. 2009-05-24 21:44:56 +00:00
dholland d8016deb30 whitespace 2009-05-24 20:43:09 +00:00
dholland ad04eda0f2 KNF: fix formatting of preprocessor directives 2009-05-24 20:39:43 +00:00
dholland bf0917b6ae ANSIfy function declarations. No object file diffs except for two functions
whose K&R declaration didn't fully match the prototype (char vs. int) and
the diff of the disassembly of those looks plausible.
2009-05-24 19:18:44 +00:00
dholland 783505aca4 KNF. No change to .o file. 2009-05-24 18:22:27 +00:00
ginsbach 37a52c5f7b Change getdate() to getdatestr() since the former maybe present on systems
supporting X/Open System Interfaces Extension (XSI) getdate() in <time.h>.
This prevents a function prototype conflict.
2009-05-06 02:59:12 +00:00
wiz 77c248c29f Remove trailing whitespace. 2009-05-04 20:37:28 +00:00
drochner 0fa7059102 define YY_NO_INPUT where appropriate, from Kurt J. Lidl per PR misc/41160 2009-04-20 16:05:29 +00:00
wiz 6d5f9e9307 Sort sections. 2009-04-12 18:31:47 +00:00
joerg b0c28ab299 Don't nest displays. 2009-04-12 16:58:57 +00:00
joerg fdd399fcf8 Convert to mdoc markup. With input from wiz. 2009-04-12 16:57:02 +00:00
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