Commit Graph

1579 Commits

Author SHA1 Message Date
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