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
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.)
dholland [Wed, 27 May 2009 17:44:38 +0000 (17:44 +0000)]
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.
dholland [Mon, 25 May 2009 08:33:57 +0000 (08:33 +0000)]
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.)
dholland [Mon, 25 May 2009 04:33:53 +0000 (04:33 +0000)]
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.)
dholland [Mon, 25 May 2009 00:53:46 +0000 (00:53 +0000)]
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.
dholland [Mon, 25 May 2009 00:37:27 +0000 (00:37 +0000)]
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.
dholland [Mon, 25 May 2009 00:29:08 +0000 (00:29 +0000)]
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.)
dholland [Mon, 25 May 2009 00:20:22 +0000 (00:20 +0000)]
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.
dholland [Sun, 24 May 2009 23:20:22 +0000 (23:20 +0000)]
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).
dholland [Sun, 24 May 2009 19:18:44 +0000 (19:18 +0000)]
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.
ginsbach [Wed, 6 May 2009 02:59:12 +0000 (02:59 +0000)]
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.
dholland [Sun, 15 Mar 2009 03:33:56 +0000 (03:33 +0000)]
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.
dholland [Sat, 14 Mar 2009 22:52:52 +0000 (22:52 +0000)]
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.