Module Name:    src
Committed By:   pgoyette
Date:           Sun Jul 13 16:23:56 UTC 2014

Modified Files:
        src/games/tetris: screen.c tetris.6 tetris.c tetris.h

Log Message:
Provide an option to restore traditional black-and-white mode.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/games/tetris/screen.c
cvs rdiff -u -r1.11 -r1.12 src/games/tetris/tetris.6
cvs rdiff -u -r1.25 -r1.26 src/games/tetris/tetris.c
cvs rdiff -u -r1.13 -r1.14 src/games/tetris/tetris.h

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/screen.c
diff -u src/games/tetris/screen.c:1.28 src/games/tetris/screen.c:1.29
--- src/games/tetris/screen.c:1.28	Wed Jun 11 16:47:39 2014
+++ src/games/tetris/screen.c	Sun Jul 13 16:23:55 2014
@@ -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;
 

Index: src/games/tetris/tetris.6
diff -u src/games/tetris/tetris.6:1.11 src/games/tetris/tetris.6:1.12
--- src/games/tetris/tetris.6:1.11	Thu Sep 15 02:09:42 2005
+++ src/games/tetris/tetris.6	Sun Jul 13 16:23:55 2014
@@ -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

Index: src/games/tetris/tetris.c
diff -u src/games/tetris/tetris.c:1.25 src/games/tetris/tetris.c:1.26
--- src/games/tetris/tetris.c:1.25	Wed Jun 11 16:47:39 2014
+++ src/games/tetris/tetris.c	Sun Jul 13 16:23:55 2014
@@ -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();

Index: src/games/tetris/tetris.h
diff -u src/games/tetris/tetris.h:1.13 src/games/tetris/tetris.h:1.14
--- src/games/tetris/tetris.h:1.13	Wed Jun 11 16:47:39 2014
+++ src/games/tetris/tetris.h	Sun Jul 13 16:23:55 2014
@@ -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);

Reply via email to