Commit Graph

1563 Commits

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