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
|
$NetBSD: patch-am,v 1.2 2006/10/09 20:04:38 mlelstv Exp $
--- src/lib/fte/x11.c.orig 1993-04-14 21:44:56.000000000 +0200
+++ src/lib/fte/x11.c
@@ -12,6 +12,7 @@ Author: 1988 Jeffrey M. Hsu
#ifdef HAS_X11
# include <sys/time.h>
+# include <sys/select.h>
# include "util.h"
@@ -62,6 +63,10 @@ typedef struct x11info {
#define DEVDEP(g) (*((X11devdep *) (g)->devdep))
static void linear_arc( );
+static void initlinestyles( );
+static void initcolors( );
+static void X_ScreentoData( );
+
static Display *display;
static GC xorgc;
static char *xlinestyles[NUMLINESTYLES] = { /* test patterns XXX */
@@ -302,7 +307,7 @@ GRAPH *graph;
return (0);
}
-static
+static void
initlinestyles()
{
@@ -318,7 +323,7 @@ initlinestyles()
return;
}
-static
+static void
initcolors(graph)
GRAPH *graph;
{
@@ -773,12 +778,15 @@ GRAPH *graph;
graph->commandline, fx0, fx1, fy0, fy1);
}
+/* don't use the following if using GNU Readline - AV */
+#ifndef HAS_GNUREADLINE
/* hack for Gordon Jacobs */
/* add to history list if plothistory is set */
if (cp_getvar("plothistory", VT_BOOL, (char *) &dummy)) {
wl = cp_parse(buf);
(void) cp_addhistent(cp_event++, wl);
}
+#endif /* HAS_GNUREADLINE */
(void) cp_evloop(buf);
@@ -921,7 +929,8 @@ X11_Input(request, response)
{
XEvent ev;
- int nfds, readfds;
+ int nfds;
+ fd_set readfds;
switch (request->option) {
case char_option:
@@ -938,14 +947,15 @@ X11_Input(request, response)
XtDispatchEvent(&ev);
}
- readfds = 1 << fileno(request->fp) |
- 1 << ConnectionNumber(display);
+ FD_ZERO(&readfds);
+ FD_SET(fileno(request->fp), &readfds);
+ FD_SET(ConnectionNumber(display), &readfds);
/* block on ConnectionNumber and request->fp */
- select(nfds + 1, &readfds, (int *) NULL, (int *) NULL, NULL);
+ select(nfds + 1, &readfds, NULL, NULL, NULL);
/* handle X events first */
- if (readfds & (1 << ConnectionNumber(display))) {
+ if (FD_ISSET(ConnectionNumber(display),&readfds)) {
/* handle ALL X events */
while (XtPending()) {
XtNextEvent(&ev);
@@ -953,7 +963,7 @@ X11_Input(request, response)
}
}
- if (readfds & (1 << fileno(request->fp))) {
+ if (FD_ISSET(fileno(request->fp), &readfds)) {
response->reply.ch = inchar(request->fp);
goto out;
}
@@ -995,10 +1005,11 @@ out:
}
-static X_ScreentoData(graph, x, y, fx, fy)
-GRAPH *graph;
-int x,y;
-double *fx, *fy;
+static void
+X_ScreentoData(graph, x, y, fx, fy)
+ GRAPH *graph;
+ int x,y;
+ double *fx, *fy;
{
double lmin, lmax;
|