Commit Graph

1994 Commits

Author SHA1 Message Date
dholland
8e73b3ad76 Remove more silly casts. 2011-08-06 20:29:37 +00:00
dholland
5aa2a843dc drop private (and wrong) definition of NULL 2011-08-06 20:24:35 +00:00
dholland
434d266e91 Use the right type for the malloc wrapper function, and don't cast the
return value.

(XXX: Except for a pile of allocation macros that produce typed pointer
results; there the typechecking of the result assignment is more valuable
than the warning if the alloc function isn't declared properly. These
macros should go away.)
2011-08-06 20:18:26 +00:00
dholland
25ec296591 Remove silly casts. 2011-08-06 20:00:33 +00:00
dholland
842dc544ae <sys/wait.h> is standard, so just use it instead of fiddling about with
ifdefs for long-dead systems. While here, remove union wait.
2011-08-06 19:53:24 +00:00
dholland
d30849d1cd abolish references to index/rindex 2011-08-06 19:47:54 +00:00
dholland
813e3e415d Remove the PYRAMID_BUG code. I don't think Pyramids are coming back, nor
do we care if their compiler vomits trying to decrement a bitfield.
2011-08-06 19:32:58 +00:00
dholland
cbc660deee Don't refer to index() in comments; use strchr(). 2011-08-06 19:23:38 +00:00
dholland
fcfbc606bf Include system headers before private headers. Avoids various possible
symbol conflicts.
2011-07-20 07:04:30 +00:00
mrg
db6886e029 apply some -O0 with gcc 4.5 and vax. 2011-07-03 15:29:34 +00:00
mrg
3206e7e70e use DBL_MIN from <float.h> instead of a hard coded small value (that
becomes zero for vax fp.)
2011-07-03 06:44:01 +00:00
mrg
1a1e24f1e6 include sys/time.h earlier (rather than implicitly via fcntl.h) so that
the "u" variable doesn't shadow stuff, found later in time.h inlines.

kind of a hack, but i don't want to modify time.h either.

