Commit Graph

102 Commits

Author SHA1 Message Date
jsg 25a24f0b58 Avoid gendered language in man pages when not referring to a specific
person. Rewrite or use singular they.

ok thfr@ sthen@ daniel@ ian@ job@ kmos@ jcs@ ratchov@ phessler@ and
others I'm likely missing on an earlier version.
feedback tj@, feedback and ok jmc@
2022-02-18 23:17:13 +00:00
mestre bda84ce940 if both stdout and stderr are redirected to a non-tty, pledge(2) will kill
ncurses applications, e.g.:

/usr/games/worms 2>&1 | cat

solve this by only calling pledge(2) after initscr(3) is set and done, or
whatever function that calls it. since pledge(2) is called later now the
promises might be reduced, but this a diff for another day.

found by naddy@ almost a year ago, discussed with him deraadt@ and tb@
ok tb@
2021-10-23 11:22:48 +00:00
jmc cbe702d0ae fix unmarked/ignored descriptive mix up;
from rafa
2020-12-13 15:47:32 +00:00
deraadt df69c215c7 When system calls indicate an error they return -1, not some arbitrary
value < 0.  errno is only updated in this case.  Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.
2019-06-28 13:32:41 +00:00
espie b32aa91882 have bsd.prog.mk/bsd.lib.mk generate .y -> .c/.h rules without intermediate
files. This fixes up parallel builds in the default case.
FreeBSD does something similar.

okay millert@
2017-07-09 14:04:50 +00:00
espie ac34abcd10 we're not shooting yacception
okay millert@
2017-07-07 12:41:59 +00:00
krw 71cfb2ea07 Nuke some excess whitespace. 2017-01-20 00:50:16 +00:00
fcambus f4763835df Remove useless #ifndef in atc(6) and pom(6).
M_PI is always defined, so we can drop those directives.

OK deraadt@, millert@
2016-12-01 20:08:59 +00:00
tb ee7acb09aa Callers of time(3) should #include <time.h>.
ok deraadt
2016-09-11 14:21:17 +00:00
guenther 79af1000e6 Pull in <sys/time.h> for struct timespec, gettimeofday(), clock_gettime(),
and setitimer()

ok deraadt@
2016-08-27 02:02:44 +00:00
mestre 45555366a8 Prefer fseek(3) over rewind(3) since the latter although it also calls fseek
then additionally it calls clearerr(3) deliberately but we want to catch any
error that may happen and this way we couldn't catch it

OK tb@
2016-03-16 15:00:35 +00:00
jmc 4daa3df4a5 remove -u? from usage(); 2016-03-07 13:48:25 +00:00
mestre 6fa5e1da34 - General changes:
- Remove -? from getopt(3) options, but still keep (or add) -h where applicable
- Replace hardcoded program strings by getprogname(3)

- Specific changes:
- atc(6): this used -? and -u for usage(), remove both from game and manpage
- bcd(6): use __progname instead of getprogname(3), no need to include stdlib.h
- hunt(6): replace fputs(3) by fprintf(3)

OK tb@ after his suggestions
2016-03-07 12:07:55 +00:00
mestre a685fffcd5 ANSIfy grammar.y on atc(6), all other files already are
OK tb@
2016-01-09 19:27:56 +00:00
tb 95d0ce2685 add missing 'void'
ok mestre@
2016-01-08 13:40:05 +00:00
tb 17641e3181 Some basic code maintenance in games/
- in main() replace exit with return
- drop some /* NOTREACHED */ lint comments along the way.
- make more use of standard CFLAGS, esp. -Wimplicit-function-declaration
- add and sort some headers when needed
- add straightforward pledges to some programs used at compile time

discussed with and ok mestre@
2016-01-07 16:00:31 +00:00
mestre 9ea8ec706f About 13 years ago when the idiom srandom(time()), and sometimes
srandom(time()+getpid()), was changed by srandomdev(), but #include <time.h>
lived up until this day so remove it.

Additionally, earlier than that, 18 years ago, random(6) was one of the first
consumers of arc4random(3) family, and was pulling it from dev/rndvar.h but
these days we pull it from stdlib.h, which is already done, so while here
remove dev/rndvar.h also.

"seems comprehensive to me" deraadt@ and OK tb@
2016-01-03 14:38:16 +00:00
mestre 0e3a25f04f Remove unused file
Alerted by tb@
2015-12-31 16:54:42 +00:00
mestre 2317ec67b0 Include only needed header files per each source file
OK tb@
2015-12-31 16:50:29 +00:00
mestre 7ad55f5581 Set as __dead a few more functions, that don't return, on games/
With precious tip, help and also OK from tb@
2015-12-26 00:26:39 +00:00
tb 6dd9349555 Cleanup: pwd.h is no longer needed. 2015-12-15 18:40:54 +00:00
tb 54a07f1471 Replace 'arc4random() % range' by 'arc4random_uniform(range)'.
Do this by introducing atcrandom_uniform(range) which returns
deterministic randomness or good randomness depending on whether
a seed was specified with the -r option.

Diff by Matthew Martin, reviewed by deraadt@ and me.

