Module Name: src Committed By: nia Date: Sat Jul 1 10:51:35 UTC 2023
Modified Files: src/games/tetris: tetris.6 tetris.c Log Message: tetris(6): Support the informal standard of allowing setting NO_COLOR in the environment to disable the use of color. (no-color.org) To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/games/tetris/tetris.6 cvs rdiff -u -r1.33 -r1.34 src/games/tetris/tetris.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/games/tetris/tetris.6 diff -u src/games/tetris/tetris.6:1.17 src/games/tetris/tetris.6:1.18 --- src/games/tetris/tetris.6:1.17 Sat Mar 12 03:14:59 2016 +++ src/games/tetris/tetris.6 Sat Jul 1 10:51:35 2023 @@ -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 Index: src/games/tetris/tetris.c diff -u src/games/tetris/tetris.c:1.33 src/games/tetris/tetris.c:1.34 --- src/games/tetris/tetris.c:1.33 Tue Jul 21 02:42:05 2020 +++ src/games/tetris/tetris.c Sat Jul 1 10:51:35 2023 @@ -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++) {