XXX: seems kind of annoying
2011-07-02 02:10:33 +00:00
mrg
d060781d89 rename a variable from "time" to "stime" (it's a string) 2011-07-02 02:09:08 +00:00
mrg
c111245a78 apply some -Wno-error and/or -fno-strict-aliasing.
all of this should be looked at closer, but some of them are not
very trivial.
2011-06-22 02:49:41 +00:00
joerg
ab7b7d013a Use consistent sign in compare, the function is only called with
constants as third argument anyway.
2011-05-30 03:11:15 +00:00
joerg
108836d4ba Map RCSID to __RCSID 2011-05-23 23:06:41 +00:00
joerg
6047230580 ANSIfy 2011-05-23 23:03:38 +00:00
joerg
8f09f5ccbd Don't use variables as format string. 2011-05-23 23:02:07 +00:00
joerg
6dee362ea8 Kill some pointer indirections. Don't use variables as format strings. 2011-05-23 23:01:17 +00:00
joerg
c112023e0a ANSIfy 2011-05-23 22:59:27 +00:00
joerg
1a5e0fc9be #if 0 some unused code. 2011-05-23 22:58:44 +00:00
joerg
7c549d998f Don't use variables as format string. 2011-05-23 22:56:11 +00:00
joerg
57c13365a3 Correctly print variables as strings, not as format string. 2011-05-23 22:53:25 +00:00
joerg
cbd2e3d54f Properly print string. 2011-05-23 22:49:59 +00:00
joerg
76266ce815 Don't use variables as format strings. 2011-05-23 22:48:52 +00:00
joerg
278b576ff4 ANSIfy 2011-05-23 22:47:22 +00:00
joerg
f3a51298e1 Don't use strings from arrays as format string. 2011-05-23 22:46:35 +00:00
joerg
2d6cc1dbb0 Don't use return value of a function as format string. 2011-05-23 22:44:18 +00:00
is
96c5ad97be Bug fix: in a game with 26 planes, the last one to be allocated wouldn't
be allocated if it was the only eligible one.
From Jonathan David Amery via Debian Bug report 214626.
2011-02-15 08:25:25 +00:00
dyoung
da1712e7ee Fix spelling: it's *Jef* Raskin, not Jeff Raskin. 2011-01-24 15:30:54 +00:00
dholland
7ac7ba70d8 avoid unnecessary cast (hi wiz) 2011-01-05 15:52:20 +00:00
wiz
e78e25aaf3 Fix fd leak in error cases. Found by cppcheck. 2011-01-05 15:48:00 +00:00
wiz
f274b04232 Fix realloc error. Found by cppcheck. 2011-01-05 15:40:55 +00:00
joerg
5d8f0c3ff5 Don't use the same name for two parameters. 2010-12-08 17:08:07 +00:00
joerg
0dc972e776 Use __c99inline from sys/cdefs.h 2010-12-08 17:06:35 +00:00
pgoyette
6688046702 Fix a few of the games to use getprogname() in their usage() functions.
Suggested by Joerg.

XXX There are probably many more that have their progname hard-coded, but
XXX I'm not up for a wholesale roto-till at the moment.
2010-12-05 04:34:22 +00:00
pgoyette
1c22c7521b Since this game is installed as 'boggle', fix the usage() text to match. 2010-12-05 04:11:51 +00:00
pooka
71604335b9 add one i saw on irc today 2010-11-25 13:51:26 +00:00
dholland
85288e8bd5 Avoid undefined behavior, from Chris Spiegel in PR 43860. 2010-09-26 21:12:23 +00:00
dholland
388218390b Rework the game startup so it uses curses nicely. There are now menus
and stuff for picking scenarios and ships and all that.
2010-08-06 09:14:40 +00:00
dholland
66d93095d6 Don't define esc-[ as a custom key sequence because it steps on vt
function keys.
2010-08-06 03:10:26 +00:00
dholland
f4fdd2aad7 Fix some additional typos/grammar slips. 2010-05-29 22:56:01 +00:00
dholland
c30de92f88 Fix dog-Latin. The plural of wumpus could be wumpi, wumpus, or even wumpora,
but not 'wumpii'. Where does this -ii crap come from?
2010-05-29 22:53:49 +00:00
joerg
6394298f1b Follow the Fundamental Theory of Algebra. Disallow factorising of
numbers less than 2 as it is not
- naturally unique (negative numbers)
- finite (0)
- non-empty (1)

Discussed with the kristaps and wiz
2010-05-15 21:22:39 +00:00
joerg
f0352d672f \\ -> \e 2010-05-14 19:02:28 +00:00
tnozaki
50eb6aadde cast isblank(3)'s argument to unsigned char. 2010-05-13 17:52:11 +00:00
drochner
d184555b35 rename pollard_pminus1->pollard_rho for consistency 2010-04-28 18:04:31 +00:00
drochner
fe64100e9e -Fix an old bug in the "pollard" code: it gets its argument passed
by reference, and changes the value behind the pointer under some
 circumstances (basically if it finds more than 2 different factors).
 It also calls itself if it finds a factor which is not considered prime
 (by openssl's miller-rabin check) and uses the call argument afterwards.
 This doesn't work -- we need to copy the argument into its own storage.
-Modify the code to do the "rho" algorithm as was initially announced.
 It takes somewhat longer in rare cases, but still works in cases where
 the "p-1" algorithm is unusable. This might fix PR misc/43192
 by Luiz Henrique de Figueiredo.
-Add some optional debug support, minor cleanup.
2010-04-27 18:11:19 +00:00
dholland
6763d40772 Document the options that actually exist, instead of some other
completely unrelated set. Bump date. (first time since 1993!)
2010-04-24 01:13:37 +00:00
dholland
de82ffd7cb Handle the "diedtime" field of the player log (which is not the high
scores file, the append-only log of all games) as int32_t instead of
time_t. Log files from before the 64-bit time_t change can now be read
again; however, log files from the last year of -current are hosed.
All none of you who play larn, take note...
2010-04-24 00:56:14 +00:00
dholland
b8a40a1a76 fflush the score file while signals are blocked to decrease the chance of
it getting corrupted.
2010-04-24 00:38:30 +00:00
drochner
f79e06d729 fix an obvious flaw in bounds check: the array of precomputed primes
could be overrun if its last entry (65537) was a factor of the input
(this does not affect PR misc/43192 -- the factors are much larger
here: 7742394596501*159455563099482401)
2010-04-22 14:28:48 +00:00
wiz
0b27f753a1 Add backslash before a dash to get a minus. 2010-04-22 06:57:13 +00:00
dholland
9f8746b55e Sync with reality. Bump date. 2010-04-22 04:42:21 +00:00
christos
3dc82e5062 handle ctime returning NULL. 2010-04-04 00:08:49 +00:00
christos
99b1f1b15a ctime can return NULL. 2010-04-02 21:40:00 +00:00
christos
ff4e4fcdee fix typo. 2010-04-02 19:34:44 +00:00
christos
84ea502702 handle ctime returning NULL. 2010-04-02 15:34:16 +00:00
dholland
5cea3c1fc6 remove #ifdef SVR4 2010-03-29 05:16:08 +00:00
dholland
b7b2c88aa1 Some improvements to the new UI. 2010-03-29 04:28:47 +00:00
dholland
96bcb2af91 reorg for clarity and exposition. 2010-03-29 04:00:03 +00:00
dholland
4a11aa7558 Better user interface. From OpenBSD, written by Paul Janzen quite a
long time ago. A few minor adjustments by yours truly.
2010-03-29 03:51:55 +00:00
dholland
3fa2c4cfe9 Spell "versus" right. 2010-03-29 02:48:17 +00:00
dholland
f6d2af84fc Allow saved game filenames up to PATH_MAX. From OpenBSD. 2010-03-29 02:46:05 +00:00
dholland
fb89b74a21 fix quote markup, spotted in openbsd diffs 2010-03-29 02:34:50 +00:00
dholland
47514c94ae Fix typo. From OpenBSD. 2010-03-29 02:32:45 +00:00
dholland
bb74336220 Don't exit(0) on failure. Use errx() instead of fprintf. 2010-03-29 02:21:04 +00:00
mrg
5f0f7c9f12 rename text() to wrtext(), aligning it with most other output routines,
and avoiding a compile error on powerpc64.

XXX: this tries to make a ".text" symbol, which already exists...
2010-03-22 05:10:19 +00:00
dholland
4db9f70f12 Latin police: use proper conjugation.
(whether the rest of the affected fortune is valid either is debatable)
2010-02-16 09:53:51 +00:00
he
76d4444c78 When using -lcurses, you also need -lterminfo.
This fixes the build for sun2, and also builds with LDSTATIC=-static,
since archive libraries don't record inter-library dependencies.
2010-02-06 23:45:24 +00:00
roy
98eb889579 Userland now builds and uses terminfo instead of termcap.
OK: core@, jdc@
2010-02-03 15:34:37 +00:00
wiz
4c5d0b1878 Close file when finished with it. Found by cppcheck. 2010-01-17 22:56:32 +00:00
wiz
32b30fe688 Simplify alloc() to avoid ifdef(LINT) workaround. 2010-01-17 22:55:20 +00:00
wiz
8c6dae0be9 Close two file descriptors after using them. Found by cppcheck. 2010-01-17 22:52:00 +00:00
mbalmer
5214aa9799 The default output file extension is '.dat', not '.out'.
From Lars Nooden via OpenBSD.
2010-01-17 13:35:00 +00:00
joerg
642cfb40e9 Use .%U instead of .%O for URLs. 2010-01-15 19:39:10 +00:00
dholland
2ea1f2138b Christos points out that usage should not use errx, but should use
getprogname.
2010-01-03 17:08:45 +00:00
wiz
4f6260c6a1 New sentence, new line. 2010-01-01 11:45:34 +00:00
dholland
da0f6356ae Adjust SYNOPSIS for cfscores to better match reality. Note in BUGS
that the score file isn't portable. Bump date (first time since 1993,
and first in 2010...)
2010-01-01 07:35:09 +00:00
dholland
381a1804f4 Split struct betinfo into its own header file so it can be shared
between canfield and cfscores, instead of copy-pasted.
2010-01-01 06:37:15 +00:00
dholland
97ebabce84 Use NULL instead of 0 for pointer tests. Remove an unnecessary cast. 2010-01-01 06:31:18 +00:00
dholland
93abe19853 Send error messages to stderr. Use errx/warnx, not printf. 2010-01-01 06:20:45 +00:00
dholland
07673b8c8a Correct usage message. 2010-01-01 06:16:36 +00:00
dholland
f74d700f40 Fix math notation, from PR 41547. While here, fix some potential tab
damage in the same fortune.
2010-01-01 00:16:54 +00:00
ahoka
07b3322423 Hide the cursor during the game. 2009-12-19 19:27:53 +00:00
matt
e7e033198e Fix bad merge. (SUBDIR= != SUBDIR +=) 2009-12-14 20:47:23 +00:00
uebayasi
3a48f7cfa9 Conditionalize some build directories by ${MKCXX}. 2009-12-14 12:43:48 +00:00
wiz
9a261cfdbd was disappointed that someone wrote disappointed with one 'p', so I fixed it. 2009-12-08 10:13:39 +00:00
mbalmer
0a83daaf24 I was disappointed that someone wrote disappointed with two 's', so I fixed it. 2009-12-08 10:04:27 +00:00
christos
084eb9fd8b use %option noinput nounput 2009-10-29 14:27:26 +00:00
dholland
f6eb744e6f Another spelling mistake. 2009-10-29 08:53:31 +00:00
dholland
fd176799a3 Whitespace. 2009-10-29 08:47:07 +00:00
snj
5a8793b8e8 Fix a bunch of typos and spelling errors. 2009-10-28 19:18:15 +00:00
snj
a089595921 Kill two duplicates. 2009-10-28 15:56:26 +00:00
dholland
20f1b2155b "Ghandi" -> "Gandhi" 2009-10-28 06:23:29 +00:00
snj
550147bd6a Remove 3rd and 4th clauses in christos' license. OK christos. 2009-10-21 01:07:44 +00:00
dholland
420cf14d38 Fix '=' for '==' in a test. From NAKAJIMA Yoshihiro in PR 42177. 2009-10-19 02:34:40 +00:00
dholland
6a214fad9e Disable writing scores when built for /rescue. PR 42009 2009-09-08 13:38:01 +00:00
dholland
e28fc9086c Dumping all system includes anything uses in one big header file is so 1986.
XXX: Removing unused declarations (thus, unused headers can trigger
XXX: it) sometimes causes gcc to generate substantially different
XXX: code. Dunno why but it looks rather like a gcc bug.
2009-08-31 08:27:16 +00:00
dholland
29d1f99953 Don't need -DHAVE_REGCOMP any more 2009-08-27 03:12:16 +00:00
dholland
20ce96200f Instead of trying to cons up a regexp that ignores case, use REG_ICASE.
This makes fortune -im work; it's been broken since whenever.
2009-08-27 03:09:17 +00:00
dholland
47c8cadb48 Tidy up regexp handling further. 2009-08-27 03:04:58 +00:00
dholland
ade23dc0db Prune conditional compilation for using obsolete regexp libraries. 2009-08-27 02:21:36 +00:00
dholland
4995cfe200 Whitespace. 2009-08-27 02:03:22 +00:00
dholland
e07a279dee Prevent nasal demons in a case I spotted while preparing the previous. 2009-08-27 01:42:08 +00:00
dholland
fb94dc019f ANSIfy function definitions. 2009-08-27 01:40:27 +00:00
dholland
0ba36cdda2 Sprinkle some size_t in places where it's better than int.
(Reduces casts.)
2009-08-27 01:19:38 +00:00
dholland
b80dbf8031 remove more unnecessary casts 2009-08-27 00:43:31 +00:00
dholland
9ece4dba1c Use correct type for malloc sizes (size_t, not unsigned) 2009-08-27 00:42:11 +00:00
dholland
c94bff8297 remove unnecessary casts 2009-08-27 00:40:44 +00:00
dholland
9ac5061b87 u_int32_t -> uint32_t 2009-08-27 00:36:32 +00:00
dholland
04ed523694 ANSIfy function definitions 2009-08-27 00:31:12 +00:00
dholland
cf97b0fdcd Use standard C: 'unsigned', not 'u_int' 2009-08-27 00:24:11 +00:00
dholland
431304b3b0 remove unnecessary cast 2009-08-27 00:22:28 +00:00
dholland
fe14252156 remove unnecessary casts 2009-08-27 00:21:45 +00:00
dholland
3379762795 remove unnecessary cast 2009-08-27 00:19:52 +00:00
dholland
7c9708a909 Use __dead. 2009-08-25 06:58:04 +00:00
dholland
aa19a9d0a5 Whn ths cd ws wrttn, thr ws bt shrtg nd vwls wr xtrml xpnsv. Nowadays,
however, we have an ample vowel budget, and bit shortages are a thing
of the past (even in a down economy) so spend a bit to improve
readability.
2009-08-25 06:56:52 +00:00
dholland
84bca7035f ANSIfy a leftover function.
Also note some unportable code with a comment. Can't change it because
it'd break save files, though.
2009-08-25 06:04:17 +00:00
dholland
da121b3331 sprinkle static 2009-08-12 08:54:54 +00:00
dholland
1e99780e5d sprinkle static 2009-08-12 08:44:45 +00:00
dholland
5305281b0c sprinkle static 2009-08-12 08:21:41 +00:00
dholland
f2a20f5fe4 sprinkle static 2009-08-12 08:04:05 +00:00
dholland
75b3905d60 sprinkle static and prune some dead code 2009-08-12 07:42:11 +00:00
dholland
9b92b18917 sprinkle static 2009-08-12 07:28:40 +00:00
dholland
bc0970cff2 sprinkle static 2009-08-12 06:19:17 +00:00
dholland
6613b31163 sprinkle static 2009-08-12 06:06:28 +00:00
dholland
e0ba63fe83 sprinkle static 2009-08-12 05:48:04 +00:00
dholland
f59d107e64 sprinkle static 2009-08-12 05:35:44 +00:00
dholland
43e0d095a0 sprinkle static and prune some dead code 2009-08-12 05:29:40 +00:00
dholland
9795f61a5a sprinkle static 2009-08-12 05:17:57 +00:00
dholland
24ddf1fdf8 looks as if "ospeed" here was meant to be extern. 2009-08-12 04:51:11 +00:00
dholland
7a2ed76402 sprinkle static 2009-08-12 04:48:03 +00:00
dholland
c62bf84c55 sprinkle static 2009-08-12 04:28:27 +00:00
dholland
b76cf716a9 Don't use a FILE * after fclose(). PR 41832 from Henning Petersen. 2009-08-06 17:55:18 +00:00
christos
4b76b4506c don't use char values for functions that can return -1; chars are not always
signed.
2009-08-05 19:34:09 +00:00
dholland
f5d4590c31 Use getopt instead of hand-rolled options code. Document all the arguments
and options. Don't allow the previously undocumented method to change the
maximum number of scores kept per user to be used on the system-wide high
score file. Sort options list in the man page. Bump its date.
2009-08-05 04:03:47 +00:00
dholland
a95dd4ab67 don't ignore errors from read(); found by lint 2009-08-03 06:04:12 +00:00
dholland
bfaf2fa3e6 Remove the need for -Wno-pointer-sign. Object file unchanged. 2009-07-26 03:05:52 +00:00
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
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