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
|
$NetBSD: patch-aa,v 1.4 2012/10/26 20:39:16 joerg Exp $
--- unixscr.c.orig 1999-04-28 23:12:04.000000000 +0000
+++ unixscr.c
@@ -17,10 +17,13 @@
#include <stdlib.h>
#include <curses.h>
#include <X11/Xlib.h>
+#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <X11/Xatom.h>
#include <signal.h>
#include <sys/types.h>
+#include <string.h>
+#include <unistd.h>
#ifdef _AIX
#include <sys/select.h>
#endif
@@ -44,6 +47,8 @@
# define FNDELAY O_NONBLOCK
#endif
+typedef void (*sighandler_t)(int);
+
/* Check if there is a character waiting for us. */
#define input_pending() (ioctl(0,FIONREAD,&iocount),(int)iocount)
@@ -82,7 +87,7 @@ static int fullscreen = 0;
static int sharecolor = 0;
static int privatecolor = 0;
static int fixcolors = 0;
-static int sync = 0; /* Run X events synchronously (debugging) */
+static int my_sync = 0; /* Run X events synchronously (debugging) */
int slowdisplay = 0; /* We have a slow display, so don't print too much */
static int simple_input = 0; /* Use simple input (debugging) */
static char *Xdisplay = "";
@@ -179,7 +184,7 @@ int *i;
slowdisplay = 1;
return 1;
} else if (strcmp(argv[*i],"-sync")==0) {
- sync = 1;
+ my_sync = 1;
return 1;
} else if (strcmp(argv[*i],"-private")==0) {
privatecolor = 1;
@@ -241,7 +246,7 @@ UnixInit()
initdacbox();
if (!simple_input) {
- signal(SIGINT,(__sighandler_t)goodbye);
+ signal(SIGINT,(sighandler_t)goodbye);
}
signal(SIGFPE, fpe_handler);
/*
@@ -446,7 +451,7 @@ initUnixWindow()
XGeometry(Xdp, Xdscreen, Xgeometry, DEFXY, 0, 1, 1, 0, 0,
&Xwinx, &Xwiny, &Xwinwidth, &Xwinheight);
}
- if (sync) {
+ if (my_sync) {
XSynchronize(Xdp,True);
}
XSetErrorHandler(errhand);
@@ -1579,7 +1584,7 @@ xhandleevents()
case XK_Control_L:
case XK_Control_R:
ctl_mode = 1;
- return;
+ return 0;
case XK_Shift_L:
case XK_Shift_R:
shift_mode = 1;
@@ -1587,95 +1592,95 @@ xhandleevents()
case XK_Home:
case XK_R7:
xbufkey = ctl_mode ? CTL_HOME : HOME;
- return;
+ return 0;
case XK_Left:
case XK_R10:
xbufkey = ctl_mode ? LEFT_ARROW_2 : LEFT_ARROW;
- return;
+ return 0;
case XK_Right:
case XK_R12:
xbufkey = ctl_mode ? RIGHT_ARROW_2 : RIGHT_ARROW;
- return;
+ return 0;
case XK_Down:
case XK_R14:
xbufkey = ctl_mode ? DOWN_ARROW_2 : DOWN_ARROW;
- return;
+ return 0;
case XK_Up:
case XK_R8:
xbufkey = ctl_mode ? UP_ARROW_2 : UP_ARROW;
- return;
+ return 0;
case XK_Insert:
xbufkey = ctl_mode ? CTL_INSERT : INSERT;
- return;
+ return 0;
case XK_Delete:
xbufkey = ctl_mode ? CTL_DEL : DELETE;
- return;
+ return 0;
case XK_End:
case XK_R13:
xbufkey = ctl_mode ? CTL_END : END;
- return;
+ return 0;
case XK_Help:
xbufkey = F1;
- return;
+ return 0;
case XK_Prior:
case XK_R9:
xbufkey = ctl_mode ? CTL_PAGE_UP : PAGE_UP;
- return;
+ return 0;
case XK_Next:
case XK_R15:
xbufkey = ctl_mode ? CTL_PAGE_DOWN : PAGE_DOWN;
- return;
+ return 0;
case XK_F1:
case XK_L1:
xbufkey = shift_mode ? SF1: F1;
- return;
+ return 0;
case XK_F2:
case XK_L2:
xbufkey = shift_mode ? SF2: F2;
- return;
+ return 0;
case XK_F3:
case XK_L3:
xbufkey = shift_mode ? SF3: F3;
- return;
+ return 0;
case XK_F4:
case XK_L4:
xbufkey = shift_mode ? SF4: F4;
- return;
+ return 0;
case XK_F5:
case XK_L5:
xbufkey = shift_mode ? SF5: F5;
- return;
+ return 0;
case XK_F6:
case XK_L6:
xbufkey = shift_mode ? SF6: F6;
- return;
+ return 0;
case XK_F7:
case XK_L7:
xbufkey = shift_mode ? SF7: F7;
- return;
+ return 0;
case XK_F8:
case XK_L8:
xbufkey = shift_mode ? SF8: F8;
- return;
+ return 0;
case XK_F9:
case XK_L9:
xbufkey = shift_mode ? SF9: F9;
- return;
+ return 0;
case XK_F10:
case XK_L10:
xbufkey = shift_mode ? SF10: F10;
- return;
+ return 0;
case '+':
xbufkey = ctl_mode ? CTL_PLUS : '+';
- return;
+ return 0;
case '-':
xbufkey = ctl_mode ? CTL_MINUS : '-';
- return;
+ return 0;
break;
case XK_Return:
case XK_KP_Enter:
xbufkey = ctl_mode ? CTL('T') : '\n';
- return;
+ return 0;
}
if (charcount==1) {
xbufkey = buffer[0];
@@ -1847,7 +1852,7 @@ xhandleevents()
}
}
}
-
+ return 0;
}
#define w_root Xroot
@@ -2068,12 +2073,12 @@ xgetfont()
void
shell_to_dos()
{
- __sighandler_t sigint;
+ sighandler_t sigint;
char *shell;
char *argv[2];
int pid, donepid;
- sigint = (__sighandler_t)signal(SIGINT, SIG_IGN);
+ sigint = (sighandler_t)signal(SIGINT, SIG_IGN);
shell = getenv("SHELL");
if (shell==NULL) {
shell = SHELL;
@@ -2121,7 +2126,7 @@ shell_to_dos()
fcntl(0,F_SETFL,FNDELAY);
}
- signal(SIGINT, (__sighandler_t)sigint);
+ signal(SIGINT, (sighandler_t)sigint);
putchar('\n');
}
@@ -2146,7 +2151,7 @@ schedulealarm(soon)
int soon;
{
if (!fastmode) return;
- signal(SIGALRM, (__sighandler_t)setredrawscreen);
+ signal(SIGALRM, (sighandler_t)setredrawscreen);
if (soon) {
alarm(1);
} else {
|