summaryrefslogtreecommitdiff
path: root/games/ularn/patches/patch-al
blob: 7a5ca78ac9f0b5f3a0256a5432db793cf2e8f5da (plain)
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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
$NetBSD: patch-al,v 1.2 2003/12/06 19:28:22 ben Exp $

--- io.c.orig	1995-01-18 11:48:27.000000000 -0800
+++ io.c
@@ -47,6 +47,12 @@
  *
  * Note: ** entries are available only in termcap mode.
  */
+
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <stdlib.h>
+#include <termcap.h>
+#include <unistd.h>
 #include "header.h"
 #include "extern.h"
 
@@ -61,13 +67,13 @@ static char lgetwbuf[LINBUFSIZE];	/* get
 /*
  *	getcharacter() 	Routine to read in one character from the terminal
  */
-getcharacter ()
+int getcharacter (void)
 {
 	char byt;
 
 	lflush();		/* be sure output buffer is flushed */
 	read(0, &byt,1); 	/* get byte from terminal */
-	return(byt);
+	return((int)byt);
 }
 
 
@@ -75,7 +81,7 @@ getcharacter ()
  *	newgame() 
  *		Subroutine to save the initial time and seed rnd()
  */
-newgame ()
+void newgame (void)
 {
 	long *p,*pe;
 
@@ -101,18 +107,14 @@ newgame ()
  */
 /*VARARGS*/
 
-lprintf(va_alist)
-va_dcl
+void lprintf(char *fmt, ...)
 {
 	va_list ap;	/* pointer for variable argument list */
-	char *fmt;
 	char *outb,*tmpb;
 	long wide,left,cont,n;		/* data for lprintf	*/
 	char db[12];			/* %d buffer in lprintf	*/
 
-	va_start(ap);	/* initialize the var args pointer */
-
-	fmt = (char *)va_arg(ap, char *);	/* pointer to format string */
+	va_start(ap, fmt);	/* initialize the var args pointer */
 
 	if (lpnt >= lpend) lflush();
 	outb = lpnt;
@@ -164,7 +166,7 @@ va_dcl
 					break;
 				}
 				if (wide==0)  {
-					while (*outb++ = *tmpb++);
+					while ((*outb++ = *tmpb++));
 					--outb;
 				}
 				else {
@@ -172,7 +174,7 @@ va_dcl
 					if (left)
 						while (n-- > 0)
 							*outb++ = ' ';
-					while (*outb++ = *tmpb++)
+					while ((*outb++ = *tmpb++))
 						;
 					--outb;
 					if (left==0)
@@ -230,7 +232,7 @@ va_dcl
  *	No checking for output buffer overflow is done, but flushes if needed!
  *	Returns nothing of value.
  */
-lprint (x)
+void lprint (x)
 long x;
 {
 	if (lpnt >= lpend)
@@ -251,7 +253,7 @@ long x;
  *	Enter with the address and number of bytes to write out
  *	Returns nothing of value
  */
-lwrite (buf, len)
+void lwrite (buf, len)
 char *buf;
 int len;
 {
@@ -286,7 +288,7 @@ int len;
  *
  *  Returns 0 if EOF, otherwise the character
  */
-long lgetc1()
+long lgetc1(void)
 {
 	int i;
 
@@ -320,7 +322,7 @@ long lgetc1()
  *	The save order is low order first, to high order (4 bytes total)
  *	Returns the int read
  */
-long lrint()
+long lrint(void)
 {
 	long i;
 
@@ -339,7 +341,7 @@ long lrint()
  *	Reads "number" bytes into the buffer pointed to by "address".
  *	Returns nothing of value
  */
-lrfill (adr, num)
+void lrfill (adr, num)
 char *adr;
 int num;
 {
@@ -379,7 +381,7 @@ int num;
  *
  *	Returns pointer to a buffer that contains word.  If EOF, returns a 0
  */
-char *lgetw()
+char *lgetw(void)
 {
 	char *lgp;
 	int cc, n=LINBUFSIZE, quote=0;
@@ -412,7 +414,7 @@ char *lgetw()
  *
  *Returns pointer to a buffer that contains the line.  If EOF, returns 0
  */
-char *lgetl()
+char *lgetl(void)
 {
 	int i=LINBUFSIZE,ch;
 	char *str=lgetwbuf;
@@ -437,7 +439,7 @@ char *lgetl()
  *	lcreat((char*)0); means to the terminal
  *	Returns -1 if error, otherwise the file descriptor opened.
  */
-lcreat(str)
+int lcreat(str)
 char *str;
 {
 	lpnt = lpbuf;
@@ -461,7 +463,7 @@ char *str;
  *	lopen(0) means from the terminal
  *	Returns -1 if error, otherwise the file descriptor opened.
  */
-lopen (str)
+int lopen (str)
 char *str;
 {
 	ipoint = iepoint = BUFSIZ;
@@ -484,7 +486,7 @@ char *str;
  *	lappend(0) means to the terminal
  *	Returns -1 if error, otherwise the file descriptor opened.
  */
-lappend (str)
+int lappend (str)
 char *str;
 {
 	lpnt = lpbuf;
@@ -507,7 +509,7 @@ char *str;
  *
  *	Returns nothing of value.
  */
-lrclose()
+void lrclose(void)
 {
 	if (fd > 0)
 		close(fd);
@@ -518,7 +520,7 @@ lrclose()
  *
  *	Returns nothing of value.
  */
-lwclose ()
+void lwclose (void)
 {
 	lflush();
 	if (lfd > 2)
@@ -529,7 +531,7 @@ lwclose ()
  *	lprcat(string)			append a string to the output buffer
  *					avoids calls to lprintf (time consuming)
  */
-lprcat (str)
+void lprcat (str)
 char *str;
 {
 	char *str2;
@@ -537,8 +539,7 @@ char *str;
 	if (lpnt >= lpend)
 		lflush();
 	str2 = lpnt;
-	while (*str2++ = *str++)
-		;
+	while ((*str2++ = *str++));
 	lpnt = str2 - 1;
 }
 
@@ -553,15 +554,16 @@ static char cap[256];
 static char *outbuf=0;	/* translated output buffer */
 char *CM, *CE, *CD, *CL, *SO, *SE, *AL, *DL;/* Termcap capabilities */
 char *HO, *BC, *UP;
-extern char *PC;
+/* extern char *PC; */ /* termcap.h declares extern char PC, not a pointer */
 
 /*
  * init_term()		Terminal initialization -- setup termcap info
  */
-init_term ()
+void init_term (void)
 {
 	char termbuf[1024];
-	char *pc, *capptr = cap+10;
+	char *pc;
+	char *capptr = cap+10;
 	char *malloc(), *tgetstr(), *term, *getenv();
 
 	switch (tgetent(termbuf, term = getenv("TERM"))) {
@@ -584,12 +586,11 @@ init_term ()
 	UP = tgetstr("up", &capptr);	/* cursor up */
 	HO = tgetstr("ho", &capptr);	/* home cursor */
 
-	if (pc = tgetstr("pc", &capptr)) /* padding character */
-		PC = pc;
-/*
+	pc = tgetstr("pc", &capptr);	/* padding character */
+	if (pc)
+		PC = *pc;
 	else
-		*PC = '\0';
-*/
+		PC = '\0';
 
 	if (!(BC = tgetstr("bc", &capptr))) {	/* backspace */
 		if (!(BC=tgetstr("le", &capptr))) {
@@ -632,7 +633,7 @@ init_term ()
 /*
  * cl_up(x,y) Clear screen from [x,1] to current position. Leave cursor at [x,y]
  */
-cl_up (x,y)
+void cl_up (x,y)
 int x, y;
 {
 	int i;
@@ -648,7 +649,7 @@ int x, y;
 /*
  * cl_dn(x,y) 	Clear screen from [1,y] to end of display. Leave cursor at [x,y]
  */
-cl_dn (x,y)
+void cl_dn (x,y)
 int x, y;
 {
 	int i;
@@ -671,7 +672,7 @@ int x, y;
 /*
  * standout(str)  Print the argument string in inverse video (standout mode).
  */
-standout (str)
+void standout (str)
 char *str;
 {
 	if (boldon == 0) {
@@ -687,7 +688,7 @@ char *str;
 /*
  * set_score_output() 	Called when output should be literally printed.
  */
-set_score_output() {
+void set_score_output() {
 	enable_scroll = -1;
 }
 
@@ -700,7 +701,7 @@ set_score_output() {
  */
 static int scrline=18; /* line # for wraparound instead of scrolling if no DL */
 
-lflush ()
+void lflush ()
 {
 	int lpoint;
 	char *str;
@@ -796,18 +797,19 @@ static int ind=0;
 /*
  * putcharacter(c)		Print one character in decoded output buffer.
  */
-putcharacter(c)
+int putcharacter(c)
 int c;
 {
 	outbuf[ind++]=c;
 	if(ind>=BUFSIZ)
 		flush_buf();
+	return c;
 }
 
 /*
  * flush_buf()			Flush buffer with decoded output.
  */
-flush_buf()
+void flush_buf(void)
 {
 	if (ind)
 		write(lfd, outbuf, ind);
@@ -825,7 +827,7 @@ flush_buf()
  *
  *
  */
-tmcapcnv(sd,ss)
+void tmcapcnv(sd,ss)
 char *sd, *ss;
 {
 	int tmstate=0;	/* 0=normal, 1=ESC 2=[ 3=# */