diff options
| author | nia <nia@NetBSD.org> | 2023-07-01 10:51:35 +0000 |
|---|---|---|
| committer | nia <nia@NetBSD.org> | 2023-07-01 10:51:35 +0000 |
| commit | dc6ca8029fbb6957ec8e6a0e6db1fd953f256eff (patch) | |
| tree | d07d761dc38a9ea1e986426f9f830c8ee74d3e65 /games | |
| parent | cd1138d01c109f76f77de69f466823708ee93e9a (diff) | |
tetris(6): Support the informal standard of allowing setting NO_COLOR
in the environment to disable the use of color. (no-color.org)
Diffstat (limited to 'games')
| -rw-r--r-- | games/tetris/tetris.6 | 9 | ||||
| -rw-r--r-- | games/tetris/tetris.c | 8 |
2 files changed, 14 insertions, 3 deletions
diff --git a/games/tetris/tetris.6 b/games/tetris/tetris.6 index 8b6ca563e49..32915f8c096 100644 --- a/games/tetris/tetris.6 +++ b/games/tetris/tetris.6 @@ -1,4 +1,4 @@ -.\" $NetBSD: tetris.6,v 1.17 2016/03/12 03:14:59 dholland Exp $ +.\" $NetBSD: tetris.6,v 1.18 2023/07/01 10:51:35 nia Exp $ .\" .\" Copyright (c) 1992, 1993 .\" The Regents of the University of California. All rights reserved. @@ -32,7 +32,7 @@ .\" .\" @(#)tetris.6 8.1 (Berkeley) 5/31/93 .\" -.Dd February 18, 2015 +.Dd July 1, 2023 .Dt TETRIS 6 .Os .Sh NAME @@ -146,6 +146,11 @@ name, score, and how many points were scored on what level. Scores which are the highest on a given level are marked with asterisks .Dq * . +.Sh ENVIRONMENT +.Nm +honors the informal standard +.Dv NO_COLOR . +When it is set in the environment, no color will be used. .Sh FILES .Bl -tag -width /var/games/tetris.scoresxx .It /var/games/tetris.scores diff --git a/games/tetris/tetris.c b/games/tetris/tetris.c index 286e7c45501..b8612c2c8fe 100644 --- a/games/tetris/tetris.c +++ b/games/tetris/tetris.c @@ -1,4 +1,4 @@ -/* $NetBSD: tetris.c,v 1.33 2020/07/21 02:42:05 nia Exp $ */ +/* $NetBSD: tetris.c,v 1.34 2023/07/01 10:51:35 nia Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -135,6 +135,7 @@ main(int argc, char *argv[]) int level = 2; #define NUMKEYS 7 char key_write[NUMKEYS][10]; + char *nocolor_env; int ch, i, j; int fd; @@ -182,6 +183,11 @@ main(int argc, char *argv[]) if (argc) usage(); + nocolor_env = getenv("NO_COLOR"); + + if (nocolor_env != NULL && nocolor_env[0] != '\0') + nocolor = 1; + fallrate = 1000000 / level; for (i = 0; i <= (NUMKEYS-1); i++) { |
