summaryrefslogtreecommitdiff
path: root/x11/hanterm/patches/patch-ab
blob: 63c3951e0c031416b9c84c103029bde581e8fdc0 (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
$NetBSD: patch-ab,v 1.3 2014/09/22 11:56:39 joerg Exp $

- use standard headers
- don't provide own malloc/realloc declarations
- avoid implicit int
- declare void functions void
- fix os conditionals (apparently with respect to VMS)
- don't cast return value of malloc

--- charproc.c.orig	2001-06-06 13:05:15.000000000 +0000
+++ charproc.c
@@ -47,10 +47,13 @@ int eng_descent;
 #include <X11/Xmu/CharSet.h>
 #include <X11/Xmu/Converters.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <errno.h>
 #include <setjmp.h>
 #include <ctype.h>
 #include <X11/keysym.h>
+#include <sys/types.h>
+
 #include "hangul.h"
 #include "hstrdefs.h"
 
@@ -81,8 +84,6 @@ extern int font_minus_width_char_byte2;
 
 extern Widget toplevel;
 extern void exit();
-extern char *malloc();
-extern char *realloc();
 
 extern void FlushScroll();
 extern void InsertLine();
@@ -126,6 +127,11 @@ extern int convert_3_to_utf8();
 void set_vt_graphics (/*TScreen *screen*/);
 #endif
 
+static void ansi_modes(XtermWidget, int (*)());
+static void dpmodes(XtermWidget, void (*)());
+static void restoremodes(XtermWidget);
+static void savemodes(XtermWidget);
+static void unparseputn(unsigned int, int);
 static void VTallocbuf();
 static int finput();
 static void dotext();
@@ -1764,7 +1770,7 @@ static void VTparse()
 	}
 }
 
-static finput()
+static int finput(void)
 {
 	return(doinput());
 }
@@ -1774,13 +1780,14 @@ static char *v_buffer;		/* pointer to ph
 static char *v_bufstr = NULL;	/* beginning of area to write */
 static char *v_bufptr;		/* end of area to write */
 static char *v_bufend;		/* end of physical buffer */
-#if !defined(linux) && !defined(SVR4)	/* dkim@surecom.com */
+#ifdef VMS
 #define	ptymask()	(v_bufptr > v_bufstr ? pty_mask : 0)
 #endif
 
 /* Write data to the pty as typed by the user, pasted with the mouse,
    or generated by us in response to a query ESC sequence. */
 
+int
 v_write(f, d, len)
     int f;
     char *d;
@@ -1802,7 +1809,7 @@ v_write(f, d, len)
 	fprintf(stderr, "\n");
 #endif
 
-#if defined(linux) || defined(SVR4)
+#ifndef VMS
 	if (f != pty_mask)
 #else
 	if ((1 << f) != pty_mask)
@@ -1927,7 +1934,7 @@ v_write(f, d, len)
 	return(c);
 }
 
-#if (defined(linux)||defined(SVR4))||(defined(hpux) && OSMAJORVERSION >= 10)
+#ifndef VMS
 static fd_set select_mask;
 static fd_set write_mask;
 #else
@@ -1936,6 +1943,7 @@ static int write_mask;
 #endif
 static int pty_read_bytes;
 
