$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 +# include # 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;