Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/tetris tetris(6): Support the informal standard of all...



details:   https://anonhg.NetBSD.org/src/rev/1d061abde191
branches:  trunk
changeset: 377221:1d061abde191
user:      nia <nia%NetBSD.org@localhost>
date:      Sat Jul 01 10:51:35 2023 +0000

description:
tetris(6): Support the informal standard of allowing setting NO_COLOR
in the environment to disable the use of color. (no-color.org)

diffstat:

 games/tetris/tetris.6 |  9 +++++++--
 games/tetris/tetris.c |  8 +++++++-
 2 files changed, 14 insertions(+), 3 deletions(-)

diffs (59 lines):

diff -r 0d4d5f2371f0 -r 1d061abde191 games/tetris/tetris.6
--- a/games/tetris/tetris.6     Sat Jul 01 10:47:12 2023 +0000
+++ b/games/tetris/tetris.6     Sat Jul 01 10:51:35 2023 +0000
@@ -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 sc
 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 -r 0d4d5f2371f0 -r 1d061abde191 games/tetris/tetris.c
--- a/games/tetris/tetris.c     Sat Jul 01 10:47:12 2023 +0000
+++ b/games/tetris/tetris.c     Sat Jul 01 10:51:35 2023 +0000
@@ -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++) {



Home | Main Index | Thread Index | Old Index