Module Name:    src
Committed By:   rillig
Date:           Sat May 28 23:05:45 UTC 2022

Modified Files:
        src/games/gomoku: gomoku.h main.c

Log Message:
gomoku: use custom magic value for end of file input

This allows the type for a spot index to be changed to an unsigned type.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/games/gomoku/gomoku.h
cvs rdiff -u -r1.65 -r1.66 src/games/gomoku/main.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/gomoku/gomoku.h
diff -u src/games/gomoku/gomoku.h:1.45 src/games/gomoku/gomoku.h:1.46
--- src/games/gomoku/gomoku.h:1.45	Sat May 28 17:51:27 2022
+++ src/games/gomoku/gomoku.h	Sat May 28 23:05:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: gomoku.h,v 1.45 2022/05/28 17:51:27 rillig Exp $	*/
+/*	$NetBSD: gomoku.h,v 1.46 2022/05/28 23:05:45 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994
@@ -66,6 +66,7 @@
 #define WIN	3
 #define TIE	4
 #define SAVE	5
+#define END_OF_INPUT 6
 #define PT(x, y)	((x) + (BSZ + 1) * (y))
 
 /*

Index: src/games/gomoku/main.c
diff -u src/games/gomoku/main.c:1.65 src/games/gomoku/main.c:1.66
--- src/games/gomoku/main.c:1.65	Sat May 28 21:31:41 2022
+++ src/games/gomoku/main.c	Sat May 28 23:05:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.65 2022/05/28 21:31:41 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.66 2022/05/28 23:05:45 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994
@@ -36,7 +36,7 @@
 __COPYRIGHT("@(#) Copyright (c) 1994\
  The Regents of the University of California.  All rights reserved.");
 /*	@(#)main.c	8.4 (Berkeley) 5/4/95	*/
-__RCSID("$NetBSD: main.c,v 1.65 2022/05/28 21:31:41 rillig Exp $");
+__RCSID("$NetBSD: main.c,v 1.66 2022/05/28 23:05:45 rillig Exp $");
 
 #include <sys/stat.h>
 #include <curses.h>
@@ -290,7 +290,7 @@ again:
 	switch (input[color]) {
 	case INPUTF:
 		curmove = readinput(inputfp);
-		if (curmove != EOF)
+		if (curmove != END_OF_INPUT)
 			break;
 		set_input_sources(input, color);
 		plyr[BLACK] = input[BLACK] == USER ? user : prog;
@@ -409,7 +409,7 @@ readinput(FILE *fp)
 	while ((c = getc(fp)) != EOF && c != '\n' && pos < sizeof(buf) - 1)
 		buf[pos++] = c;
 	buf[pos] = '\0';
-	return c == EOF ? EOF : ctos(buf);
+	return c == EOF ? END_OF_INPUT : ctos(buf);
 }
 
 #ifdef DEBUG

Reply via email to