History log of /openbsd/games/snake/snake.c (Results 1 – 25 of 34)
Revision Date Author Comments
# df69c215 28-Jun-2019 deraadt <deraadt@openbsd.org>

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

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.

show more ...


# 3bce2bd6 20-Jan-2019 tedu <tedu@openbsd.org>

printing the pinball bonus in the corner is confusing when you lose.
just let the bonus happen if it does, players will figure it out.


# 59bfb9d6 20-Jan-2019 tedu <tedu@openbsd.org>

remove some obsolete comments about deleted code


# ae3bacb5 20-Jan-2019 tedu <tedu@openbsd.org>

quick fix to keep the cursor in the corner during space warp.
less distracting this way.


# e87918d7 20-Jan-2019 tedu <tedu@openbsd.org>

if the snake ran over the money, print the treasure instead of empty.
bug noticed by mlarkin


# b9f12921 24-Aug-2018 mestre <mestre@openbsd.org>

Remove a few too early pledge(2)s on games/ and apply them a little bit later
but with much reduced permissions ("stdio tty" if ncurses based and "stdio"
for the ones that only perform basic operatio

Remove a few too early pledge(2)s on games/ and apply them a little bit later
but with much reduced permissions ("stdio tty" if ncurses based and "stdio"
for the ones that only perform basic operations).

There's still a few games that we cannot yet remove their fs access, through
pledge(2), since they open files on demand and too late, this might get
revisited in the future.

OK tb@

show more ...


# ee7acb09 11-Sep-2016 tb <tb@openbsd.org>

Callers of time(3) should #include <time.h>.

ok deraadt


# 45555366 16-Mar-2016 mestre <mestre@openbsd.org>

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'

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@

show more ...


# 6fa5e1da 07-Mar-2016 mestre <mestre@openbsd.org>

- 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 -? an

- 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

show more ...


# 565945af 09-Feb-2016 mestre <mestre@openbsd.org>

- 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 com

- 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

show more ...


# e42da8bd 02-Feb-2016 mestre <mestre@openbsd.org>

- Swap atoi(3) for strtonum(3)
- Swap fputs(3) for fprintf(3)
- Use getprogname(3) instead of hardcoded string

OK and help from tb@


# 17641e31 07-Jan-2016 tb <tb@openbsd.org>

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-decl

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@

show more ...


# 2010f3c8 04-Jan-2016 mestre <mestre@openbsd.org>

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


# 9ea8ec70 03-Jan-2016 mestre <mestre@openbsd.org>

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, earl

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@

show more ...


# fd639cce 02-Dec-2015 tb <tb@openbsd.org>

KNF: I forgot to join two lines.


# 4a0e2eed 02-Dec-2015 tb <tb@openbsd.org>

treat getenv("HOME") safely also when LOGGING is defined. from mestre.

plus fix some ghastly whitespace.


# fa83b613 29-Nov-2015 tb <tb@openbsd.org>

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@


# f527bb56 27-Nov-2015 tb <tb@openbsd.org>

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

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@

show more ...


# 34278d36 16-Nov-2014 guenther <guenther@openbsd.org>

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

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@

show more ...


# 66e49541 29-Aug-2013 naddy <naddy@openbsd.org>

replace srandomdev()+random() with the arc4random*() family
tweaks and ok millert@, ok deraadt@


# fdba1792 13-Nov-2009 deraadt <deraadt@openbsd.org>

no need for seperate snscore command; ok pjanzen


# 043fbe51 27-Oct-2009 deraadt <deraadt@openbsd.org>

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
(th

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

show more ...


# 3e992fd7 02-Apr-2007 jmc <jmc@openbsd.org>

tidy up synopsis and usage(); from Igor Sobrado


# 0c07ef3d 15-Mar-2006 dhill <dhill@openbsd.org>

Remove useless getuid() check.

OK moritz@ jaredy@


# f4878eba 01-May-2005 djm <djm@openbsd.org>

use setresgid() to drop privs, it is simply a better and less ambiguous API;
ok deraadt@ and millert@ a while ago, more to come


12