1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-09 22:38:01 -08:00
Commit Graph

1379 Commits

Author SHA1 Message Date
otto
1456f860f6 fix init, from randy hartman; ok tb@ 2016-09-12 14:38:58 +00:00
tb
ee7acb09aa Callers of time(3) should #include <time.h>.
ok deraadt
2016-09-11 14:21:17 +00:00
tb
3a9c9be680 KNF: Break an overlong line. No binary change. 2016-09-11 09:32:47 +00:00
tb
e5fbd3ce79 These games have been broken for the better part of a year, ever since
their setgid bits got removed.  Mark them as such in their manuals.

ok deraadt, help with wording jmc
2016-09-09 15:32:28 +00:00
tb
24605cc5b9 Make build deterministic by not randomizing the datfiles themselves,
random lines are selected on output and that's enough.

From daniel, ok tb
2016-09-02 11:55:24 +00:00
tb
2fde6ebb66 In 32 bits sqrt(val) + 1 can overflow, so some big primes still
aren't recognized as such, for example 18446744073709551577 given
in the commit message of factor.c r1.7 from NetBSD.  Move the
return type of usqrt() from u_int32_t to u_int64_t.

ok guenther, tom, otto
2016-09-01 10:48:38 +00:00
tb
d496e19d11 Fix a bogus comment: "factors of" -> "coprime to". Replace the
nonsensical "if and only iff" with "if and only if" and zap some
trailing whitespace.
2016-08-31 04:48:43 +00:00
jmc
f29510d43f the quotes in "unkempt thoughts" were authored by stanislaw lec,
not stanislaw lem (an easy blunder, i'd say); i've also inserted the "J."
into one of these credits (Stanislaw J. Lec) since all the others have them;

credit to antoni grzymala; diff pockled from netbsd
2016-08-27 14:29:22 +00:00
guenther
ab29a6f472 Pull in <stdio.h> for NULL
ok deraadt@
2016-08-27 03:34:45 +00:00
guenther
ba202854ff Pull in <sys/select.h> for fd_set
Pull in <time.h> for time()

ok deraadt@
2016-08-27 02:11:27 +00:00
guenther
e29f8a1b72 Pull in <sys/select.h> for fd_set
ok deraadt@
2016-08-27 02:06:40 +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
guenther
1614e62e07 Pull in <time.h> for time() and perhaps other functions
ok deraadt@
2016-08-27 02:00:10 +00:00
guenther
f5cc6d1c3e Convert remaining calls to strtoq/strtouq in base with strtoll/strtoull.
Fix a type mismatch in ftp's "page" command and could make transfers restart
at the wrong position.

ok and a ull->ll tweak from natano@, ok tedu@
2016-08-14 18:34:48 +00:00
tb
62b9314c61 Instead of using the floating point square root, use an integer version
of the Newton method from ping.c.  Fixes a rounding issue that caused
failure to factor numbers close to 2^64, e.g. 18446744030759878681.
While there, fix an off by one error that caused 4295360521 to be
reported as a prime.  Issues reported by Paul Stoeber and Michael Bozon.

ok tedu, deraadt
2016-07-11 18:30:21 +00:00
tb
8513344057 Clean up gcc -Wshadow warnings: 'numnames' is public in <term.h>.
'i' shadows the local loop indexing variable of scr_update(), so
no need to rename it. No binary change on amd64.

ok millert
2016-06-10 15:37:09 +00:00
tb
ca027646a6 When eliding a row, clear the invisible row zero, so that no columns
can become unusable during game play.  Same fix was made in NetBSD's
tetris.c -r1.31 by Christos Zoulas almost exactly a year ago.

ok tedu
2016-06-10 13:07:07 +00:00
jmc
faa33665ab for some time now mandoc has not required MLINKS to function
correctly - logically complete that now by removing MLINKS from base;

authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;

ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung
2016-03-30 06:38:40 +00:00
chl
7c30af4852 remove unused variables
ok millert@
2016-03-28 11:49:45 +00:00
guenther
5f13b87e98 Instead of creating a socket with socket() or accept() and then
setting the O_NONBLOCK flag on it with fcntl(F_SETFL) afterwards,
just pass SOCK_NONBLOCK to socket() or accept4() and get it right
to begin with.

ok millert@ krw@ beck@ deraadt@ jca@
2016-03-21 00:49:36 +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
mestre
64f0fa1112 execl(3) calls must have the last argument casted to (char *)NULL
At the time when this was commited me and tb@ discussed that it shouldn't be
changed, but still snucked in within a larger diff that we didn't notice.

OK tb@
2016-03-15 19:56:20 +00:00
mestre
7bda4eb305 - ranf() and franf() are prototyped on trek.h but ranf.c doesn't include it so
do it
- Replace random() >> 5 by only random(): this was discussed a few months ago
and naddy@ said at the time "Those games were originally written with the
rand(3) function. The lower bits returned by rand(3) suffered from notoriously
poor randomness, so this idiom developed where people would use the higher,
more random bits."

OK tb@ after his remarks
2016-03-08 18:43:47 +00:00
mestre
400fe323ee Headers cleanup with and OK tb@
This was prompted by an initial patch sent by Edgar Pettijohn
<edgar ! pettijohn-web.com> but the actual commit is different
2016-03-08 10:48:39 +00:00
tb
187181395a eliminate do_malloc() and do_free().
These are wrappers for malloc(3) and free(3) with NULL checks. do_free()
is pointless since free() already checks for NULL.  do_malloc() is used
only three times, once asprintf(3) seems more appropriate, and for just
two calls the benefit of a custom wrapper is minimal.

ok millert@
2016-03-07 22:49:45 +00:00
tb
6e9facee12 Remove unused fields posfile and was_pos_file from FILEDESC and
simplify is_fortfile() accordingly.
The last use of them was guarded by OK_TO_WRITE_DISK, which was
unifdef'ed in revision 1.43 last fall.

tweak + ok mestre@
2016-03-07 19:49:38 +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
tb
01623c91aa Convert a hand-rolled strtonum to a call to strtonum(3). This prevents
integer overflow on bogus input and bizarre error messages. Moreover,
fortune files can now be named anything except names matching the regex
^[0-9][0-9.]*%$

ok mestre@
2016-03-05 11:06:43 +00:00
tb
c47f841b47 KNF: wrap three overly long lines. No binary change. 2016-03-05 07:47:15 +00:00
mestre
11b125a3b6 - Convert atoi(3) to strtonum(3)
- Replace hardcoded program string by getprogname(3)
- Remove '?' from getopt(3)'s switch default case (but still keep 'h')

OK tb@ after his suggestions
2016-03-04 14:37:28 +00:00
tim
bd0a94d497 Fix score file name 2016-03-02 17:51:28 +00:00
tb
c14c4b255d Add back undocumented -h switch defaulting to usage().
pjanzen@ correctly pointed out that a majority of games do
this, so no need to deviate here.
2016-02-28 06:24:06 +00:00
tb
c313931887 Untangle a mess of nested ternary operators.
ok mestre@
2016-02-27 12:48:14 +00:00
mestre
8a3966029b - Remove -h and -? from getopt(3), they weren't documented on manpage anyway
- Replace hardcoded string "hangman" by getprogname(3)

OK tb@
2016-02-26 21:27:07 +00:00
mestre
dd8b6bb44a - Convert atoi(3) to strtonum(3)
- Remove lint-style comment
- Remove usage() since errors are now more informative (the usage is still
available in the manpage)

With this diff I made it accept 0 as rotation whereas before it didn't, but
alas if you use 0 then it defeats the whole purpose of the game.

Initial diff sent by Peter Williams <peterbw at gmail.com>, tweaked by me and
several hints and OK by tb@. I'm in desperate need of a coffee, thank you tb@
for making me notice that!
2016-02-26 12:10:49 +00:00
mestre
565945af99 - Remove parameter fd from snscore() since it's never used
- And while here, fwrite(3) returns size_t whereas nscores is an int, so cast
nscores to u_int. This is a false positive, but silences a compiler warning
with -Wextra -pedantic

tb@ : "Looks ok to me" after suggestion from him
2016-02-09 13:41:59 +00:00
mestre
e42da8bde8 - Swap atoi(3) for strtonum(3)
- Swap fputs(3) for fprintf(3)
- Use getprogname(3) instead of hardcoded string

OK and help from tb@
2016-02-02 19:18:57 +00:00
gsoares
b1512104e5 - optarg and optind are declared by unistd.h, so remove them...
- use strtonum rather than atoi
- zap case '?' in getopt(3) switch
- use _exit(2) in signal handler
- use __progname in usage() instead of hardcoded name

OK tb@ mestre@
2016-01-27 13:42:08 +00:00
mestre
ab0a4ae52b Remove unused header 2016-01-25 21:17:45 +00:00
sthen
fa195fe752 Teach morse(6) the <AC> prosign as '@', as added on May 24, 2004 (the
160th anniversary of the first public Morse telegraph transmission).

Support decoding (only; not encoding) of other prosigns, including <SK>
as we were previously using for '@'.  From pjanzen.
2016-01-19 23:21:26 +00:00
sthen
0de85c04ad There are now distinct codes for left and right parentheses.
Part of a diff that was ok tb@ abieber@ deraadt@
2016-01-18 11:27:19 +00:00
sthen
626e1189e8 Add a reference to the current ITU Morse code document.
Part of a diff that was ok abieber tb -.. . .-. .- .- -.. -;
other part being revised with pjanzen.
2016-01-18 11:24:44 +00:00
gsoares
21d5e03efd there's a resource leak here. missing a fclose(3) to kill the stream.
OK deraadt@ mestre@
2016-01-13 13:10:26 +00:00
mestre
8ae737b14e #ifdef QUEST then a few functions won't work, because of that include
<stdlib.h> if we are on a QUEST

OK tb@
2016-01-10 15:12:20 +00:00
mestre
7dd160a593 Remove needless casts to (char *) NULL. Some were kept, namely for execl(3)
last arguments since "The list of arguments must be terminated by a null
null pointer" of type char *

Suggested by and OK tb@
2016-01-10 14:10:38 +00:00
mestre
7e027cb7af As per style(9), remove remaining lint-style comments from games/
OK tb@
2016-01-10 13:35:09 +00:00
mestre
80cf6802c4 Remove unnecessary headers
OK tb@
2016-01-10 13:18:07 +00:00
mestre
6acf840eb1 Remove several casts to (char *) 0 and replace them by NULL
Prompted and OK by tb@
2016-01-09 21:54:11 +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
mestre
aed906e4b2 This diff is rather large, but it's just simply removing unnecessary headers
, remove some lint-style comments, add missing void to functions without args,
also some function prototypes (extern) were missing their args, so I added them
as they were defined in hack.h

OK tb@ on separate diffs
2016-01-09 18:33:15 +00:00
mestre
5c1af24d78 ANSIfy gomoku(6) and change a char* to u_char*
OK tb@
2016-01-08 21:38:33 +00:00
mestre
747bd22203 ANSIfy sail(6) plus some cleanup
OK tb@
2016-01-08 20:26:33 +00:00
mestre
96822cf7b9 Headers clean up 2016-01-08 20:23:54 +00:00
mestre
44d3f3fb69 Remove unnecessary headers an sort 2016-01-08 20:19:06 +00:00
mestre
ab8b84f49d Straightforward headers cleanup 2016-01-08 20:15:15 +00:00
mestre
211c418389 ANSIfy monop(6)
OK tb@
2016-01-08 18:20:33 +00:00
mestre
91d732828b Headers cleanup and removal where suitable
OK tb@
2016-01-08 18:19:47 +00:00
mestre
56f9a7dc4a ANSIfy mille(6)
OK tb@
2016-01-08 18:09:59 +00:00
mestre
182ed36cc5 Headers cleanup and also the following:
mille.h:
#define CTRL locally, which is used by move.c and misc.c, to avoid including
termios.h or sys/ttydefaults.h where it's actually defined

varpush.c:
Change _PATH_DEVNULL to "/dev/null" since other systems may not have it defined
but also avoids including <paths.h>

Included a few sugestions from tb@ who also gave his OK
2016-01-08 18:05:58 +00:00
tb
95d0ce2685 add missing 'void'
ok mestre@
2016-01-08 13:40:05 +00:00
tb
8a9ce47a2b Structural integrity hasn't improved in over twenty years.
ok mestre@
2016-01-08 13:33:42 +00:00
mestre
0f16a76c9f ANSIfy hunt(6)
Note: casted 2 args to struct sockaddr * on list.c to shut off compiler
warnings, and also changed an int len to socklen_t since recvfrom(2) receives
the last argument as the latter.

I'm running out of credits, but this was once again with great help and OK from
tb@
2016-01-07 21:37:53 +00:00
mestre
9ef4854330 Headers cleanup and sorting
OK tb@
2016-01-07 21:29:31 +00:00
millert
7146b7ce3e hack expects to be able to read ^Z as a normal character so disable
SUSP in the termios settings.  Presumably this is how things worked
before the conversion to termios.  Fixes suspend/resume in hack.
2016-01-07 18:25:52 +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
11da2480c6 ANSIfy trek(6)
Note: Binary change is introduced due to function schedule() where its args are
(int,double,char,char,char), but on trek.h are (int,double,int,int,int). Changed
to the latter since the 3 last args are coordinates.

OK tb@
2016-01-07 14:37:51 +00:00
mestre
48b4d137c7 Remove unnecessary headers and sort the remaining alphabetically
OK tb@
2016-01-07 14:30:32 +00:00
mestre
d39a14bb10 Forgot to remove this file on my previous commit 2016-01-06 14:32:14 +00:00
mestre
010ae45bb5 Remove unnecessary header files from phantasia(6)
Lesson learnt: don't include an header sorted alphabetically just because. The
external definition of variables was done on phantglobs.h but their declaration
was on phantstruct.h and therefore the latter must be included before the
former. It's easier to just include phantstruct.h inside phantglobs.h since it
always need it.

With help and OK from tb@
2016-01-06 14:28:09 +00:00
tb
85d02bc06c ansify
ok mestre@
2016-01-06 10:28:38 +00:00
tb
6b45e2a858 Last step of ansification of phantasia:
Convert function() to function(void).

ok mestre@
2016-01-06 09:43:26 +00:00
tb
f0d3161e56 Ansify the bulk of phantasia. No binary change on amd64. Based
on an older diff by mestre.

ok mestre@
2016-01-06 09:39:51 +00:00
tb
d973fa72ce Ansify map.c.
ok mestre@
2016-01-06 09:29:34 +00:00
tb
65e3e2c50a Use return instead of exit from main.
ok mestre@
2016-01-06 09:24:38 +00:00
mestre
2010f3c835 More cleanup and sorting on header section
OK tb@ and he also pointed out that for consistency with rest of the tree we
should include termios.h instead of sys/ttydefaults.h, where applicable
2016-01-04 17:33:24 +00:00
mestre
bdf3894f0c More headers removal and sorted the remaining alphabetically.
Most noticeable that were removed are sys/types.h which will be included from
stdlib.h and in turn also brings along sys/cdefs.h. The other one is limits.h
that was used with the old idiom (denom * random() / LONG_MAX), although it was
only removed were applicable (some files still need that header).

OK tb@
2016-01-04 11:58:35 +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
tedu
43a866b79e don't declar main. from Michal Mazurek 2016-01-01 15:56:03 +00:00
mestre
f741f25ef3 Include only needed header files per each source file
This one was also OK'ed by tb@
2015-12-31 18:10:19 +00:00
mestre
ea24c44aa7 Include only needed header files per each source file
OK tb@
2015-12-31 17:51:19 +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
39ac0be569 Include only needed header files per each source file
OK tb@
2015-12-31 16:44:21 +00:00
mestre
5122c2800b Include only needed header files per each source file
With help and OK from tb@
2015-12-31 15:20:36 +00:00
tb
d9138424f2 Michal Mazurek pointed out on tech@ that the factor.6 manual needs a bit
of clarification.  Thus, express the description both more concisely and
more precisely.  Drop details about spaces in the output formatting.
While there, update the corresponding comment in the source code.

With input from jmc@ and mestre@; detailed discussion with sobrado@.

ok sobrado@
2015-12-30 14:07:53 +00:00
tb
3c9e3b93e0 Build most of games/ with -Werror-implicit-function-declaration.
Prompted by benno's addition of the flag to most of usr.sbin/.

ok benno@
2015-12-28 20:55:55 +00:00
jmc
a5227f0bfd update the us army democracy excerpt to more closely
match the format of the original;

from andre smagin
2015-12-28 12:32:12 +00:00
jmc
424c5ce6b8 andy finkel confimed himself as the originator of the rigged demo quote;
from netbsd pr 49451
2015-12-28 08:36:10 +00:00
chl
3fc7680a4e remove unused variables
ok mmcc@
2015-12-27 01:28:02 +00:00
chl
df06dc93d0 remove unused variable
ok tb@
2015-12-27 01:24:27 +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
gsoares
d73a3bc6bc - use strtonum(3) instead of atoi(3)
- while here switch main() to return instead of exit(3), makes stack protector happy.

OK tb@
2015-12-25 23:41:43 +00:00
mestre
f0628b46ae Declare usage() functions as __dead void, if they don't return, on games section.
Found another one in arithmetic(6) which also didn't return, and removed a function from number(6) which is not used anymore.

OK tb@
2015-12-25 20:59:09 +00:00
mestre
cd84dbda79 Apply some more KNF to the declaration of functions, but keep style to the rest of code for now.
OK tb@
2015-12-25 03:20:57 +00:00
tb
15d5404dbf Function prototypes and a little bit of KNF.
Committing on behalf of mestre@ who has more to come.
2015-12-24 16:55:13 +00:00
tb
da03d969c4 KNF: add a missing space after an 'if'. 2015-12-18 18:47:56 +00:00
tb
466e81dfe1 Use __progname instead of hand-rolled parsing of argv[0].
Inspired by similar diffs by tobias@ and millert@.

"I like the concept" pjanzen@
ok tedu@
2015-12-16 14:21:50 +00:00
tb
48aa608063 Use __progname instead of hand-rolled parsing of argv[0].
Inspired by similar diffs by tobias@ and millert@.

"I like the concept" pjanzen@
ok tedu@
2015-12-16 14:16:27 +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
jsg
6b024eb539 include err.h for err() 2015-12-09 02:00:40 +00:00
tobias
dab586c435 Use __progname instead of manually handling argv[0].
ok deraadt, mmcc, tedu
2015-12-06 12:00:16 +00:00
tb
43b9874dbc pledge "getpw" is not needed here.
ok semarie@
2015-12-06 11:22:37 +00:00
tb
da74d77a50 Treat quiz the same way as the other games and try to preserve the look
and feel.  Revert previous and allow the pager with pledge "proc exec".
Play the game with pledge "stdio rpath".

Discussed with tedu@
2015-12-06 09:55:58 +00:00
tb
23d7e0c886 add missing #include "hack.h" 2015-12-05 13:37:43 +00:00
tb
98e40f6899 Tweak alignment of ENVIRONMENT and FILES.
Use sentence format for the highscore file, too.

Discussed with jmc@
2015-12-04 19:46:04 +00:00
jmc
05ea1278d2 put FILES into a similar format as ENVIRONMENT; 2015-12-04 19:21:26 +00:00
tb
d3431a599d cleanup: remove pwd.h, delete a stray comment and a const qualifier 2015-12-04 17:34:40 +00:00
tb
87b7d5d4a1 Drop pledge("getpw") and pwd.h and use the now usual
LOGNAME -> USER -> getlogin() -> ??? fallback
in the score file, as requested by tedu@

Man page bits adapted from jmc@'s tweaks to snake.6
2015-12-04 16:40:09 +00:00
tedu
c11bd13a73 assume modern curses and unifdef ancient feature tests 2015-12-04 10:41:35 +00:00
tb
091d139da5 Drop the argument passing between backgammon and teachgammon.
It's broken.  Instead, make -d imply -n.  You're supposed to
know the rules before you start tweaking them.

Issue reported by and ok pjanzen@
Patient help with the manual jmc@
2015-12-02 20:05:01 +00:00
tb
fd639ccef0 KNF: I forgot to join two lines. 2015-12-02 18:52:23 +00:00
tb
4a0e2eed87 treat getenv("HOME") safely also when LOGGING is defined. from mestre.
plus fix some ghastly whitespace.
2015-12-02 18:46:13 +00:00
tb
c5e67ec545 add const and remove unused variable.
from mestre.
2015-12-02 18:34:10 +00:00
tb
1152c6e6e1 Make sure "exec" rights are dropped asap in all code paths.
The game also needs "wpath cpath" for supporting the score file,
so add those.
2015-12-01 07:43:30 +00:00
tb
1f22a2a091 Answering "yes" to the question "Do you want to see the rules of the game?"
execs teachgammon.  Allow this and drop this pledge afterward.

Spotted by Paul Janzen, thanks!
2015-12-01 00:31:46 +00:00
schwarze
d6d428c736 delete useless BUGS section; patch from Jan Stary <hans at stare dot cz> 2015-11-30 16:53:39 +00:00
tb
56e43436ce last but not least: add pledge for wump(6)
one more of those games which fork a pager with instructions, so first
pledge "stdio rpath proc exec", then drop to pledge "stdio" afterwards.
2015-11-30 09:00:02 +00:00
tb
f01d2bc3df pledge "stdio rpath wpath cpath" for this one. 2015-11-30 08:55:26 +00:00
tb
0a5000655c primes only needs pledge "stdio". 2015-11-30 08:53:53 +00:00
tb
2751bcea94 The usual deal for a curses game with the possibility of saving a game:
pledge "stdio rpath wpath cpath tty"
2015-11-30 08:49:06 +00:00
tb
81b3eda1fe unspectacular pledge "stdio rpath tty" for grdc 2015-11-30 08:46:07 +00:00
tb
24c4b92ed4 straightforward pledge "stdio rpath wpath cpath tty" for gomoku 2015-11-30 08:44:51 +00:00
tb
95ae2554fc slightly interesting pledge for fish:
start with "stdio rpath proc exec" since it pipes instructions to a pager
afterwards "stdio" is enough
2015-11-30 08:42:03 +00:00
tb
9ba11e5c36 pledge "stdio rpath wpath cpath tty" for canfield
pledge "stdio rpath" for cfscores

made possible by Ricardo Mestre's earlier work
2015-11-30 08:38:13 +00:00
tb
efef3032b3 pledge "stdio rpath tty" for bs 2015-11-30 08:33:29 +00:00
tb
02cc2a4e8b pledge "stdio rpath tty" for boggle.
skip mkdict and mkindex for now, they aren't installed anyway.
2015-11-30 08:27:46 +00:00
tb
87f25a4abf Pledge for backgammon and teachgammon.
Both are straightforward "stdio rpath tty" programs; teachgammon
exec's backgammon at the end, so give it "exec" in addition.

While there, ANSIfy
2015-11-30 08:19:25 +00:00
tb
a75265e181 Straightforward pledge "stdio rpath wpath cpath" for adventure.
It is possible to make it finer grained, but try to keep it
simple for now.
2015-11-30 08:14:48 +00:00
jmc
e8dcef998f tidy here too; 2015-11-29 16:05:38 +00:00
jmc
1e9e54e85f adjust width list: Ds is unfortunate here; 2015-11-29 16:04:14 +00:00
jmc
121e37575f tidy up ENVIRONMENT and FILES; 2015-11-29 15:58:38 +00:00
tb
c425f3ea0e Move score file to $HOME and add pledge "stdio rpath wpath cpath".
For high score entries, try LOGNAME, then USER, then getlogin() then
fall back to ???.
2015-11-29 15:31:06 +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
tb
e224588fb3 Move scorefile to $HOME. The nice implementation of the score file
depends on getpwuid(), so add "getpw" to the rest of the required
pledges: "stdio rpath wpath cpath tty".
2015-11-29 15:13:19 +00:00
tb
6c53a56d23 pledge "stdio rpath tty proc exec" since instructions() might fork a pager.
actual game place takes place with "stdio tty".

OK deraadt@ on an earlier version
2015-11-29 14:42:36 +00:00
tb
fa83b6130f Prefer $LOGNAME over $USER, since the latter is deprecated,
see environ(7).  Pointed out by millert@.  Fall back to getlogin(2)
before defaulting to ???.

looks good to deraadt@
2015-11-29 14:31:01 +00:00
tb
f527bb5663 Fix after removal of the setgid bit:
Add pledge "stdio rpath wpath cpath tty".
Move score file to $HOME, add $USER as high score entry.
Maintain hall of fame of 10 high scores, make snake wink if
it ate you while you were eligible for eternal fame.

Based on an initial diff by Ricardo Mestre and with helpful input from tedu@.

ok beck@
2015-11-27 09:37:56 +00:00
tb
a846715f27 Fix copy-paste error in scorefile name
From Ricardo Mestre
2015-11-26 14:43:18 +00:00
tb
1cf6a71907 Add checks for getenv(), snprintf() and getlogin().
From Ricardo Mestre (up to a small tweak).  Thanks!
2015-11-26 13:28:22 +00:00
tb
0f70ac25c7 Add missing checks for getenv() and snprintf()
From Ricardo Mestre, thanks!
2015-11-26 13:24:30 +00:00
deraadt
691147a9d6 Remove operations that "touch" scorefiles at install time. 2015-11-25 23:18:11 +00:00
tb
4c4ddf9345 Remove now unused gid_t variable.
From Ricardo Mestre.  Thanks!

go for it!  deraadt@
2015-11-25 16:19:05 +00:00
tb
ca7aa068af The scorefile is hidden.
From Ricardo Mestre, thanks!
2015-11-25 16:15:06 +00:00
tedu
e10665cf08 repair lseeks, from Ricardo 2015-11-24 16:54:22 +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
tedu
e1edfc7be0 change score file name to .cfscores so it's not taking up valuable space
in my home directory of serious business files
2015-11-24 02:53:39 +00:00
tedu
7e0a668373 move score files to home directory and drop setgid. from Ricardo Mestre 2015-11-24 02:51:50 +00:00
deraadt
db911c4702 pledge the wyrms 2015-11-21 05:29:42 +00:00
deraadt
e25b81396d pledge "stdio rpath wpath cpath"
from Ricardo Mestre
2015-11-21 03:20:30 +00:00
tb
72a685fd06 Convert hand-rolled option parsing to getopt(3).
ok deraadt@
2015-11-20 16:58:37 +00:00
tb
8f55f2bb60 pledge "stdio rpath wpath cpath tty"
"stdio rpath tty" for game play
"rpath wpath cpath" for maintaining highscores in $USER

ok deraadt@ sthen@
2015-11-20 07:40:23 +00:00
tedu
df1ad1934e remove setgid flag.
in turn, move score files into user's home directory.
will let theo buehler continue with a smaller pledge set.
2015-11-17 15:27:24 +00:00
jmc
a7a0269383 fix a double space issue in the following, rather wonderful, fortune:
On two occasions I have been asked [by members of Parliament!], `Pray,
Mr. Babbage, if you put into the machine wrong figures, will the right
answers come out?'  I am not able rightly to apprehend the kind of
confusion of ideas that could provoke such a question.
		-- Charles Babbage
2015-11-15 21:25:50 +00:00
deraadt
f24baa2d48 creat() -> open equiv; from Frederic Nowak 2015-11-11 01:12:09 +00:00
deraadt
37753c2d3b another open(path, 0)... 2015-11-10 15:29:11 +00:00
deraadt
574fb2a2db pledge "stdio rpath" at the top. (Ricardo's 2nd chunk which reduces
further is not placed right, so I ignored it for now)
from Ricardo Mestre
2015-11-10 14:56:50 +00:00
deraadt
7f87976609 replace open(path, 0) with open(path, O_RDONLY). amazing to still find
sloppiness like this.
2015-11-10 14:50:04 +00:00
tedu
677829b8e4 delete unused code that won't let you play if the load is too high 2015-11-05 23:16:44 +00:00
guenther
ec99312f72 ctype functions take unsigned char values.
Fix redrawing of the challenge cube (-c option) when <esc>word is used.

ok mmcc@
2015-11-05 08:40:34 +00:00
tedu
33206277fe replace setbuf with setvbuf, from Frederic Nowak 2015-11-04 21:22:10 +00:00
tedu
5e0221f546 just dump the help on stdout with messing about with a pager.
makes pledge much simpler.
from jan stary
2015-10-25 09:34:49 +00:00
mmcc
75766ddb8a Cast toupper()'s argument to unsigned char.
ok guenther@
2015-10-24 18:51:40 +00:00
mmcc
cb40a3d352 Cast ctype functions' argument to unsigned char.
ok guenther@
2015-10-24 18:49:39 +00:00
mmcc
9c23307a93 Cast ctype functions' argument to unsigned char.
ok guenther@
2015-10-24 18:39:05 +00:00
mmcc
c5ce2e852f Cast ctype functions' argument to unsigned char.
ok guenther@
2015-10-24 18:37:23 +00:00
mmcc
e782249f09 Cast ctype functions' argument to unsigned char.
ok guenther@
2015-10-24 18:35:08 +00:00
mmcc
07f8b41afc Cast ctype functions' argument to unsigned char.
ok guenther@
2015-10-24 18:33:22 +00:00
mmcc
8b4d100e4c Cast ctype functions' argument to unsigned char.
ok guenther@
2015-10-24 18:29:15 +00:00
mmcc
5eb74ca34f Cast ctype functions' arguments to unsigned char.
ok guenther@
2015-10-24 18:26:13 +00:00
mmcc
4f56e6a4e1 Cast ctype functions' argument to unsigned char.
ok guenther@
2015-10-24 18:16:40 +00:00
mmcc
037a1c83c4 Cast ctype functions' arguments to unsigned char.
ok guenther@
2015-10-24 18:14:09 +00:00
mmcc
1c1551e9c1 Cast ctype functions' arguments to unsigned char.
ok guenther@
2015-10-24 18:10:47 +00:00
mmcc
3618010ad0 Cast ctype functions' arguments to unsigned char.
ok guenther@
2015-10-24 18:04:06 +00:00
mmcc
4d3914505f Cast isdigit()'s argument to unsigned char.
ok guenther@
2015-10-24 18:02:28 +00:00
mmcc
e6743bfe73 Cast isdigit()'s argument to unsigned char.
ok guenther@
2015-10-24 17:56:42 +00:00
mmcc
672e4212ce Cast islower()'s argument to unsigned char.
ok guenther@
2015-10-24 17:55:02 +00:00
mmcc
d02bbd4a61 Cast ctype functions' arguments to unsigned char.
ok guenther@
2015-10-24 17:51:59 +00:00
mmcc
0d35e948a8 Cast isprint()'s argument to unsigned char.
ok guenther@
2015-10-24 17:48:36 +00:00
mmcc
3d31ecf887 Cast toupper()'s argument to unsigned char.
ok guenther@
2015-10-24 17:46:19 +00:00
mmcc
85255e44cb Cast ctype functions' arguments to unsigned char.
ok guenther@
2015-10-24 17:44:49 +00:00
mmcc
8a7637b1dd Cast ctype functions' arguments to unsigned char.
ok guenther@
2015-10-24 17:43:28 +00:00
mmcc
8a97e63eab Cast ctype functions' arguments to unsigned char.
ok guenther@
2015-10-24 17:40:38 +00:00
mmcc
a0a49686e0 Cast isdigit()'s argument to unsigned char.
ok guenther@
2015-10-24 17:37:56 +00:00
mmcc
02fcf05ac9 Cast isalpha()'s argument to unsigned char.
ok guenther@
2015-10-24 17:36:06 +00:00
mmcc
3c57379406 Cast isblank()'s argument to unsigned char.
ok guenther@
2015-10-24 17:34:16 +00:00
mmcc
0cc1293efb Cast isdigit()'s argument to unsigned char.
ok guenther@
2015-10-24 17:33:05 +00:00
mmcc
8059d61abf Cast isblank()'s argument to unsigned char.
ok guenther@
2015-10-24 17:31:00 +00:00
mmcc
866f718f2d Cast toupper()'s argument to unsigned char.
ok guenther@
2015-10-24 17:29:03 +00:00
mmcc
2c2460a1ae Cast islower()'s argument to unsigned char.
ok guenther@
2015-10-24 17:27:06 +00:00
mmcc
9981a40bd6 Cast islower()'s argument to unsigned char.
ok guenther@
2015-10-24 17:23:14 +00:00
mmcc
01869f2877 Cast ctype functions' arguments to unsigned char.
ok guenther@
2015-10-24 17:20:17 +00:00
mmcc
057b7905c4 Cast ctype functions' arguments to unsigned char.
ok guenther@
2015-10-24 17:13:27 +00:00
jsg
b2fea133cf include err.h for err() calls added with recent pledge commits. 2015-10-23 02:01:15 +00:00
doug
4001b1c3f4 Pledge "stdio rpath tty" for hangman(6).
Patch submitted by Ricardo Mestre <serial@helheim.mooo.com>

ok semarie@
2015-10-22 05:28:42 +00:00
tobias
2f95621a47 Disable !-command to escape to a shell. You are supposed to play, press
^Z, or open up another terminal if there is something else to do.

ok deraadt
2015-10-16 07:37:46 +00:00
doug
673e924c36 Pledge "stdio" for simple games.
ok semarie@
2015-10-14 08:12:12 +00:00
semarie
20b80e920a enable pledge(2) in rain(6)
it is libcurses program: at init it needs "stdio rpath getpw tty", and after
drop to just "stdio tty". "tty" is needed at end for restoring the tty.

initial patch from doug@
ok doug@ deraadt@
2015-10-14 07:19:23 +00:00
doug
3ef98285c6 Pledge that arithmetic only takes "stdio". 2015-10-10 22:32:55 +00:00