OpenBSD CVS

CVS log for src/games/snake/snake.c


[BACK] Up to [local] / src / games / snake

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.34 / (download) - annotate - [select for diffs], Fri Jun 28 13:32:52 2019 UTC (4 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, HEAD
Changes since 1.33: +2 -2 lines
Diff to previous 1.33 (colored)

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.

Revision 1.33 / (download) - annotate - [select for diffs], Sun Jan 20 04:14:19 2019 UTC (5 years, 4 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.32: +1 -2 lines
Diff to previous 1.32 (colored)

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.

Revision 1.32 / (download) - annotate - [select for diffs], Sun Jan 20 04:12:58 2019 UTC (5 years, 4 months ago) by tedu
Branch: MAIN
Changes since 1.31: +1 -43 lines
Diff to previous 1.31 (colored)

remove some obsolete comments about deleted code

Revision 1.31 / (download) - annotate - [select for diffs], Sun Jan 20 04:10:12 2019 UTC (5 years, 4 months ago) by tedu
Branch: MAIN
Changes since 1.30: +2 -1 lines
Diff to previous 1.30 (colored)

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

Revision 1.30 / (download) - annotate - [select for diffs], Sun Jan 20 04:09:15 2019 UTC (5 years, 4 months ago) by tedu
Branch: MAIN
Changes since 1.29: +7 -3 lines
Diff to previous 1.29 (colored)

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

Revision 1.29 / (download) - annotate - [select for diffs], Fri Aug 24 11:14:49 2018 UTC (5 years, 9 months ago) by mestre
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.28: +5 -4 lines
Diff to previous 1.28 (colored)

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@

Revision 1.28 / (download) - annotate - [select for diffs], Sun Sep 11 14:21:18 2016 UTC (7 years, 9 months ago) by tb
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.27: +2 -1 lines
Diff to previous 1.27 (colored)

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

ok deraadt

Revision 1.27 / (download) - annotate - [select for diffs], Wed Mar 16 15:00:35 2016 UTC (8 years, 2 months ago) by mestre
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.26: +3 -2 lines
Diff to previous 1.26 (colored)

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@

Revision 1.26 / (download) - annotate - [select for diffs], Mon Mar 7 12:07:57 2016 UTC (8 years, 3 months ago) by mestre
Branch: MAIN
Changes since 1.25: +1 -2 lines
Diff to previous 1.25 (colored)

- 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

Revision 1.25 / (download) - annotate - [select for diffs], Tue Feb 9 13:41:59 2016 UTC (8 years, 4 months ago) by mestre
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.24: +7 -7 lines
Diff to previous 1.24 (colored)

- 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

Revision 1.24 / (download) - annotate - [select for diffs], Tue Feb 2 19:18:57 2016 UTC (8 years, 4 months ago) by mestre
Branch: MAIN
Changes since 1.23: +5 -5 lines
Diff to previous 1.23 (colored)

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

OK and help from tb@

Revision 1.23 / (download) - annotate - [select for diffs], Thu Jan 7 16:00:33 2016 UTC (8 years, 5 months ago) by tb
Branch: MAIN
Changes since 1.22: +4 -5 lines
Diff to previous 1.22 (colored)

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@

Revision 1.22 / (download) - annotate - [select for diffs], Mon Jan 4 17:33:24 2016 UTC (8 years, 5 months ago) by mestre
Branch: MAIN
Changes since 1.21: +1 -5 lines
Diff to previous 1.21 (colored)

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

Revision 1.21 / (download) - annotate - [select for diffs], Sun Jan 3 14:38:17 2016 UTC (8 years, 5 months ago) by mestre
Branch: MAIN
Changes since 1.20: +1 -2 lines
Diff to previous 1.20 (colored)

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@

Revision 1.20 / (download) - annotate - [select for diffs], Wed Dec 2 18:52:23 2015 UTC (8 years, 6 months ago) by tb
Branch: MAIN
Changes since 1.19: +2 -3 lines
Diff to previous 1.19 (colored)

KNF: I forgot to join two lines.

Revision 1.19 / (download) - annotate - [select for diffs], Wed Dec 2 18:46:13 2015 UTC (8 years, 6 months ago) by tb
Branch: MAIN
Changes since 1.18: +10 -4 lines
Diff to previous 1.18 (colored)

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

plus fix some ghastly whitespace.

Revision 1.18 / (download) - annotate - [select for diffs], Sun Nov 29 14:31:01 2015 UTC (8 years, 6 months ago) by tb
Branch: MAIN
Changes since 1.17: +10 -6 lines
Diff to previous 1.17 (colored)

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@

Revision 1.17 / (download) - annotate - [select for diffs], Fri Nov 27 09:37:56 2015 UTC (8 years, 6 months ago) by tb
Branch: MAIN
Changes since 1.16: +137 -45 lines
Diff to previous 1.16 (colored)

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@

Revision 1.16 / (download) - annotate - [select for diffs], Sun Nov 16 04:49:49 2014 UTC (9 years, 6 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.15: +2 -3 lines
Diff to previous 1.15 (colored)

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@

Revision 1.15 / (download) - annotate - [select for diffs], Thu Aug 29 20:22:20 2013 UTC (10 years, 9 months ago) by naddy
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.14: +5 -6 lines
Diff to previous 1.14 (colored)

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

Revision 1.14 / (download) - annotate - [select for diffs], Fri Nov 13 21:50:12 2009 UTC (14 years, 7 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.13: +1 -12 lines
Diff to previous 1.13 (colored)

no need for seperate snscore command; ok pjanzen

Revision 1.13 / (download) - annotate - [select for diffs], Tue Oct 27 23:59:27 2009 UTC (14 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.12: +1 -15 lines
Diff to previous 1.12 (colored)

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

Revision 1.12 / (download) - annotate - [select for diffs], Mon Apr 2 15:23:48 2007 UTC (17 years, 2 months ago) by jmc
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.11: +3 -3 lines
Diff to previous 1.11 (colored)

tidy up synopsis and usage(); from Igor Sobrado

Revision 1.11 / (download) - annotate - [select for diffs], Wed Mar 15 17:57:57 2006 UTC (18 years, 3 months ago) by dhill
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1, OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.10: +4 -12 lines
Diff to previous 1.10 (colored)

Remove useless getuid() check.

OK moritz@ jaredy@

Revision 1.10 / (download) - annotate - [select for diffs], Sun May 1 02:43:12 2005 UTC (19 years, 1 month ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.9: +5 -4 lines
Diff to previous 1.9 (colored)

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

Revision 1.9 / (download) - annotate - [select for diffs], Sat Jul 10 07:26:24 2004 UTC (19 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7, OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.8: +21 -35 lines
Diff to previous 1.8 (colored)

more ansi; khalek@linuxgamers.net

Revision 1.8 / (download) - annotate - [select for diffs], Tue Jun 3 03:01:41 2003 UTC (21 years ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5, OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.7: +3 -7 lines
Diff to previous 1.7 (colored)

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999.  Proofed by myself and Theo.

Revision 1.7 / (download) - annotate - [select for diffs], Fri Dec 6 21:48:51 2002 UTC (21 years, 6 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3
Changes since 1.6: +3 -11 lines
Diff to previous 1.6 (colored)

Replace things like srandom(time(NULL)) with srandomdev(3).  random(3)
good enough for games but we should at least use a decent seed.
pjanzen@ OK

Revision 1.6 / (download) - annotate - [select for diffs], Sun Jun 23 03:01:13 2002 UTC (21 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.5: +3 -3 lines
Diff to previous 1.5 (colored)

uid_t and gid_t are unsigned

Revision 1.5 / (download) - annotate - [select for diffs], Sat Feb 16 21:27:11 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.4: +21 -21 lines
Diff to previous 1.4 (colored)

Part one of userland __P removal.  Done with a simple regexp with some minor hand editing to make comments line up correctly.  Another pass is forthcoming that handles the cases that could not be done automatically.

Revision 1.4 / (download) - annotate - [select for diffs], Sun Nov 18 23:53:29 2001 UTC (22 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.3: +15 -7 lines
Diff to previous 1.3 (colored)

move racey shit out of signal handler

Revision 1.3 / (download) - annotate - [select for diffs], Sun Feb 18 16:03:02 2001 UTC (23 years, 3 months ago) by pjanzen
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0, OPENBSD_2_9_BASE, OPENBSD_2_9
Changes since 1.2: +233 -207 lines
Diff to previous 1.2 (colored)

Convert to curses and tidy some.  Generally based on NetBSD changes.

Revision 1.2 / (download) - annotate - [select for diffs], Tue Apr 20 23:01:12 1999 UTC (25 years, 1 month ago) by pjanzen
Branch: MAIN
CVS Tags: OPENBSD_2_8_BASE, OPENBSD_2_8, OPENBSD_2_7_BASE, OPENBSD_2_7, OPENBSD_2_6_BASE, OPENBSD_2_6
Changes since 1.1: +7 -3 lines
Diff to previous 1.1 (colored)

jsm28@cam.ac.uk: place cursor on player, not one over.

Revision 1.1 / (download) - annotate - [select for diffs], Sat Mar 13 02:08:10 1999 UTC (25 years, 3 months ago) by pjanzen
Branch: MAIN
CVS Tags: OPENBSD_2_5_BASE, OPENBSD_2_5

Fix a few bugs (e.g. snake used to miss turns); use usleep() so display
speed is correct on xterms; put snscore functionality inside snake and
make snscore a symbolic link (to be phased out); clean up formatting;
install score file properly; disable the log file by default (logging should
be done through dm).

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.