234 lines
5.3 KiB
Text
234 lines
5.3 KiB
Text
$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 {
|