summaryrefslogtreecommitdiffstats
path: root/source/y/bsd-games/bsd-games.getline.diff
blob: ed0cd9ca065d3bc9f5d80ed86970ac6c8c8d78c7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
--- ./gomoku/main.c.orig	2000-05-28 09:51:46.000000000 -0500
+++ ./gomoku/main.c	2010-05-11 16:10:10.000000000 -0500
@@ -159,7 +159,7 @@
 		if (inputfp == NULL && test == 0) {
 			for (;;) {
 				ask("black or white? ");
-				getline(buf, sizeof(buf));
+				g_getline(buf, sizeof(buf));
 				if (buf[0] == 'b' || buf[0] == 'B') {
 					color = BLACK;
 					break;
@@ -176,7 +176,7 @@
 		}
 	} else {
 		setbuf(stdout, 0);
-		getline(buf, sizeof(buf));
+		g_getline(buf, sizeof(buf));
 		if (strcmp(buf, "black") == 0)
 			color = BLACK;
 		else if (strcmp(buf, "white") == 0)
@@ -248,7 +248,7 @@
 		getinput:
 			if (interactive)
 				ask("move? ");
-			if (!getline(buf, sizeof(buf))) {
+			if (!g_getline(buf, sizeof(buf))) {
 				curmove = RESIGN;
 				break;
 			}
@@ -260,7 +260,7 @@
 					FILE *fp;
 
 					ask("save file name? ");
-					(void)getline(buf, sizeof(buf));
+					(void)g_getline(buf, sizeof(buf));
 					if ((fp = fopen(buf, "w")) == NULL) {
 						glog("cannot create save file");
 						goto getinput;
@@ -313,14 +313,14 @@
 		if (i != RESIGN) {
 		replay:
 			ask("replay? ");
-			if (getline(buf, sizeof(buf)) &&
+			if (g_getline(buf, sizeof(buf)) &&
 			    (buf[0] == 'y' || buf[0] == 'Y'))
 				goto again;
 			if (strcmp(buf, "save") == 0) {
 				FILE *fp;
 
 				ask("save file name? ");
-				(void)getline(buf, sizeof(buf));
+				(void)g_getline(buf, sizeof(buf));
 				if ((fp = fopen(buf, "w")) == NULL) {
 					glog("cannot create save file");
 					goto replay;
@@ -371,7 +371,7 @@
 		quit();
 top:
 	ask("cmd? ");
-	if (!getline(fmtbuf, sizeof(fmtbuf)))
+	if (!g_getline(fmtbuf, sizeof(fmtbuf)))
 		quit();
 	switch (*fmtbuf) {
 	case '\0':
--- ./gomoku/gomoku.h.orig	1999-09-15 05:34:31.000000000 -0500
+++ ./gomoku/gomoku.h	2010-05-11 16:10:10.000000000 -0500
@@ -269,7 +269,7 @@
 
 void	bdinit __P((struct spotstr *));
 void	init_overlap __P((void));
-int	getline __P((char *, int));
+int	g_getline __P((char *, int));
 void	ask __P((const char *));
 void	dislog __P((const char *));
 void	bdump __P((FILE *));
--- ./gomoku/bdisp.c.orig	2001-02-07 18:18:22.000000000 -0600
+++ ./gomoku/bdisp.c	2010-05-11 16:10:10.000000000 -0500
@@ -245,7 +245,7 @@
 }
 
 int
-getline(buf, size)
+g_getline(buf, size)
 	char *buf;
 	int size;
 {
--- ./cribbage/score.c.orig	1999-09-15 05:34:31.000000000 -0500
+++ ./cribbage/score.c	2010-05-11 16:10:10.000000000 -0500
@@ -122,7 +122,7 @@
 	CARD h[(CINHAND + 1)];
 	char buf[32];
 
-	expl[0] = '\0';		/* initialize explanation */
+	cr_expl[0] = '\0';		/* initialize explanation */
 	score = 0;
 	flag = TRUE;
 	k = hand[0].suit;
@@ -132,29 +132,29 @@
 			if (hand[i].suit == starter.suit) {
 				score++;
 				if (do_explain)
-					strcat(expl, "His Nobs");
+					strcat(cr_expl, "His Nobs");
 			}
 		h[i] = hand[i];
 	}
 
 	if (flag && n >= CINHAND) {
-		if (do_explain && expl[0] != '\0')
-			strcat(expl, ", ");
+		if (do_explain && cr_expl[0] != '\0')
+			strcat(cr_expl, ", ");
 		if (starter.suit == k) {
 			score += 5;
 			if (do_explain)
-				strcat(expl, "Five-flush");
+				strcat(cr_expl, "Five-flush");
 		} else
 			if (!crb) {
 				score += 4;
-				if (do_explain && expl[0] != '\0')
-					strcat(expl, ", Four-flush");
+				if (do_explain && cr_expl[0] != '\0')
+					strcat(cr_expl, ", Four-flush");
 				else
-					strcpy(expl, "Four-flush");
+					strcpy(cr_expl, "Four-flush");
 			}
 	}
-	if (do_explain && expl[0] != '\0')
-		strcat(expl, ", ");
+	if (do_explain && cr_expl[0] != '\0')
+		strcat(cr_expl, ", ");
 	h[n] = starter;
 	sorthand(h, n + 1);	/* sort by rank */
 	i = 2 * fifteens(h, n + 1);
@@ -162,9 +162,9 @@
 	if (do_explain) {
 		if (i > 0) {
 			(void) sprintf(buf, "%d points in fifteens", i);
-			strcat(expl, buf);
+			strcat(cr_expl, buf);
 		} else
-			strcat(expl, "No fifteens");
+			strcat(cr_expl, "No fifteens");
 	}
 	i = pairuns(h, n + 1);
 	score += i;
@@ -172,9 +172,9 @@
 		if (i > 0) {
 			(void) sprintf(buf, ", %d points in pairs, %d in runs",
 			    pairpoints, runpoints);
-			strcat(expl, buf);
+			strcat(cr_expl, buf);
 		} else
-			strcat(expl, ", No pairs/runs");
+			strcat(cr_expl, ", No pairs/runs");
 	}
 	return (score);
 }
--- ./cribbage/support.c.orig	1999-09-15 05:34:31.000000000 -0500
+++ ./cribbage/support.c	2010-05-11 16:10:10.000000000 -0500
@@ -152,7 +152,7 @@
 			msg("You should have taken %d, not %d!", i, j);
 		}
 		if (explain)
-			msg("Explanation: %s", expl);
+			msg("Explanation: %s", cr_expl);
 		do_wait();
 	} else
 		win = chkscr(&pscore, i);
--- ./cribbage/cribbage.h.orig	2000-10-17 14:58:05.000000000 -0500
+++ ./cribbage/cribbage.h	2010-05-11 16:10:10.000000000 -0500
@@ -59,7 +59,7 @@
 extern  BOOLEAN		quiet;			/* if suppress random mess */
 extern	BOOLEAN		playing;		/* currently playing game */
 
-extern  char		expl[];			/* string for explanation */
+extern  char		cr_expl[];			/* string for explanation */
 
 void	 addmsg __P((const char *, ...))
     __attribute__((__format__(__printf__, 1, 2)));
@@ -81,7 +81,7 @@
 int	 fifteens __P((const CARD [], int));
 void	 game __P((void));
 void	 gamescore __P((void));
-char	*getline __P((void));
+char	*cr_getline __P((void));
 int	 getuchar __P((void));
 int	 incard __P((CARD *));
 int	 infrom __P((const CARD [], int, const char *));
--- ./cribbage/io.c.orig	1999-10-01 15:45:34.000000000 -0500
+++ ./cribbage/io.c	2010-05-11 16:10:10.000000000 -0500
@@ -254,7 +254,7 @@
 
 	retval = FALSE;
 	rnk = sut = EMPTY;
-	if (!(line = getline()))
+	if (!(line = cr_getline()))
 		goto gotit;
 	p = p1 = line;
 	while (*p1 != ' ' && *p1 != '\0')
@@ -355,7 +355,7 @@
 
 	for (sum = 0;;) {
 		msg(prompt);
-		if (!(p = getline()) || *p == '\0') {
+		if (!(p = cr_getline()) || *p == '\0') {
 			msg(quiet ? "Not a number" :
 			    "That doesn't look like a number");
 			continue;
@@ -562,7 +562,7 @@
  *	compressed to one space; a space is inserted before a ','
  */
 char *
-getline()
+cr_getline()
 {
 	char *sp;
 	int c, oy, ox;
--- ./cribbage/crib.c.orig	2001-02-07 18:18:22.000000000 -0600
+++ ./cribbage/crib.c	2010-05-11 16:10:10.000000000 -0500
@@ -225,7 +225,7 @@
 			if (!rflag) {			/* player cuts deck */
 				msg(quiet ? "Cut for crib? " :
 			    "Cut to see whose crib it is -- low card wins? ");
-				getline();
+				cr_getline();
 			}
 			i = (rand() >> 4) % CARDS;	/* random cut */
 			do {	/* comp cuts deck */
@@ -401,7 +401,7 @@
 		if (!rflag) {	/* random cut */
 			msg(quiet ? "Cut the deck? " :
 		    "How many cards down do you wish to cut the deck? ");
-			getline();
+			cr_getline();
 		}
 		i = (rand() >> 4) % (CARDS - pos);
 		turnover = deck[i + pos];
--- ./cribbage/extern.c.orig	1999-09-26 06:37:19.000000000 -0500
+++ ./cribbage/extern.c	2010-05-11 16:10:10.000000000 -0500
@@ -52,7 +52,7 @@
 BOOLEAN	quiet		= FALSE;	/* if suppress random mess */
 BOOLEAN	rflag		= FALSE;	/* if all cuts random */
 
-char	expl[128];			/* explanation */
+char	cr_expl[128];			/* explanation */
 
 int	cgames		= 0;		/* number games comp won */
 int	cscore		= 0;		/* comp score in this game */