+int
 in_put()
 {
     register TScreen *screen = &term->screen;
@@ -1943,7 +1951,7 @@ in_put()
     static struct timeval select_timeout;
 
     for( ; ; ) {
-#if defined(linux)||defined(SVR4)||(defined(hpux) && OSMAJORVERSION >= 10)
+#ifndef VMS
 	if (FD_ISSET(pty_mask, &select_mask) && eventMode == NORMAL) {
 #else
 	if (select_mask & pty_mask && eventMode == NORMAL) {
@@ -2003,7 +2011,7 @@ in_put()
 		/* stop speed reading at some point to look for X stuff */
 		/* (4096 is just a random large number.) */
 		if (pty_read_bytes > 4096) {
-#if defined(linux)||defined(SVR4)||(defined(hpux) && OSMAJORVERSION >= 10)
+#ifndef VMS
 		    FD_CLR(pty_mask, &select_mask);
 #else
 		    select_mask &= ~pty_mask;
@@ -2033,7 +2041,7 @@ in_put()
 	/* Update the masks and, unless X events are already in the queue,
 	   wait for I/O to be possible. */
 	select_mask = Select_mask;
-#if defined(linux) || defined(SVR4) ||(defined(hpux) && OSMAJORVERSION >= 10)
+#ifndef VMS
 	if (v_bufptr > v_bufstr)
 	  FD_SET(pty_mask, &write_mask);
        else
@@ -2047,7 +2055,7 @@ in_put()
 /* by sangil's report */
 /* #if defined(linux)||defined(SVR4)
     ||(defined(hpux) && OSMAJORVERSION >= 10) */
-#if defined(linux)||defined(SVR4)
+#ifndef VMS
 	if (QLength (screen->display))
 	{
 	    i = select(max_plus1, (fd_set*) &select_mask, (fd_set*) &write_mask, (fd_set *)NULL, (struct timeval *) &select_timeout);
@@ -2073,7 +2081,7 @@ in_put()
 	} 
 
 	/* if there is room to write more data to the pty, go write more */
-#if defined(linux)||defined(SVR4)||(defined(hpux) && OSMAJORVERSION >= 10)
+#ifndef VMS
 	if ((v_bufptr > v_bufstr) && FD_ISSET(pty_mask, &write_mask)) {
 #else
 	if (write_mask & ptymask()) {
@@ -2083,7 +2091,7 @@ in_put()
 
 	/* if there are X events already in our queue, it
 	   counts as being readable */
-#if defined(linux)||defined(SVR4)||(defined(hpux) && OSMAJORVERSION >= 10)
+#ifndef VMS
 	if (QLength(screen->display) || (FD_ISSET(X_mask, &select_mask))) {
 #else
 	if (QLength(screen->display) || (select_mask & X_mask)) {
@@ -2322,9 +2330,8 @@ WriteText(screen, str, len, flags, fg, b
 /*
  * process ANSI modes set, reset
  */
-ansi_modes(termw, func)
-    XtermWidget	termw;
-    int		(*func)();
+static void
+ansi_modes(XtermWidget termw, int (*func)())
 {
 	register int	i;
 
@@ -2345,9 +2352,8 @@ ansi_modes(termw, func)
 /*
  * process DEC private modes set, reset
  */
-dpmodes(termw, func)
-    XtermWidget	termw;
-    void (*func)();
+static void
+dpmodes(XtermWidget termw, void (*func)())
 {
 	register TScreen	*screen	= &termw->screen;
 	register int	i, j;
@@ -2498,8 +2504,8 @@ dpmodes(termw, func)
 /*
  * process xterm private modes save
  */
-savemodes(termw)
-    XtermWidget termw;
+static void
+savemodes(XtermWidget termw)
 {
 	register TScreen	*screen	= &termw->screen;
 	register int i;
@@ -2564,8 +2570,8 @@ savemodes(termw)
 /*
  * process xterm private modes restore
  */
-restoremodes(termw)
-    XtermWidget termw;
+static void
+restoremodes(XtermWidget termw)
 {
 	register TScreen	*screen	= &termw->screen;
 	register int i, j;
@@ -2711,9 +2717,8 @@ static void bitclr(p, mask)
 	*p &= ~mask;
 }
 
-unparseseq(ap, fd)
-    register ANSI *ap;
-    int fd;
+void
+unparseseq(ANSI *ap, int fd)
 {
 	register int	c;
 	register int	i;
@@ -2744,9 +2749,8 @@ unparseseq(ap, fd)
 	}
 }
 
-unparseputn(n, fd)
-unsigned int	n;
-int fd;
+static void
+unparseputn(unsigned int n, int fd)
 {
 	unsigned int	q;
 
@@ -2756,6 +2760,7 @@ int fd;
 	unparseputc((char) ('0' + (n%10)), fd);
 }
 
+void
 unparseputc(c, fd)
 int c;
 int fd;
@@ -2774,6 +2779,7 @@ int fd;
 	}
 }
 
+void
 unparsefputs (s, fd)
     register char *s;
     int fd;
@@ -4062,7 +4068,7 @@ int LoadNewFont (screen, nfontname, bfon
 
     if (fontnum == fontMenu_fontescape &&
 	nfontname != screen->menu_font_names[fontnum]) {
-	tmpname = (char *) malloc (strlen(nfontname) + 1);
+	tmpname = malloc (strlen(nfontname) + 1);
 	if (!tmpname) return 0;
 	strcpy (tmpname, nfontname);
     }
@@ -4377,7 +4383,7 @@ set_vt_graphics (screen)
 	static char gr_valid_code[] = " `ajklmnopqrstuvwx~";
 
 	if (!gr_mapping) {
-		gr_mapping = (int *)malloc(sizeof(int)*256);
+		gr_mapping = malloc(sizeof(int)*256);
 		for(i = 0; i < 256; i++) {
 		    gr_mapping[i] = 1;
 		}