ok deraadt@
2015-12-15 18:39:50 +00:00
jmc 1e9e54e85f adjust width list: Ds is unfortunate here; 2015-11-29 16:04:14 +00:00
tb bf2d39770d Add pledge support and move score file to $HOME.
For high score entries use the same logic as in snake(6) and tetris(6):
Try LOGNAME then USER then getlogin(2) and fall back to ???.
For variety, atc(6) uses flock(2), so add a "flock" promise to the usual
"stdio rpath rpath cpath tty" for games.
2015-11-29 15:23:38 +00:00
deraadt 691147a9d6 Remove operations that "touch" scorefiles at install time. 2015-11-25 23:18:11 +00:00
deraadt ebb0af75bc In 1995, all of the games were setuid games. At end of 1996, I took them all
to setgid games, and we started wittling them down.  Nearly 10 years later I
am removing all setgid from the games.  If any of these have score files they
are now broken, and I hope various folk repair them.  I have argued for years
(and received pushback...) that the score file features must be removed, or
rewritten to use private files, because setgid is the wrong tool.
ok tedu
2015-11-24 03:10:09 +00:00
tb 72a685fd06 Convert hand-rolled option parsing to getopt(3).
ok deraadt@
2015-11-20 16:58:37 +00:00
tedu 33206277fe replace setbuf with setvbuf, from Frederic Nowak 2015-11-04 21:22:10 +00:00
deraadt ca161728cb remove malloc/calloc/realloc* casts, due to stdlib.h being present; ok millert krw 2015-08-22 14:47:40 +00:00
tedu c38a25ace4 convert calloc/realloc pairs to reallocarray 2015-02-18 22:33:51 +00:00
deraadt cceea54a0e Do not memorialize cheaters in the high score file.
from pjanzen
2014-12-09 05:01:14 +00:00
deraadt f84032eda8 For now, these games still contain deterministic randomization (for
save / replay modes of operation that have not yet been cleaned up).
OK, I've let the cat out of the bag, now some of you know you can cheat
at them..
ok millert guenther tedu
2014-12-08 21:56:27 +00:00
schwarze 3430162862 Even though not callable, "Ed" is a macro name, so for clarity,
escape it when it appears on a macro line.
2014-11-30 02:41:43 +00:00
guenther 34278d36bd Eliminate pointless use of <sys/param.h>, <sys/file.h>, <sys/sockio.h>,
and <sys/ttydefaults.h>
Replace MAXPATHLEN with PATH_MAX and MAXLOGNAME with LOGIN_NAME_MAX
Pull in <limits.h> where needed
Prefer sizeof(var) over MAXFOO or FOO_MAX

ok deraadt@
2014-11-16 04:49:48 +00:00
schwarze 27e959701b obvious cases of missing .An;
found with the new mandoc(1) MANDOCERR_AN_MISSING warning;
no text changes
2014-09-08 01:27:54 +00:00
tedu 5b92e02df2 if not seeded explicitly, use arc4random instead. ok deraadt 2014-07-13 14:01:04 +00:00
tedu 54740ad2cd long live BSD, SYSV is dead! 2014-07-13 13:00:40 +00:00
millert 16df4d37c7 start_time should be time_t, not int since it holds the reasult of
time(0).  OK guenther@
2013-10-25 21:57:10 +00:00
deraadt 043fbe51c1 rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable).  these days, people use source.  these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms
2009-10-27 23:59:19 +00:00
ray cf03695a25 Don't assume there will be a newline after calling fgets.
OK millert
2009-06-01 13:04:59 +00:00
chl 1717b5a37e fix format string
ok ray@ gilles@
2007-11-06 10:22:29 +00:00
chl efba6f5083 remove some warnings:
unused variable `variable'
`variable' might be used uninitialized in this function

ok gilles@ ray@
2007-09-14 14:29:20 +00:00
gilles 712678dfc6 use strcspn to properly overwrite '\n' in fgets returned buffer
ok pyr@, ray@, millert@, moritz@, chl@
2007-09-11 15:21:05 +00:00
hshoexer a2f413998b Some more simple malloc(n * m) -> calloc(n, m) conversions.
ok deraadt@
2007-09-04 22:39:31 +00:00
jmc 9490d37cb6 convert to new .Dd format; 2007-05-31 19:19:00 +00:00
sobrado edd3a49935 when updating atc(6) to split the -f and -g flags in two options
I missed synchronizing the usage() function.

problem noticed by jmc@
2007-04-13 13:41:44 +00:00
sobrado 14413b0853 let -f and -g be in different options even if the argument
names to both flags are the same.

spotted by jmc@ with relation to other manual page.

ok by jmc@
2007-04-13 09:13:36 +00:00
jmc 1a5aace370 tidy up synopsis and usage(); from Igor Sobrado 2007-04-02 14:28:56 +00:00
deraadt 060f3221e3 make delayed turn commands not become immediate when there is a
request to go to the same altitude as already at.  pr 3448
2006-11-07 03:52:59 +00:00
ray c0eacc5c98 Check for valid character before truncating string.
Initial patch from Charles Longeau <chl at tuxfamily dot org>.

OK moritz@.
2006-11-02 02:06:05 +00:00