Commit Graph

69 Commits

Author SHA1 Message Date
wiz
076a2da7d8 Use Pp (mdoc) instead of sp (roff).
Use An in AUTHORS section.
2015-02-19 08:51:14 +00:00
mrg
2343aabb74 add a 'down' key to tetris, defaulting to 'n'. it move the block down
a line, if it fits.  like most other tetris games have.

minor clean up of magic number usage while here.
2015-02-19 02:27:30 +00:00
wiz
3039a5421b Bump date for -c (exactly one year after previous bump) 2014-07-15 16:17:15 +00:00
pgoyette
990812d69b At suggestion of christos@, use -b for b&w rather than -c 2014-07-13 17:38:38 +00:00
pgoyette
68006fcab2 Provide an option to restore traditional black-and-white mode. 2014-07-13 16:23:55 +00:00
christos
a5d2792650 Add a little color. In order to minimize logic differences, keep 0 as the
empty board value, and since 7 is white, turn white into black (0) when
painting.
2014-06-11 16:47:39 +00:00
dholland
9628f4097a Revert part of previous -r1.21 and fix the errno-handling bug instead. 2014-03-22 19:05:30 +00:00
christos
193b880fad fix unused variable warnings 2013-10-19 17:19:30 +00:00
roy
4060cbcd0c Use tiparm instead of vtparm. 2011-10-03 12:32:15 +00:00
plunky
9f61b80465 NULL does not need a cast 2011-08-31 16:24:54 +00:00
wiz
e78e25aaf3 Fix fd leak in error cases. Found by cppcheck. 2011-01-05 15:48:00 +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
roy
98eb889579 Userland now builds and uses terminfo instead of termcap.
OK: core@, jdc@
2010-02-03 15:34:37 +00:00
ahoka
07b3322423 Hide the cursor during the game. 2009-12-19 19:27:53 +00:00
dholland
6a214fad9e Disable writing scores when built for /rescue. PR 42009 2009-09-08 13:38:01 +00:00
dholland
1e99780e5d sprinkle static 2009-08-12 08:44:45 +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
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
b398836923 sprintf -> snprintf 2009-05-25 00:46:01 +00:00
lukem
2fe2731d3f Remove the \n and tabs from the __COPYRIGHT() strings. 2008-07-20 00:52:39 +00:00
dholland
d4f48e67da Make the default WARNS for games 4. The only game that needs to set WARNS
to anything else now is rogue, so clear WARNS from the other makefiles.
2008-01-28 07:03:58 +00:00
dholland
bded8baaa8 Build with WARNS=4. (All fixes are cosmetic, except that it's definitely
bad karma to shadow a local variable with another of the same name in a
nested block...)
2008-01-28 01:38:59 +00:00
perry
8b0f9554ff convert __attribute__s to applicable cdefs.h macros 2007-12-15 19:44:37 +00:00
perry
36c7456d7c include sys/cdefs.h so that __attribute__ can be fixed later 2007-12-15 16:32:05 +00:00
mrg
fd5635ed7a don't discard const. GCC 4.1-20061021 doesn't like that... 2006-10-22 08:09:24 +00:00
drochner
3f13a4cf7b Better check data read from tetris.scores before use as array indices etc.
This is CVE-2006-1539, files against Gentoo Linux, the patch is from
Gentoo.
A standard NetBSD installation is not as much risk because tetris is
sgid "games", and users shouldn't be in that group.
2006-06-01 16:12:27 +00:00
christos
989c7cd825 Coverity CID 868: Fix possible NULL deref (after INFTIM passes :-) 2006-03-19 00:50:28 +00:00
wiz
d9f5a9df01 Use standard AUTHORS section header. From YOMURA Masanori in private mail
Sort sections if necessary. Use more/better markup.
2005-09-15 02:09:41 +00:00
jsm
cb5fd8342e Remove uses of __P. 2004-01-27 20:30:28 +00:00
agc
e5aeb4ea46 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22269, verified by myself.
2003-08-07 09:36:50 +00:00
kristerw
c5fc68a463 Correct some comments and error messages that still talked about "select".
Solves the last part of PR 18905.
2002-12-29 15:12:17 +00:00
jmmv
0e4487574e Fix a bug in rwait() introduced during the select() to poll() conversion
that caused tetris to crash when pausing the game. Approved by tron.
2002-12-26 20:15:11 +00:00
wiz
c91d8d6b9b Lots of minor fixes resulting from reading these man pages in detail. 2002-09-26 18:31:58 +00:00
mycroft
804a85524e select() -> poll() 2002-09-19 21:12:10 +00:00
wiz
10b0b6bce0 de-register 2002-06-02 22:17:37 +00:00
ross
dc5571b22e Generate <>& symbolically. I'm avoiding .../dist/... directories for now. 2002-02-08 01:21:55 +00:00
christos
1703d1eee6 Update to the new t_agetstr() API. 2001-11-02 18:27:00 +00:00
wiz
834bb1b3ab Whitespace and/or punctuation fixes. 2001-04-02 22:42:37 +00:00
blymn
99bf72c6bb Fix core dump. 2000-05-24 14:43:00 +00:00
blymn
494e4c93a6 Converted games to use the new termcap interface. 2000-05-22 12:42:46 +00:00
jsm
233f519d3d Clean up error reporting in tetris. 2000-01-21 02:10:56 +00:00
jsm
7e681e294b Fix high score table formatting bug.
Bug report and fix from Malcolm Parsons <malcolm@bits.bris.ac.uk>.
2000-01-21 00:54:53 +00:00
jsm
e2dbfa95c5 Declare variables as extern in headers rather than using linker commons. 2000-01-01 10:15:17 +00:00
lukem
88d3d7c59e update after change to return value of tputs() third argument 1999-10-04 23:26:59 +00:00
jsm
20e3305006 Fix -Wsign-compare warnings. 1999-09-18 19:38:46 +00:00
jsm
010f0ab865 Convert tetris to use <err.h> functions. 1999-09-17 20:44:51 +00:00
jsm
5367f3400c Security improvements for games (largely from or inspired by OpenBSD).
Games which run setgid from dm, but don't need to, should drop their
privileges at startup.

Games which have a scorefile should open it at startup, then drop all
privileges leaving just the open writable file descriptor.  If the
game can invoke subprocesses, this should be made close-on-exec.

Games with scorefiles should make sure they do not get a file
descriptor < 3.  (Otherwise, they could get confused and corrupt the
scorefile when using stdin, stdout or stderr.)

Some old setuid revokes from the days of setuid games change into gid
revokes.
1999-09-12 09:02:20 +00:00
jsm
b03d4fa882 Add __noreturn__' and __unused__' attributes where appropriate to
the games.

This merges in all such remaining changes from the Linux port of the
NetBSD games, except in hunt (where substantial changes from OpenBSD
need to be looked at).

Most noreturn attributes were previously added in bin/6144, with some
others that were missed then in bin/8082.  Previous `unused'
attributes were covered in bin/6557, bin/8058 and other PRs (all these
PRs have already been handled and closed).
1999-09-08 21:45:25 +00:00
jsm
092d313019 Add use of `const' where appropriate to the games.
This merges in all such remaining changes from the Linux port of the
NetBSD games, except in hunt (where substantial changes from OpenBSD
need to be looked at).

Some such changes were previously covered in PRs bin/6041, bin/6146,
bin/6148, bin/6150, bin/6151, bin/6580, bin/6660, bin/7993, bin/7994,
bin/8039, bin/8057 and bin/8093.
1999-09-08 21:17:44 +00:00