patch for support for xterm -C on sgi
Sjoerd Mullender
sjoerd at cwi.nl
Wed Mar 13 23:58:46 AEST 1991
I have made a change to xterm to get support for the -C flag on SGI
systems. If xterm is given the -C flag, it acts as a console window,
like "wsh -Z3".
I should add that I made these changes not knowing how things worked. I
tried it, and it seems to work. I get all console messages in my
console xterm. It has been running like this for a few months now, both
under Irix 3.3.1 and 3.3.2.
The diffs are based on a fully patched X11R4 xterm (MIT patch 18, 3
unofficial patches for X11 on SGI from Jim Helman <jim at kaos.stanford.edu>).
I should also emphasize that these patches are unofficial.
Some extra remarks. The DISPLAY variable must point to the local
system. To be more precise, the DISPLAY variable must start with a
colon. If it doesn't, the -C flag is silently ignored.
I have also defined HAS_BSD_GROUPS. This means that the shell that is
started is member of multiple groups (no need to use multgrps or
newgrp).
Anyway, enjoy.
*** main.c- Thu Dec 6 14:15:16 1990
--- main.c Tue Feb 5 15:09:15 1991
***************
*** 94,99 ****
--- 94,102 ----
#define HAS_BSD_GROUPS
#include <sys/ptyio.h>
#endif
+ #ifdef sgi
+ #define HAS_BSD_GROUPS
+ #endif
#endif /* SYSV */
#ifndef SYSV /* BSD systems */
***************
*** 299,307 ****
static int inhibit;
static char passedPty[2]; /* name if pty if slave */
! #ifdef TIOCCONS
static int Console;
! #endif /* TIOCCONS */
#ifndef USE_SYSV_UTMP
static int tslot;
#endif /* USE_SYSV_UTMP */
--- 302,310 ----
static int inhibit;
static char passedPty[2]; /* name if pty if slave */
! #if defined(TIOCCONS) || defined(sgi)
static int Console;
! #endif /* TIOCCONS || sgi */
#ifndef USE_SYSV_UTMP
static int tslot;
#endif /* USE_SYSV_UTMP */
***************
*** 719,727 ****
Help ();
/* NOTREACHED */
case 'C':
! #ifdef TIOCCONS
Console = TRUE;
! #endif /* TIOCCONS */
continue;
case 'S':
sscanf(*argv + 2, "%c%c%d", passedPty, passedPty+1,
--- 722,730 ----
Help ();
/* NOTREACHED */
case 'C':
! #if defined(TIOCCONS) || defined(sgi)
Console = TRUE;
! #endif /* TIOCCONS || sgi */
continue;
case 'S':
sscanf(*argv + 2, "%c%c%d", passedPty, passedPty+1,
***************
*** 934,946 ****
# define minor(x) ((int)((x)&0377)) /* from MIPS sys/types.h */
struct stat fstat_buf;
! *pty = open ("/dev/ptc", O_RDWR);
! if (*pty < 0 || (fstat (*pty, &fstat_buf)) < 0) {
! return(1);
}
- sprintf (ttydev, "/dev/ttyq%d", minor(fstat_buf.st_rdev));
- sprintf (ptydev, "/dev/ptyq%d", minor(fstat_buf.st_rdev));
/* got one! */
return(0);
#else /* not sgi */
--- 937,958 ----
# define minor(x) ((int)((x)&0377)) /* from MIPS sys/types.h */
struct stat fstat_buf;
+ register TScreen *screen = &term->screen;
! /* only allow console to be on local system. -sjoerd */
! if (Console && *XDisplayString(screen->display) != ':')
! Console = 0;
! if (Console && (*pty = open ("/dev/grconc", O_RDWR)) >= 0) {
! strcpy (ttydev, "/dev/grcons");
! strcpy (ptydev, "/dev/grconc");
! } else {
! *pty = open ("/dev/ptc", O_RDWR);
! if (*pty < 0 || (fstat (*pty, &fstat_buf)) < 0) {
! return(1);
! }
! sprintf (ttydev, "/dev/ttyq%d", minor(fstat_buf.st_rdev));
! sprintf (ptydev, "/dev/ptyq%d", minor(fstat_buf.st_rdev));
}
/* got one! */
return(0);
#else /* not sgi */
--
Sjoerd Mullender
CWI, dept. CST, Kruislaan 413, 1098 SJ Amsterdam, Netherlands
email: sjoerd at cwi.nl fax: +31 20 592 4199
phone: +31 20 592 4132 telex: 12571 mactr nl
More information about the Comp.sys.sgi
mailing list