Fix implicit prototype conflicts. Always include termios.h for ECHO.diff -r1.11 -r1.12 pkgsrc/x11/hanterm/distinfo
(joerg)
@@ -1,17 +1,18 @@ | @@ -1,17 +1,18 @@ | |||
1 | $NetBSD: distinfo,v 1.11 2013/11/24 05:53:52 dholland Exp $ | 1 | $NetBSD: distinfo,v 1.12 2014/09/22 11:56:39 joerg Exp $ | |
2 | 2 | |||
3 | SHA1 (hanterm-3.1.6.tar.gz) = df2ff9ca8ddcee41baeaa8544a9983a1534e8b30 | 3 | SHA1 (hanterm-3.1.6.tar.gz) = df2ff9ca8ddcee41baeaa8544a9983a1534e8b30 | |
4 | RMD160 (hanterm-3.1.6.tar.gz) = 9d9c6c1d2eca9ad338140f1d8c418ed5e0e9548b | 4 | RMD160 (hanterm-3.1.6.tar.gz) = 9d9c6c1d2eca9ad338140f1d8c418ed5e0e9548b | |
5 | Size (hanterm-3.1.6.tar.gz) = 323736 bytes | 5 | Size (hanterm-3.1.6.tar.gz) = 323736 bytes | |
6 | SHA1 (patch-aa) = 985f6bf88010e8addcaa7f18d70652dcd65255f4 | 6 | SHA1 (patch-aa) = 985f6bf88010e8addcaa7f18d70652dcd65255f4 | |
7 | SHA1 (patch-ab) = 776a5618e0be40d3bac6d83d707c5dd970f208cf | 7 | SHA1 (patch-ab) = d21b0261fb57a0b15990db63226196ffae70f009 | |
8 | SHA1 (patch-ac) = 4c5a60d1785099abe809acfcd1b6363be81e17f4 | 8 | SHA1 (patch-ac) = 4c5a60d1785099abe809acfcd1b6363be81e17f4 | |
9 | SHA1 (patch-ad) = 76ab4f52449d9e378884bc9d8e41b249e494fd04 | 9 | SHA1 (patch-ad) = 76ab4f52449d9e378884bc9d8e41b249e494fd04 | |
10 | SHA1 (patch-ae) = 00c0992dd92832b3819574d4f3856bcf8a0a6e75 | 10 | SHA1 (patch-ae) = 80677fd263412fbf25717b596d860de51ff6edd5 | |
11 | SHA1 (patch-af) = 7306a141331bbbe1e4ee4e46549834be2ae2cfa1 | 11 | SHA1 (patch-af) = 7306a141331bbbe1e4ee4e46549834be2ae2cfa1 | |
12 | SHA1 (patch-ag) = 50a7a71b7075ac57735189f43fd7e770ec9de81d | 12 | SHA1 (patch-ag) = 50a7a71b7075ac57735189f43fd7e770ec9de81d | |
13 | SHA1 (patch-button.c) = 7a8204422045cf37a468723d85b79bc79d9a7735 | 13 | SHA1 (patch-button.c) = 7a8204422045cf37a468723d85b79bc79d9a7735 | |
14 | SHA1 (patch-chat.c) = 4c5162afae53a3c0bff08991648fe1b0cf07b38f | 14 | SHA1 (patch-chat.c) = 4c5162afae53a3c0bff08991648fe1b0cf07b38f | |
15 | SHA1 (patch-ptyx.h) = 8828a7c2d43fabd5d9430e349b91a91e1236dc86 | |||
15 | SHA1 (patch-screen.c) = 262b4c1dbec28ae5e6fdf6893c41be3b6d3d95b5 | 16 | SHA1 (patch-screen.c) = 262b4c1dbec28ae5e6fdf6893c41be3b6d3d95b5 | |
16 | SHA1 (patch-scrollbar.c) = c7e34150fa6f9efe95777cbf675f2a8ebb8d14f6 | 17 | SHA1 (patch-scrollbar.c) = c7e34150fa6f9efe95777cbf675f2a8ebb8d14f6 | |
17 | SHA1 (patch-util.c) = eba8de0714d749809a20334fa3035dfd52648402 | 18 | SHA1 (patch-util.c) = eba8de0714d749809a20334fa3035dfd52648402 |
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | $NetBSD: patch-ab,v 1.2 2013/11/24 05:53:52 dholland Exp $ | 1 | $NetBSD: patch-ab,v 1.3 2014/09/22 11:56:39 joerg Exp $ | |
2 | 2 | |||
3 | - use standard headers | 3 | - use standard headers | |
4 | - don't provide own malloc/realloc declarations | 4 | - don't provide own malloc/realloc declarations | |
5 | - avoid implicit int | 5 | - avoid implicit int | |
6 | - declare void functions void | 6 | - declare void functions void | |
7 | - fix os conditionals (apparently with respect to VMS) | 7 | - fix os conditionals (apparently with respect to VMS) | |
8 | - don't cast return value of malloc | 8 | - don't cast return value of malloc | |
9 | 9 | |||
10 | --- charproc.c.orig 2001-06-06 13:05:15.000000000 +0000 | 10 | --- charproc.c.orig 2001-06-06 13:05:15.000000000 +0000 | |
11 | +++ charproc.c | 11 | +++ charproc.c | |
12 | @@ -47,10 +47,13 @@ int eng_descent; | 12 | @@ -47,10 +47,13 @@ int eng_descent; | |
13 | #include <X11/Xmu/CharSet.h> | 13 | #include <X11/Xmu/CharSet.h> | |
14 | #include <X11/Xmu/Converters.h> | 14 | #include <X11/Xmu/Converters.h> | |
@@ -22,200 +22,234 @@ $NetBSD: patch-ab,v 1.2 2013/11/24 05:53 | @@ -22,200 +22,234 @@ $NetBSD: patch-ab,v 1.2 2013/11/24 05:53 | |||
22 | + | 22 | + | |
23 | #include "hangul.h" | 23 | #include "hangul.h" | |
24 | #include "hstrdefs.h" | 24 | #include "hstrdefs.h" | |
25 | 25 | |||
26 | @@ -81,8 +84,6 @@ extern int font_minus_width_char_byte2; | 26 | @@ -81,8 +84,6 @@ extern int font_minus_width_char_byte2; | |
27 | 27 | |||
28 | extern Widget toplevel; | 28 | extern Widget toplevel; | |
29 | extern void exit(); | 29 | extern void exit(); | |
30 | -extern char *malloc(); | 30 | -extern char *malloc(); | |
31 | -extern char *realloc(); | 31 | -extern char *realloc(); | |
32 | 32 | |||
33 | extern void FlushScroll(); | 33 | extern void FlushScroll(); | |
34 | extern void InsertLine(); | 34 | extern void InsertLine(); | |
35 | @@ -1764,7 +1765,7 @@ static void VTparse() | 35 | @@ -126,6 +127,11 @@ extern int convert_3_to_utf8(); | |
36 | void set_vt_graphics (/*TScreen *screen*/); | |||
37 | #endif | |||
38 | ||||
39 | +static void ansi_modes(XtermWidget, int (*)()); | |||
40 | +static void dpmodes(XtermWidget, void (*)()); | |||
41 | +static void restoremodes(XtermWidget); | |||
42 | +static void savemodes(XtermWidget); | |||
43 | +static void unparseputn(unsigned int, int); | |||
44 | static void VTallocbuf(); | |||
45 | static int finput(); | |||
46 | static void dotext(); | |||
47 | @@ -1764,7 +1770,7 @@ static void VTparse() | |||
36 | } | 48 | } | |
37 | } | 49 | } | |
38 | 50 | |||
39 | -static finput() | 51 | -static finput() | |
40 | +static int finput(void) | 52 | +static int finput(void) | |
41 | { | 53 | { | |
42 | return(doinput()); | 54 | return(doinput()); | |
43 | } | 55 | } | |
44 | @@ -1774,13 +1775,14 @@ static char *v_buffer; /* pointer to ph | 56 | @@ -1774,13 +1780,14 @@ static char *v_buffer; /* pointer to ph | |
45 | static char *v_bufstr = NULL; /* beginning of area to write */ | 57 | static char *v_bufstr = NULL; /* beginning of area to write */ | |
46 | static char *v_bufptr; /* end of area to write */ | 58 | static char *v_bufptr; /* end of area to write */ | |
47 | static char *v_bufend; /* end of physical buffer */ | 59 | static char *v_bufend; /* end of physical buffer */ | |
48 | -#if !defined(linux) && !defined(SVR4) /* dkim@surecom.com */ | 60 | -#if !defined(linux) && !defined(SVR4) /* dkim@surecom.com */ | |
49 | +#ifdef VMS | 61 | +#ifdef VMS | |
50 | #define ptymask() (v_bufptr > v_bufstr ? pty_mask : 0) | 62 | #define ptymask() (v_bufptr > v_bufstr ? pty_mask : 0) | |
51 | #endif | 63 | #endif | |
52 | 64 | |||
53 | /* Write data to the pty as typed by the user, pasted with the mouse, | 65 | /* Write data to the pty as typed by the user, pasted with the mouse, | |
54 | or generated by us in response to a query ESC sequence. */ | 66 | or generated by us in response to a query ESC sequence. */ | |
55 | 67 | |||
56 | +int | 68 | +int | |
57 | v_write(f, d, len) | 69 | v_write(f, d, len) | |
58 | int f; | 70 | int f; | |
59 | char *d; | 71 | char *d; | |
60 | @@ -1802,7 +1804,7 @@ v_write(f, d, len) | 72 | @@ -1802,7 +1809,7 @@ v_write(f, d, len) | |
61 | fprintf(stderr, "\n"); | 73 | fprintf(stderr, "\n"); | |
62 | #endif | 74 | #endif | |
63 | 75 | |||
64 | -#if defined(linux) || defined(SVR4) | 76 | -#if defined(linux) || defined(SVR4) | |
65 | +#ifndef VMS | 77 | +#ifndef VMS | |
66 | if (f != pty_mask) | 78 | if (f != pty_mask) | |
67 | #else | 79 | #else | |
68 | if ((1 << f) != pty_mask) | 80 | if ((1 << f) != pty_mask) | |
69 | @@ -1927,7 +1929,7 @@ v_write(f, d, len) | 81 | @@ -1927,7 +1934,7 @@ v_write(f, d, len) | |
70 | return(c); | 82 | return(c); | |
71 | } | 83 | } | |
72 | 84 | |||
73 | -#if (defined(linux)||defined(SVR4))||(defined(hpux) && OSMAJORVERSION >= 10) | 85 | -#if (defined(linux)||defined(SVR4))||(defined(hpux) && OSMAJORVERSION >= 10) | |
74 | +#ifndef VMS | 86 | +#ifndef VMS | |
75 | static fd_set select_mask; | 87 | static fd_set select_mask; | |
76 | static fd_set write_mask; | 88 | static fd_set write_mask; | |
77 | #else | 89 | #else | |
78 | @@ -1936,6 +1938,7 @@ static int write_mask; | 90 | @@ -1936,6 +1943,7 @@ static int write_mask; | |
79 | #endif | 91 | #endif | |
80 | static int pty_read_bytes; | 92 | static int pty_read_bytes; | |
81 | 93 | |||
82 | +int | 94 | +int | |
83 | in_put() | 95 | in_put() | |
84 | { | 96 | { | |
85 | register TScreen *screen = &term->screen; | 97 | register TScreen *screen = &term->screen; | |
86 | @@ -1943,7 +1946,7 @@ in_put() | 98 | @@ -1943,7 +1951,7 @@ in_put() | |
87 | static struct timeval select_timeout; | 99 | static struct timeval select_timeout; | |
88 | 100 | |||
89 | for( ; ; ) { | 101 | for( ; ; ) { | |
90 | -#if defined(linux)||defined(SVR4)||(defined(hpux) && OSMAJORVERSION >= 10) | 102 | -#if defined(linux)||defined(SVR4)||(defined(hpux) && OSMAJORVERSION >= 10) | |
91 | +#ifndef VMS | 103 | +#ifndef VMS | |
92 | if (FD_ISSET(pty_mask, &select_mask) && eventMode == NORMAL) { | 104 | if (FD_ISSET(pty_mask, &select_mask) && eventMode == NORMAL) { | |
93 | #else | 105 | #else | |
94 | if (select_mask & pty_mask && eventMode == NORMAL) { | 106 | if (select_mask & pty_mask && eventMode == NORMAL) { | |
95 | @@ -2003,7 +2006,7 @@ in_put() | 107 | @@ -2003,7 +2011,7 @@ in_put() | |
96 | /* stop speed reading at some point to look for X stuff */ | 108 | /* stop speed reading at some point to look for X stuff */ | |
97 | /* (4096 is just a random large number.) */ | 109 | /* (4096 is just a random large number.) */ | |
98 | if (pty_read_bytes > 4096) { | 110 | if (pty_read_bytes > 4096) { | |
99 | -#if defined(linux)||defined(SVR4)||(defined(hpux) && OSMAJORVERSION >= 10) | 111 | -#if defined(linux)||defined(SVR4)||(defined(hpux) && OSMAJORVERSION >= 10) | |
100 | +#ifndef VMS | 112 | +#ifndef VMS | |
101 | FD_CLR(pty_mask, &select_mask); | 113 | FD_CLR(pty_mask, &select_mask); | |
102 | #else | 114 | #else | |
103 | select_mask &= ~pty_mask; | 115 | select_mask &= ~pty_mask; | |
104 | @@ -2033,7 +2036,7 @@ in_put() | 116 | @@ -2033,7 +2041,7 @@ in_put() | |
105 | /* Update the masks and, unless X events are already in the queue, | 117 | /* Update the masks and, unless X events are already in the queue, | |
106 | wait for I/O to be possible. */ | 118 | wait for I/O to be possible. */ | |
107 | select_mask = Select_mask; | 119 | select_mask = Select_mask; | |
108 | -#if defined(linux) || defined(SVR4) ||(defined(hpux) && OSMAJORVERSION >= 10) | 120 | -#if defined(linux) || defined(SVR4) ||(defined(hpux) && OSMAJORVERSION >= 10) | |
109 | +#ifndef VMS | 121 | +#ifndef VMS | |
110 | if (v_bufptr > v_bufstr) | 122 | if (v_bufptr > v_bufstr) | |
111 | FD_SET(pty_mask, &write_mask); | 123 | FD_SET(pty_mask, &write_mask); | |
112 | else | 124 | else | |
113 | @@ -2047,7 +2050,7 @@ in_put() | 125 | @@ -2047,7 +2055,7 @@ in_put() | |
114 | /* by sangil's report */ | 126 | /* by sangil's report */ | |
115 | /* #if defined(linux)||defined(SVR4) | 127 | /* #if defined(linux)||defined(SVR4) | |
116 | ||(defined(hpux) && OSMAJORVERSION >= 10) */ | 128 | ||(defined(hpux) && OSMAJORVERSION >= 10) */ | |
117 | -#if defined(linux)||defined(SVR4) | 129 | -#if defined(linux)||defined(SVR4) | |
118 | +#ifndef VMS | 130 | +#ifndef VMS | |
119 | if (QLength (screen->display)) | 131 | if (QLength (screen->display)) | |
120 | { | 132 | { | |
121 | i = select(max_plus1, (fd_set*) &select_mask, (fd_set*) &write_mask, (fd_set *)NULL, (struct timeval *) &select_timeout); | 133 | i = select(max_plus1, (fd_set*) &select_mask, (fd_set*) &write_mask, (fd_set *)NULL, (struct timeval *) &select_timeout); | |
122 | @@ -2073,7 +2076,7 @@ in_put() | 134 | @@ -2073,7 +2081,7 @@ in_put() | |
123 | } | 135 | } | |
124 | 136 | |||
125 | /* if there is room to write more data to the pty, go write more */ | 137 | /* if there is room to write more data to the pty, go write more */ | |
126 | -#if defined(linux)||defined(SVR4)||(defined(hpux) && OSMAJORVERSION >= 10) | 138 | -#if defined(linux)||defined(SVR4)||(defined(hpux) && OSMAJORVERSION >= 10) | |
127 | +#ifndef VMS | 139 | +#ifndef VMS | |
128 | if ((v_bufptr > v_bufstr) && FD_ISSET(pty_mask, &write_mask)) { | 140 | if ((v_bufptr > v_bufstr) && FD_ISSET(pty_mask, &write_mask)) { | |
129 | #else | 141 | #else | |
130 | if (write_mask & ptymask()) { | 142 | if (write_mask & ptymask()) { | |
131 | @@ -2083,7 +2086,7 @@ in_put() | 143 | @@ -2083,7 +2091,7 @@ in_put() | |
132 | 144 | |||
133 | /* if there are X events already in our queue, it | 145 | /* if there are X events already in our queue, it | |
134 | counts as being readable */ | 146 | counts as being readable */ | |
135 | -#if defined(linux)||defined(SVR4)||(defined(hpux) && OSMAJORVERSION >= 10) | 147 | -#if defined(linux)||defined(SVR4)||(defined(hpux) && OSMAJORVERSION >= 10) | |
136 | +#ifndef VMS | 148 | +#ifndef VMS | |
137 | if (QLength(screen->display) || (FD_ISSET(X_mask, &select_mask))) { | 149 | if (QLength(screen->display) || (FD_ISSET(X_mask, &select_mask))) { | |
138 | #else | 150 | #else | |
139 | if (QLength(screen->display) || (select_mask & X_mask)) { | 151 | if (QLength(screen->display) || (select_mask & X_mask)) { | |
140 | @@ -2322,6 +2325,7 @@ WriteText(screen, str, len, flags, fg, b | 152 | @@ -2322,9 +2330,8 @@ WriteText(screen, str, len, flags, fg, b | |
141 | /* | 153 | /* | |
142 | * process ANSI modes set, reset | 154 | * process ANSI modes set, reset | |
143 | */ | 155 | */ | |
144 | +void | 156 | -ansi_modes(termw, func) | |
145 | ansi_modes(termw, func) | 157 | - XtermWidget termw; | |
146 | XtermWidget termw; | 158 | - int (*func)(); | |
147 | int (*func)(); | 159 | +static void | |
148 | @@ -2345,6 +2349,7 @@ ansi_modes(termw, func) | 160 | +ansi_modes(XtermWidget termw, int (*func)()) | |
161 | { | |||
162 | register int i; | |||
163 | ||||
164 | @@ -2345,9 +2352,8 @@ ansi_modes(termw, func) | |||
149 | /* | 165 | /* | |
150 | * process DEC private modes set, reset | 166 | * process DEC private modes set, reset | |
151 | */ | 167 | */ | |
152 | +void | 168 | -dpmodes(termw, func) | |
153 | dpmodes(termw, func) | 169 | - XtermWidget termw; | |
154 | XtermWidget termw; | 170 | - void (*func)(); | |
155 | void (*func)(); | 171 | +static void | |
156 | @@ -2498,6 +2503,7 @@ dpmodes(termw, func) | 172 | +dpmodes(XtermWidget termw, void (*func)()) | |
173 | { | |||
174 | register TScreen *screen = &termw->screen; | |||
175 | register int i, j; | |||
176 | @@ -2498,8 +2504,8 @@ dpmodes(termw, func) | |||
157 | /* | 177 | /* | |
158 | * process xterm private modes save | 178 | * process xterm private modes save | |
159 | */ | 179 | */ | |
160 | +void | 180 | -savemodes(termw) | |
161 | savemodes(termw) | 181 | - XtermWidget termw; | |
162 | XtermWidget termw; | 182 | +static void | |
183 | +savemodes(XtermWidget termw) | |||
163 | { | 184 | { | |
164 | @@ -2564,6 +2570,7 @@ savemodes(termw) | 185 | register TScreen *screen = &termw->screen; | |
186 | register int i; | |||
187 | @@ -2564,8 +2570,8 @@ savemodes(termw) | |||
165 | /* | 188 | /* | |
166 | * process xterm private modes restore | 189 | * process xterm private modes restore | |
167 | */ | 190 | */ | |
168 | +void | 191 | -restoremodes(termw) | |
169 | restoremodes(termw) | 192 | - XtermWidget termw; | |
170 | XtermWidget termw; | 193 | +static void | |
194 | +restoremodes(XtermWidget termw) | |||
171 | { | 195 | { | |
172 | @@ -2711,6 +2718,7 @@ static void bitclr(p, mask) | 196 | register TScreen *screen = &termw->screen; | |
197 | register int i, j; | |||
198 | @@ -2711,9 +2717,8 @@ static void bitclr(p, mask) | |||
173 | *p &= ~mask; | 199 | *p &= ~mask; | |
174 | } | 200 | } | |
175 | 201 | |||
202 | -unparseseq(ap, fd) | |||
203 | - register ANSI *ap; | |||
204 | - int fd; | |||
176 | +void | 205 | +void | |
177 | unparseseq(ap, fd) | 206 | +unparseseq(ANSI *ap, int fd) | |
178 | register ANSI *ap; | 207 | { | |
179 | int fd; | 208 | register int c; | |
180 | @@ -2744,6 +2752,7 @@ unparseseq(ap, fd) | 209 | register int i; | |
210 | @@ -2744,9 +2749,8 @@ unparseseq(ap, fd) | |||
181 | } | 211 | } | |
182 | } | 212 | } | |
183 | 213 | |||
184 | +void | 214 | -unparseputn(n, fd) | |
185 | unparseputn(n, fd) | 215 | -unsigned int n; | |
186 | unsigned int n; | 216 | -int fd; | |
187 | int fd; | 217 | +static void | |
188 | @@ -2756,6 +2765,7 @@ int fd; | 218 | +unparseputn(unsigned int n, int fd) | |
219 | { | |||
220 | unsigned int q; | |||
221 | ||||
222 | @@ -2756,6 +2760,7 @@ int fd; | |||
189 | unparseputc((char) ('0' + (n%10)), fd); | 223 | unparseputc((char) ('0' + (n%10)), fd); | |
190 | } | 224 | } | |
191 | 225 | |||
192 | +void | 226 | +void | |
193 | unparseputc(c, fd) | 227 | unparseputc(c, fd) | |
194 | int c; | 228 | int c; | |
195 | int fd; | 229 | int fd; | |
196 | @@ -2774,6 +2784,7 @@ int fd; | 230 | @@ -2774,6 +2779,7 @@ int fd; | |
197 | } | 231 | } | |
198 | } | 232 | } | |
199 | 233 | |||
200 | +void | 234 | +void | |
201 | unparsefputs (s, fd) | 235 | unparsefputs (s, fd) | |
202 | register char *s; | 236 | register char *s; | |
203 | int fd; | 237 | int fd; | |
204 | @@ -4062,7 +4073,7 @@ int LoadNewFont (screen, nfontname, bfon | 238 | @@ -4062,7 +4068,7 @@ int LoadNewFont (screen, nfontname, bfon | |
205 | 239 | |||
206 | if (fontnum == fontMenu_fontescape && | 240 | if (fontnum == fontMenu_fontescape && | |
207 | nfontname != screen->menu_font_names[fontnum]) { | 241 | nfontname != screen->menu_font_names[fontnum]) { | |
208 | - tmpname = (char *) malloc (strlen(nfontname) + 1); | 242 | - tmpname = (char *) malloc (strlen(nfontname) + 1); | |
209 | + tmpname = malloc (strlen(nfontname) + 1); | 243 | + tmpname = malloc (strlen(nfontname) + 1); | |
210 | if (!tmpname) return 0; | 244 | if (!tmpname) return 0; | |
211 | strcpy (tmpname, nfontname); | 245 | strcpy (tmpname, nfontname); | |
212 | } | 246 | } | |
213 | @@ -4377,7 +4388,7 @@ set_vt_graphics (screen) | 247 | @@ -4377,7 +4383,7 @@ set_vt_graphics (screen) | |
214 | static char gr_valid_code[] = " `ajklmnopqrstuvwx~"; | 248 | static char gr_valid_code[] = " `ajklmnopqrstuvwx~"; | |
215 | 249 | |||
216 | if (!gr_mapping) { | 250 | if (!gr_mapping) { | |
217 | - gr_mapping = (int *)malloc(sizeof(int)*256); | 251 | - gr_mapping = (int *)malloc(sizeof(int)*256); | |
218 | + gr_mapping = malloc(sizeof(int)*256); | 252 | + gr_mapping = malloc(sizeof(int)*256); | |
219 | for(i = 0; i < 256; i++) { | 253 | for(i = 0; i < 256; i++) { | |
220 | gr_mapping[i] = 1; | 254 | gr_mapping[i] = 1; | |
221 | } | 255 | } |
@@ -1,201 +1,232 @@ | @@ -1,201 +1,232 @@ | |||
1 | $NetBSD: patch-ae,v 1.4 2013/11/24 05:53:52 dholland Exp $ | 1 | $NetBSD: patch-ae,v 1.5 2014/09/22 11:56:39 joerg Exp $ | |
2 | 2 | |||
3 | - avoid union wait | 3 | - avoid union wait | |
4 | - force termios on all modern systems | 4 | - force termios on all modern systems | |
5 | - declare void functions void | 5 | - declare void functions void | |
6 | - avoid implicit int | 6 | - avoid implicit int | |
7 | - don't declare own errno | 7 | - don't declare own errno | |
8 | - fix os conditionals (apparently with respect to VMS) | 8 | - fix os conditionals (apparently with respect to VMS) | |
9 | - call execl() and execlp() correctly | 9 | - call execl() and execlp() correctly | |
10 | - don't synthesize vsprintf with fake arguments | 10 | - don't synthesize vsprintf with fake arguments | |
11 | - use ctype.h functions correctly | 11 | - use ctype.h functions correctly | |
12 | 12 | |||
13 | --- main.c.orig 2002-01-09 00:41:11.000000000 +0000 | 13 | --- main.c.orig 2002-01-09 00:41:11.000000000 +0000 | |
14 | +++ main.c | 14 | +++ main.c | |
15 | @@ -239,8 +239,18 @@ static Bool IsPts = False; | 15 | @@ -63,15 +63,7 @@ SOFTWARE. | |
16 | #include <X11/Xaw/SimpleMenu.h> | |||
17 | #include <pwd.h> | |||
18 | #include <ctype.h> | |||
19 | -#ifdef linux | |||
20 | -#ifdef __GLIBC__ | |||
21 | -#if __GLIBC_MINOR__<1 | |||
22 | -#include <termbits.h> | |||
23 | -#else | |||
24 | #include <termios.h> | |||
25 | -#endif /* __GLIBC_MINOR__ */ | |||
26 | -#endif /* __GLIBC__ */ | |||
27 | -#endif | |||
28 | ||||
29 | #ifdef DGUX /* dkim@surecom.com */ | |||
30 | /* DGUX is SVR4 but its SYSV side of TTY has bugs in it */ | |||
31 | @@ -239,8 +231,18 @@ static Bool IsPts = False; | |||
16 | #ifdef SVR4 | 32 | #ifdef SVR4 | |
17 | #define USE_POSIX_WAIT | 33 | #define USE_POSIX_WAIT | |
18 | #endif | 34 | #endif | |
19 | +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ | 35 | +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ | |
20 | + defined(__DragonFly__) || defined(__linux__) | 36 | + defined(__DragonFly__) || defined(__linux__) | |
21 | +#ifndef USE_POSIX_WAIT | 37 | +#ifndef USE_POSIX_WAIT | |
22 | +#define USE_POSIX_WAIT | 38 | +#define USE_POSIX_WAIT | |
23 | +#endif | 39 | +#endif | |
24 | +#ifndef USE_TERMIOS | 40 | +#ifndef USE_TERMIOS | |
25 | +#define USE_TERMIOS | 41 | +#define USE_TERMIOS | |
26 | +#endif | 42 | +#endif | |
27 | +#endif | 43 | +#endif | |
28 | 44 | |||
29 | #include <stdio.h> | 45 | #include <stdio.h> | |
30 | +#include <stdarg.h> | 46 | +#include <stdarg.h> | |
31 | #include <errno.h> | 47 | #include <errno.h> | |
32 | #include <setjmp.h> | 48 | #include <setjmp.h> | |
33 | 49 | |||
34 | @@ -583,6 +593,8 @@ static int tslot; | 50 | @@ -391,6 +393,9 @@ extern char *ptsname(); | |
51 | extern char *strindex (); | |||
52 | extern void HandlePopupMenu(); | |||
53 | ||||
54 | +static void get_terminal (void); | |||
55 | +static void resize(TScreen *screen, char *TermName, char *oldtc, char *newtc); | |||
56 | + | |||
57 | int switchfb[] = {0, 2, 1, 3}; | |||
58 | ||||
59 | static SIGNAL_T reapchild (); | |||
60 | @@ -583,6 +588,8 @@ static int tslot; | |||
35 | #endif /* USE_SYSV_UTMP */ | 61 | #endif /* USE_SYSV_UTMP */ | |
36 | static jmp_buf env; | 62 | static jmp_buf env; | |
37 | 63 | |||
38 | +static void spawn (void); | 64 | +static void spawn (void); | |
39 | + | 65 | + | |
40 | char *ProgramName; | 66 | char *ProgramName; | |
41 | Boolean sunFunctionKeys; | 67 | Boolean sunFunctionKeys; | |
42 | 68 | |||
43 | @@ -805,9 +817,9 @@ static char *message[] = { | 69 | @@ -805,9 +812,9 @@ static char *message[] = { | |
44 | "will be started. Options that start with a plus sign (+) restore the default.", | 70 | "will be started. Options that start with a plus sign (+) restore the default.", | |
45 | NULL}; | 71 | NULL}; | |
46 | 72 | |||
47 | -#ifndef USE_TERMIOS | 73 | -#ifndef USE_TERMIOS | |
48 | -static remove_termcap_entry (); | 74 | -static remove_termcap_entry (); | |
49 | -#endif | 75 | -#endif | |
50 | +/*#ifndef USE_TERMIOS*/ | 76 | +/*#ifndef USE_TERMIOS*/ | |
51 | +static void remove_termcap_entry (char *, const char *); | 77 | +static void remove_termcap_entry (char *, const char *); | |
52 | +/*#endif*/ | 78 | +/*#endif*/ | |
53 | 79 | |||
54 | static int abbrev (tst, cmp) | 80 | static int abbrev (tst, cmp) | |
55 | char *tst, *cmp; | 81 | char *tst, *cmp; | |
56 | @@ -816,7 +828,7 @@ static int abbrev (tst, cmp) | 82 | @@ -816,7 +823,7 @@ static int abbrev (tst, cmp) | |
57 | return ((len >= 2) && (!strncmp(tst, cmp, len))); | 83 | return ((len >= 2) && (!strncmp(tst, cmp, len))); | |
58 | } | 84 | } | |
59 | 85 | |||
60 | -static Syntax (badOption) | 86 | -static Syntax (badOption) | |
61 | +static void Syntax (badOption) | 87 | +static void Syntax (badOption) | |
62 | char *badOption; | 88 | char *badOption; | |
63 | { | 89 | { | |
64 | struct _options *opt; | 90 | struct _options *opt; | |
65 | @@ -842,13 +854,13 @@ static Syntax (badOption) | 91 | @@ -842,13 +849,13 @@ static Syntax (badOption) | |
66 | exit (1); | 92 | exit (1); | |
67 | } | 93 | } | |
68 | 94 | |||
69 | -static Version () | 95 | -static Version () | |
70 | +static void Version () | 96 | +static void Version () | |
71 | { | 97 | { | |
72 | printf("%s %s %s %s\n", HANTERM_PRODUCT, HANTERM_VERSION, | 98 | printf("%s %s %s %s\n", HANTERM_PRODUCT, HANTERM_VERSION, | |
73 | HANTERM_RELEASE, HANTERM_RELEASEDATE); | 99 | HANTERM_RELEASE, HANTERM_RELEASEDATE); | |
74 | exit (0); | 100 | exit (0); | |
75 | } | 101 | } | |
76 | -static Help () | 102 | -static Help () | |
77 | +static void Help () | 103 | +static void Help () | |
78 | { | 104 | { | |
79 | struct _options *opt; | 105 | struct _options *opt; | |
80 | char **cpp; | 106 | char **cpp; | |
81 | @@ -960,6 +972,7 @@ XtActionsRec actionProcs[] = { | 107 | @@ -960,6 +967,7 @@ XtActionsRec actionProcs[] = { | |
82 | 108 | |||
83 | Atom wm_delete_window; | 109 | Atom wm_delete_window; | |
84 | 110 | |||
85 | +int | 111 | +int | |
86 | main (argc, argv) | 112 | main (argc, argv) | |
87 | int argc; | 113 | int argc; | |
88 | char **argv; | 114 | char **argv; | |
89 | @@ -1527,7 +1540,8 @@ char **argv; | 115 | @@ -1527,7 +1535,8 @@ char **argv; | |
90 | if (ioctl (pty, FIONBIO, (char *)&mode) == -1) SysError (ERROR_FIONBIO); | 116 | if (ioctl (pty, FIONBIO, (char *)&mode) == -1) SysError (ERROR_FIONBIO); | |
91 | #endif /* USE_SYSV_TERMIO */ | 117 | #endif /* USE_SYSV_TERMIO */ | |
92 | 118 | |||
93 | -#if defined(linux)||defined(SVR4)||(defined(hpux)&&OSMAJORVERSION>=10) | 119 | -#if defined(linux)||defined(SVR4)||(defined(hpux)&&OSMAJORVERSION>=10) | |
94 | + | 120 | + | |
95 | +#ifndef VMS | 121 | +#ifndef VMS | |
96 | pty_mask = pty; | 122 | pty_mask = pty; | |
97 | X_mask = Xsocket; | 123 | X_mask = Xsocket; | |
98 | FD_ZERO(&Select_mask); | 124 | FD_ZERO(&Select_mask); | |
99 | @@ -1566,6 +1580,7 @@ char *name; | 125 | @@ -1566,6 +1575,7 @@ char *name; | |
100 | * has problems, we can re-enter this function and get another one. | 126 | * has problems, we can re-enter this function and get another one. | |
101 | */ | 127 | */ | |
102 | 128 | |||
103 | +int | 129 | +int | |
104 | get_pty (pty) | 130 | get_pty (pty) | |
105 | int *pty; | 131 | int *pty; | |
106 | { | 132 | { | |
107 | @@ -1730,6 +1745,7 @@ int pty_search(pty) | 133 | @@ -1730,6 +1740,7 @@ int pty_search(pty) | |
108 | return 1; | 134 | return 1; | |
109 | } | 135 | } | |
110 | 136 | |||
111 | +void | 137 | +static void | |
112 | get_terminal () | 138 | get_terminal () | |
113 | /* | 139 | /* | |
114 | * sets up X and initializes the terminal structure except for term.buf.fildes. | 140 | * sets up X and initializes the terminal structure except for term.buf.fildes. | |
115 | @@ -1854,7 +1870,7 @@ void first_map_occurred () | 141 | @@ -1854,7 +1865,7 @@ void first_map_occurred () | |
116 | #endif /* USE_HANDSHAKE else !USE_HANDSHAKE */ | 142 | #endif /* USE_HANDSHAKE else !USE_HANDSHAKE */ | |
117 | 143 | |||
118 | 144 | |||
119 | -spawn () | 145 | -spawn () | |
120 | +static void spawn (void) | 146 | +static void spawn (void) | |
121 | /* | 147 | /* | |
122 | * Inits pty and tty and forks a login process. | 148 | * Inits pty and tty and forks a login process. | |
123 | * Does not close fd Xsocket. | 149 | * Does not close fd Xsocket. | |
124 | @@ -2983,10 +2999,10 @@ spawn () | 150 | @@ -2983,10 +2994,10 @@ spawn () | |
125 | 151 | |||
126 | #ifdef USE_LOGIN_DASH_P | 152 | #ifdef USE_LOGIN_DASH_P | |
127 | if (term->misc.login_shell && pw && added_utmp_entry) | 153 | if (term->misc.login_shell && pw && added_utmp_entry) | |
128 | - execl (bin_login, "login", "-p", "-f", pw->pw_name, 0); | 154 | - execl (bin_login, "login", "-p", "-f", pw->pw_name, 0); | |
129 | + execl (bin_login, "login", "-p", "-f", pw->pw_name, (void *)NULL); | 155 | + execl (bin_login, "login", "-p", "-f", pw->pw_name, (void *)NULL); | |
130 | #endif | 156 | #endif | |
131 | execlp (ptr, (term->misc.login_shell ? shname_minus : shname), | 157 | execlp (ptr, (term->misc.login_shell ? shname_minus : shname), | |
132 | - 0); | 158 | - 0); | |
133 | + (void *)NULL); | 159 | + (void *)NULL); | |
134 | 160 | |||
135 | /* Exec failed. */ | 161 | /* Exec failed. */ | |
136 | fprintf (stderr, "%s: Could not exec %s!\n", xterm_name, ptr); | 162 | fprintf (stderr, "%s: Could not exec %s!\n", xterm_name, ptr); | |
137 | @@ -3235,6 +3251,7 @@ Exit(n) | 163 | @@ -3235,10 +3246,8 @@ Exit(n) | |
138 | } | 164 | } | |
139 | 165 | |||
140 | /* ARGSUSED */ | 166 | /* ARGSUSED */ | |
141 | +void | 167 | -resize(screen, TermName, oldtc, newtc) | |
142 | resize(screen, TermName, oldtc, newtc) | 168 | -TScreen *screen; | |
143 | TScreen *screen; | 169 | -char *TermName; | |
144 | char *TermName; | 170 | -register char *oldtc, *newtc; | |
145 | @@ -3329,18 +3346,20 @@ static SIGNAL_T reapchild (n) | 171 | +static void | |
172 | +resize(TScreen *screen, char *TermName, char *oldtc, char *newtc) | |||
173 | { | |||
174 | #ifndef USE_SYSV_ENVVARS | |||
175 | register char *ptr1, *ptr2; | |||
176 | @@ -3329,18 +3338,20 @@ static SIGNAL_T reapchild (n) | |||
146 | } | 177 | } | |
147 | 178 | |||
148 | /* VARARGS1 */ | 179 | /* VARARGS1 */ | |
149 | -consolepr(fmt,x0,x1,x2,x3,x4,x5,x6,x7,x8,x9) | 180 | -consolepr(fmt,x0,x1,x2,x3,x4,x5,x6,x7,x8,x9) | |
150 | -char *fmt; | 181 | -char *fmt; | |
151 | +void | 182 | +void | |
152 | +consolepr(const char *fmt, ...) | 183 | +consolepr(const char *fmt, ...) | |
153 | { | 184 | { | |
154 | - extern int errno; | 185 | - extern int errno; | |
155 | extern char *SysErrorMsg(); | 186 | extern char *SysErrorMsg(); | |
156 | int oerrno; | 187 | int oerrno; | |
157 | int f; | 188 | int f; | |
158 | char buf[ BUFSIZ ]; | 189 | char buf[ BUFSIZ ]; | |
159 | + va_list ap; | 190 | + va_list ap; | |
160 | 191 | |||
161 | oerrno = errno; | 192 | oerrno = errno; | |
162 | strcpy(buf, "hanterm: "); | 193 | strcpy(buf, "hanterm: "); | |
163 | - sprintf(buf+strlen(buf), fmt, x0,x1,x2,x3,x4,x5,x6,x7,x8,x9); | 194 | - sprintf(buf+strlen(buf), fmt, x0,x1,x2,x3,x4,x5,x6,x7,x8,x9); | |
164 | + va_start(ap, fmt); | 195 | + va_start(ap, fmt); | |
165 | + vsnprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), fmt, ap); | 196 | + vsnprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), fmt, ap); | |
166 | + va_end(ap); | 197 | + va_end(ap); | |
167 | strcat(buf, ": "); | 198 | strcat(buf, ": "); | |
168 | strcat(buf, SysErrorMsg (oerrno)); | 199 | strcat(buf, SysErrorMsg (oerrno)); | |
169 | strcat(buf, "\n"); | 200 | strcat(buf, "\n"); | |
170 | @@ -3356,10 +3375,8 @@ char *fmt; | 201 | @@ -3356,10 +3367,8 @@ char *fmt; | |
171 | } | 202 | } | |
172 | 203 | |||
173 | 204 | |||
174 | -#ifndef USE_TERMIOS | 205 | -#ifndef USE_TERMIOS | |
175 | -static remove_termcap_entry (buf, str) | 206 | -static remove_termcap_entry (buf, str) | |
176 | - char *buf; | 207 | - char *buf; | |
177 | - char *str; | 208 | - char *str; | |
178 | +/*#ifndef USE_TERMIOS*/ | 209 | +/*#ifndef USE_TERMIOS*/ | |
179 | +static void remove_termcap_entry (char *buf, const char *str) | 210 | +static void remove_termcap_entry (char *buf, const char *str) | |
180 | { | 211 | { | |
181 | register char *strinbuf; | 212 | register char *strinbuf; | |
182 | 213 | |||
183 | @@ -3377,7 +3394,7 @@ static remove_termcap_entry (buf, str) | 214 | @@ -3377,7 +3386,7 @@ static remove_termcap_entry (buf, str) | |
184 | } | 215 | } | |
185 | return; | 216 | return; | |
186 | } | 217 | } | |
187 | -#endif | 218 | -#endif | |
188 | +/*#endif*/ | 219 | +/*#endif*/ | |
189 | 220 | |||
190 | /* | 221 | /* | |
191 | * parse_tty_modes accepts lines of the following form: | 222 | * parse_tty_modes accepts lines of the following form: | |
192 | @@ -3396,7 +3413,8 @@ static int parse_tty_modes (s, modelist) | 223 | @@ -3396,7 +3405,8 @@ static int parse_tty_modes (s, modelist) | |
193 | int count = 0; | 224 | int count = 0; | |
194 | 225 | |||
195 | while (1) { | 226 | while (1) { | |
196 | - while (*s && isascii(*s) && isspace(*s)) s++; | 227 | - while (*s && isascii(*s) && isspace(*s)) s++; | |
197 | + while (*s && isascii((unsigned char)*s) && isspace((unsigned char)*s)) | 228 | + while (*s && isascii((unsigned char)*s) && isspace((unsigned char)*s)) | |
198 | + s++; | 229 | + s++; | |
199 | if (!*s) return count; | 230 | if (!*s) return count; | |
200 | 231 | |||
201 | for (mp = modelist; mp->name; mp++) { | 232 | for (mp = modelist; mp->name; mp++) { |