diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-02-17 13:10:24 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-02-17 13:10:24 -0800 |
commit | ba6892385cc20505bd20e807d37597e699571948 (patch) | |
tree | d6d5d08356012473f0fb78a48f615977a2ea5e17 /xconsole.c | |
parent | 5b1208eb8c2f21a07518a6757408faf30c98dfe2 (diff) |
Remove ifdefs for non-Solaris SysV systems
Also removes USE_OSM which was only defined for these systems
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'xconsole.c')
-rw-r--r-- | xconsole.c | 112 |
1 files changed, 0 insertions, 112 deletions
@@ -178,20 +178,10 @@ static int tty_fd, pty_fd; # endif #endif -#if (defined(SVR4) && !defined(sun)) || (defined(SYSV) && defined(i386)) -#define USE_OSM -#include <signal.h> -#endif - #ifdef USE_PTY static int get_pty(int *pty, int *tty); #endif -#ifdef USE_OSM -static FILE *osm_pipe(void); -static int child_pid; -#endif - /* Copied from xterm/ptyx.h */ #ifndef PTYCHAR1 #define PTYCHAR1 "pqrstuvwxyzPQRSTUVWXYZ" @@ -249,11 +239,6 @@ OpenConsole(void) } #endif /* USE_PTY */ } -#ifdef USE_OSM - /* Don't have to be owner of /dev/console when using /dev/osm. */ - if (!input) - input = osm_pipe(); -#endif if (input && app_resources.verbose) { char *hostname; @@ -316,39 +301,13 @@ CloseConsole (void) #endif } -#ifdef USE_OSM -static void -KillChild(int sig) -{ - if (child_pid > 0) - kill(child_pid, SIGTERM); - _exit(0); -} -#endif - /*ARGSUSED*/ static void _X_NORETURN Quit(Widget widget, XEvent *event, String *params, Cardinal *num_params) { -#ifdef USE_OSM - if (child_pid > 0) - kill(child_pid, SIGTERM); -#endif exit (0); } -#ifdef USE_OSM -static int (*ioerror)(Display *); - -static int -IOError(Display *dpy) -{ - if (child_pid > 0) - kill(child_pid, SIGTERM); - return (*ioerror)(dpy); -} -#endif - static void Notify(void) { @@ -684,9 +643,6 @@ main(int argc, char *argv[]) ConvertSelection, LoseSelection, NULL); OpenConsole (); } -#ifdef USE_OSM - ioerror = XSetIOErrorHandler(IOError); -#endif XtMainLoop (); return 0; } @@ -890,71 +846,3 @@ get_pty(int *pty, int *tty) #endif /* HAS_OPENPTY */ } #endif - -#ifdef USE_OSM -/* - * On SYSV386 there is a special device, /dev/osm, where system messages - * are sent. Problem is that we can't perform a select(2) on this device. - * So this routine creates a streams-pty where one end reads the device and - * sends the output to xconsole. - */ - -#define OSM_DEVICE "/dev/osm" - -static FILE * -osm_pipe(void) -{ - int tty; - char ttydev[64]; - - if (access(OSM_DEVICE, R_OK) < 0) - return NULL; -#if defined (_AIX) - if ((tty = open("/dev/ptc", O_RDWR)) < 0) -#else - if ((tty = open("/dev/ptmx", O_RDWR)) < 0) -#endif - return NULL; - - grantpt(tty); - unlockpt(tty); - strcpy(ttydev, (char *)ptsname(tty)); - - if ((child_pid = fork()) == 0) - { - int pty, osm, nbytes, skip; - char cbuf[128]; - - skip = 0; -#ifndef NO_READAHEAD - osm = open(OSM_DEVICE, O_RDONLY); - if (osm >= 0) - { - while ((nbytes = read(osm, cbuf, sizeof(cbuf))) > 0) - skip += nbytes; - close(osm); - } -#endif - pty = open(ttydev, O_RDWR); - if (pty < 0) - exit(1); - osm = open(OSM_DEVICE, O_RDONLY); - if (osm < 0) - exit(1); - for (nbytes = 0; skip > 0 && nbytes >= 0; skip -= nbytes) - { - nbytes = skip; - if (nbytes > sizeof(cbuf)) - nbytes = sizeof(cbuf); - nbytes = read(osm, cbuf, nbytes); - } - while ((nbytes = read(osm, cbuf, sizeof(cbuf))) >= 0) - write(pty, cbuf, nbytes); - exit(0); - } - signal(SIGHUP, KillChild); - signal(SIGINT, KillChild); - signal(SIGTERM, KillChild); - return fdopen(tty, "r"); -} -#endif /* USE_OSM */ |