Commit Graph

85 Commits

Author SHA1 Message Date
nia d92552c3ea tetris(6): Support the informal standard of allowing setting NO_COLOR
in the environment to disable the use of color. (no-color.org)
2023-07-01 10:51:35 +00:00
lukem c4b7a9e794 bsd.own.mk: rename GCC_NO_* to CC_WNO_*
Rename compiler-warning-disable variables from
	GCC_NO_warning
to
	CC_WNO_warning
where warning is the full warning name as used by the compiler.

GCC_NO_IMPLICIT_FALLTHRU is CC_WNO_IMPLICIT_FALLTHROUGH

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
2023-06-03 09:09:01 +00:00
rillig 1182a44c59 games: remove trailing whitespace in *.c and *.h 2021-05-02 12:50:43 +00:00
mrg 1ff60d1f84 avoid uninit memory and use memmove vs strncpy for a will be
truncated on purpose string.
2020-09-07 00:31:11 +00:00
mrg 07f014edcb apply ${GCC_NO_FORMAT_TRUNCATION} to scores.c 2020-09-06 10:51:20 +00:00
nia 6ad85e2cf9 tetris: Use arc4random_uniform instead of modulo for better randomness 2020-07-21 02:42:05 +00:00
mrg de11d87641 introduce some common variables for use in GCC warning disables:
GCC_NO_FORMAT_TRUNCATION    -Wno-format-truncation (GCC 7/8)
GCC_NO_STRINGOP_TRUNCATION  -Wno-stringop-truncation (GCC 8)
GCC_NO_STRINGOP_OVERFLOW    -Wno-stringop-overflow (GCC 8)
GCC_NO_CAST_FUNCTION_TYPE   -Wno-cast-function-type (GCC 8)

use these to turn off warnings for most GCC-8 complaints.  many
of these are false positives, most of the real bugs are already
commited, or are yet to come.


we plan to introduce versions of (some?) of these that use the
"-Wno-error=" form, which still displays the warnings but does
not make it an error, and all of the above will be re-considered
as either being "fix me" (warning still displayed) or "warning
is wrong."
2019-10-13 07:28:04 +00:00
mrg 240adcf578 fix the previous. the code was right, just badly formatted before.
should fix infinite loops reported in some cases.
2018-06-24 12:55:36 +00:00
mrg 31c4a0256f fix issues found by GCC 6.4:
battlestar was missing some {} in its insane printf()+puts() usage.
this is a literal code sequence i found:

	printf("The blast catches ");
	printf("the goddess in the ");
	printf("stomach, knocking ");
	puts("her to the ground.");
	printf("She writhes in the ");
	printf("dirt as the agony of ");
	puts("death taunts her.");
	puts("She has stopped moving.");

no lines inserted or removed.

tetris' checkscores() had wrong and missing {} usage.
2018-02-04 08:48:05 +00:00
christos 0fb210a2c1 elide compiler stupidity. 2017-03-20 22:05:27 +00:00
dholland cde3d9a6b5 tetris(6) is not limited to CRT displays. noted by tnn 2016-03-12 03:14:59 +00:00
nat ff18370b0b Center game board on screen. OK from christos@. 2016-03-03 21:38:55 +00:00
christos 099f03595b PR/50411: Rin Okuyama: fix two bugs:
- clear blocks in the 0 row, otherwise the pile up forever.
- black (white) blocks are not shown as "next shape":
2015-11-06 19:53:37 +00:00
nat 305919e320 Fixes color scheme white on black and black on white.
This commit was approved by christos@
2015-07-07 22:53:25 +00:00
dholland cd1ecdeaa3 add -b to usage, from leot 2015-06-13 04:53:13 +00:00
dholland bf0b86145a Fix the list of keys across the bottom so it fits on an 80-column screen
again. Fixes PR 49937.

HI MRG
2015-06-13 04:15:51 +00:00
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