*** ipc_ucb.c.orig	Sat Jun 12 21:00:53 1993
--- ipc_ucb.c	Sat Jun 12 22:54:42 1993
***************
*** 12,18 ****
  #include "ipc.h"
  
  static char pty_name[12];
! static int fdin_mask, num_fds;
  static struct timeval time_out = {1L, 0L};
  static struct timeval *tp;
  
--- 12,19 ----
  #include "ipc.h"
  
  static char pty_name[12];
! static int num_fds;
! static fd_set fdin_mask;
  static struct timeval time_out = {1L, 0L};
  static struct timeval *tp;
  
***************
*** 20,37 ****
  ipc_init(tty_fd, cmd_fd)
  int tty_fd, cmd_fd;
  {
! 	int fdout, fdin, fdex;
  
! 	fdout = 0;
! 	fdex = 0;
! 	fdin_mask = 1;			/* the keyboard */
  	num_fds = 1;
  	if (tty_fd != -1) {		/* the TTY */
! 		fdin_mask |= (1 << tty_fd);
  		num_fds = tty_fd +1;
  	}
  	if (cmd_fd != -1) {		/* the shell script */
! 		fdin_mask |= (1 << cmd_fd);
  		if (cmd_fd > tty_fd)
  			num_fds = cmd_fd +1;
  		tp = &time_out;
--- 21,39 ----
  ipc_init(tty_fd, cmd_fd)
  int tty_fd, cmd_fd;
  {
! 	fd_set fdout, fdin, fdex;
  
! 	FD_ZERO(&fdout);
! 	FD_ZERO(&fdex);
! 	FD_ZERO(&fdin_mask);
! 	FD_SET(0,&fdin_mask);			/* the keyboard */
  	num_fds = 1;
  	if (tty_fd != -1) {		/* the TTY */
! 		FD_SET(tty_fd,&fdin_mask);
  		num_fds = tty_fd +1;
  	}
  	if (cmd_fd != -1) {		/* the shell script */
! 		FD_SET(cmd_fd,&fdin_mask);
  		if (cmd_fd > tty_fd)
  			num_fds = cmd_fd +1;
  		tp = &time_out;
***************
*** 45,63 ****
  ipc_poll(tty_fd, cmd_fd)
  int tty_fd, cmd_fd;
  {
! 	int ret_code, fdout, fdin, fdex;
  
  	ret_code = 0;
  	fdin = fdin_mask;
  	select(num_fds, &fdin, &fdout, &fdex, tp);
! 
! 	if (fdin & 1)
  		ret_code |= KEY_READY;
  
! 	if (tty_fd != -1 && (fdin & (1 << tty_fd)))
  		ret_code |= TTY_READY;
  
! 	if (cmd_fd != -1 && (fdin & (1 << cmd_fd)))
  		ret_code |= CMD_READY;
  
  	return(ret_code);
--- 47,68 ----
  ipc_poll(tty_fd, cmd_fd)
  int tty_fd, cmd_fd;
  {
! 	int ret_code;
! 	fd_set fdout, fdin, fdex;
  
  	ret_code = 0;
+ 	FD_ZERO(&fdout);
+ 	FD_ZERO(&fdex);
  	fdin = fdin_mask;
  	select(num_fds, &fdin, &fdout, &fdex, tp);
! 	
! 	if (FD_ISSET(0,&fdin))
  		ret_code |= KEY_READY;
  
! 	if (tty_fd != -1 && FD_ISSET(tty_fd,&fdin))
  		ret_code |= TTY_READY;
  
! 	if (cmd_fd != -1 && FD_ISSET(cmd_fd,&fdin))
  		ret_code |= CMD_READY;
  
  	return(ret_code);
***************
*** 71,84 ****
  ipc_update(tty_fd, cmd_fd)
  int tty_fd, cmd_fd;
  {
! 	fdin_mask = 1;
  	num_fds = 1;
  	if (tty_fd != -1) {
! 		fdin_mask |= (1 << tty_fd);
  		num_fds = tty_fd +1;
  	}
  	if (cmd_fd != -1) {
! 		fdin_mask |= (1 << cmd_fd);
  		if (cmd_fd > tty_fd)
  			num_fds = cmd_fd +1;
  		tp = &time_out;
--- 76,90 ----
  ipc_update(tty_fd, cmd_fd)
  int tty_fd, cmd_fd;
  {
! 	FD_ZERO(&fdin_mask);
! 	FD_SET(0,&fdin_mask);
  	num_fds = 1;
  	if (tty_fd != -1) {
! 		FD_SET(tty_fd,&fdin_mask);
  		num_fds = tty_fd +1;
  	}
  	if (cmd_fd != -1) {
! 		FD_SET(cmd_fd,&fdin_mask);
  		if (cmd_fd > tty_fd)
  			num_fds = cmd_fd +1;
  		tp = &time_out;
*** chg_dir.c.orig	Mon May 17 22:04:49 1993
--- chg_dir.c	Mon May 17 22:05:34 1993
***************
*** 56,62 ****
  	return;
  }
  
! #ifdef BSD
  /*
   * Get the current working directory, AT&T style.  Well... not really, it
   * doesn't handle a NULL pointer for the buffer.
--- 56,62 ----
  	return;
  }
  
! #ifdef 0 /*BSD bjm */
  /*
   * Get the current working directory, AT&T style.  Well... not really, it
   * doesn't handle a NULL pointer for the buffer.
*** tty_ucb.c.orig	Sun Jun 13 23:08:43 1993
--- tty_ucb.c	Sun Jun 13 23:08:11 1993
***************
*** 30,35 ****
--- 30,36 ----
  		ioctl(fd, TIOCGETP, &hold);
  		first = 0;
  	}
+ 	set_bsd_local(fd);
  					/* get the current settings */
  	ioctl(fd, TIOCGETP, &tbuf);
  					/* set some beginning values */
***************
*** 117,122 ****
--- 118,124 ----
  	extern int fd;
  
  	ioctl(fd, TIOCSETP, &hold);
+  	set_bsd_nolocal(fd);
  	return;
  }
  
*** /dev/null	Sun Jun 13 22:45:35 1993
--- fix.c	Wed May 19 17:03:53 1993
***************
*** 0 ****
--- 1,22 ----
+ #include <stdio.h>
+ #include <sys/termios.h>
+ 
+ set_bsd_local(fd)
+ int fd;
+ {
+ 	struct termios t;
+ 
+ 	tcgetattr(fd, &t);
+ 	t.c_cflag |= CLOCAL;
+ 	tcsetattr(fd, TCSANOW, &t);
+ }
+ 
+ set_bsd_nolocal(fd)
+ int fd;
+ {
+ 	struct termios t;
+ 
+ 	tcgetattr(fd, &t);
+ 	t.c_cflag &= ~CLOCAL;
+ 	tcsetattr(fd, TCSANOW, &t);
+ }
