summaryrefslogtreecommitdiffstats
path: root/tetris
diff options
context:
space:
mode:
authorpgoyette <pgoyette@NetBSD.org>2014-07-13 16:23:55 +0000
committerpgoyette <pgoyette@NetBSD.org>2014-07-13 16:23:55 +0000
commitc1575446b4355046bd6cf7f905cab749762c5306 (patch)
treeea23e632dcea07b44f53789c1b8572cab84fa207 /tetris
parentd50718e53412f5ea2897755a7841ac38a58256f5 (diff)
downloadbsdgames-darwin-c1575446b4355046bd6cf7f905cab749762c5306.tar.gz
bsdgames-darwin-c1575446b4355046bd6cf7f905cab749762c5306.tar.zst
bsdgames-darwin-c1575446b4355046bd6cf7f905cab749762c5306.zip
Provide an option to restore traditional black-and-white mode.
Diffstat (limited to 'tetris')
-rw-r--r--tetris/screen.c4
-rw-r--r--tetris/tetris.69
-rw-r--r--tetris/tetris.c8
-rw-r--r--tetris/tetris.h3
4 files changed, 18 insertions, 6 deletions
diff --git a/tetris/screen.c b/tetris/screen.c
index 50a019d3..4d7911c6 100644
--- a/tetris/screen.c
+++ b/tetris/screen.c
@@ -1,4 +1,4 @@
-/* $NetBSD: screen.c,v 1.28 2014/06/11 16:47:39 christos Exp $ */
+/* $NetBSD: screen.c,v 1.29 2014/07/13 16:23:55 pgoyette Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -98,6 +98,8 @@ static void
setcolor(int c)
{
char *buf;
+ if (nocolor == 1)
+ return;
if (set_a_foreground == NULL)
return;
diff --git a/tetris/tetris.6 b/tetris/tetris.6
index 04eca0d7..e68659e7 100644
--- a/tetris/tetris.6
+++ b/tetris/tetris.6
@@ -1,4 +1,4 @@
-.\" $NetBSD: tetris.6,v 1.11 2005/09/15 02:09:42 wiz Exp $
+.\" $NetBSD: tetris.6,v 1.12 2014/07/13 16:23:55 pgoyette Exp $
.\"
.\" Copyright (c) 1992, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -40,7 +40,7 @@
.Nd the game of tetris
.Sh SYNOPSIS
.Nm
-.Op Fl ps
+.Op Fl cps
.Op Fl k Ar keys
.Op Fl l Ar level
.Sh DESCRIPTION
@@ -73,6 +73,11 @@ quit
.Pp
The options are as follows:
.Bl -tag -width indent
+.It Fl c
+By default, shapes are displayed colorfully if the user's CRT supports color.
+The
+.Fl c
+option can be used to restore the traditional black-and-white behavior.
.It Fl k
The default control keys can be changed using the
.Fl k
diff --git a/tetris/tetris.c b/tetris/tetris.c
index 9ccaa2f4..3c0d6afe 100644
--- a/tetris/tetris.c
+++ b/tetris/tetris.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tetris.c,v 1.25 2014/06/11 16:47:39 christos Exp $ */
+/* $NetBSD: tetris.c,v 1.26 2014/07/13 16:23:55 pgoyette Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -73,6 +73,7 @@ gid_t gid, egid;
char key_msg[100];
int showpreview;
+int nocolor;
static void elide(void);
static void setup_board(void);
@@ -144,8 +145,11 @@ main(int argc, char *argv[])
keys = "jkl pq";
- while ((ch = getopt(argc, argv, "k:l:ps")) != -1)
+ while ((ch = getopt(argc, argv, "ck:l:ps")) != -1)
switch(ch) {
+ case 'c':
+ nocolor = 1;
+ break;
case 'k':
if (strlen(keys = optarg) != 6)
usage();
diff --git a/tetris/tetris.h b/tetris/tetris.h
index 4f2fbccd..559ef761 100644
--- a/tetris/tetris.h
+++ b/tetris/tetris.h
@@ -1,4 +1,4 @@
-/* $NetBSD: tetris.h,v 1.13 2014/06/11 16:47:39 christos Exp $ */
+/* $NetBSD: tetris.h,v 1.14 2014/07/13 16:23:55 pgoyette Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -168,6 +168,7 @@ extern gid_t gid, egid;
extern char key_msg[100];
extern int showpreview;
+extern int nocolor;
int fits_in(const struct shape *, int);
void place(const struct shape *, int, int);