*** mgetty-0.22/Makefile	Sun Nov 13 05:56:16 1994
--- mgetty-0.22.patched/Makefile	Fri Nov 25 14:13:21 1994
***************
*** 94,100 ****
  #	    USTAT	  - ustat(), no statfs etc.
  #
  #CFLAGS=-Wall -O2 -pipe -DSECUREWARE -DUSE_POLL
! CFLAGS=-O2 -Wall -pipe
  #CFLAGS=-O -DSVR4
  #CFLAGS=-O -DSVR4 -DSVR42
  #CFLAGS=-O -DUSE_POLL
--- 94,100 ----
  #	    USTAT	  - ustat(), no statfs etc.
  #
  #CFLAGS=-Wall -O2 -pipe -DSECUREWARE -DUSE_POLL
! # CFLAGS=-O2 -Wall -pipe
  #CFLAGS=-O -DSVR4
  #CFLAGS=-O -DSVR4 -DSVR42
  #CFLAGS=-O -DUSE_POLL
***************
*** 103,109 ****
  # networking library and gcc.
  #CFLAGS=-D_3B1_ -D_NOSTDLIB_H -DUSE_READ -DSHORT_FILENAMES
  #CFLAGS=-std -DPOSIX_TERMIOS -O2 -D_BSD -DBSD	# for OSF/1 (w/ /bin/cc)
! #CFLAGS=-posix -DBSD				# for NeXT
  
  #
  # LDFLAGS specify flags to pass to the linker. You could specify
--- 103,109 ----
  # networking library and gcc.
  #CFLAGS=-D_3B1_ -D_NOSTDLIB_H -DUSE_READ -DSHORT_FILENAMES
  #CFLAGS=-std -DPOSIX_TERMIOS -O2 -D_BSD -DBSD	# for OSF/1 (w/ /bin/cc)
! CFLAGS=-O -posix -D_POSIX_SOURCE -DBSD	# for NeXT
  
  #
  # LDFLAGS specify flags to pass to the linker. You could specify
***************
*** 127,138 ****
  # For FreeBSD, add "-lutil" if the linker complains about
  # 	"utmp.o: unresolved symbod _login"
  #
! LDFLAGS=
  #LDFLAGS=-lprot -lsocket
  #LDFLAGS=-s -shlib
  #LDFLAGS=-lsocket
  #LDFLAGS=-lbsd					# OSF/1
! #LDFLAGS=-posix					# NeXT
  #
  #
  # the following things are mainly used for ``make install''
--- 127,138 ----
  # For FreeBSD, add "-lutil" if the linker complains about
  # 	"utmp.o: unresolved symbod _login"
  #
! #LDFLAGS=
  #LDFLAGS=-lprot -lsocket
  #LDFLAGS=-s -shlib
  #LDFLAGS=-lsocket
  #LDFLAGS=-lbsd					# OSF/1
! LDFLAGS=-s -posix				# NeXT
  #
  #
  # the following things are mainly used for ``make install''
***************
*** 168,174 ****
  #
  # the fax spool directory
  #
! FAX_SPOOL=$(spool)/fax
  FAX_SPOOL_IN=$(FAX_SPOOL)/incoming
  FAX_SPOOL_OUT=$(FAX_SPOOL)/outgoing
  #
--- 168,174 ----
  #
  # the fax spool directory
  #
! FAX_SPOOL=$(spool)/NeXTFaxes
  FAX_SPOOL_IN=$(FAX_SPOOL)/incoming
  FAX_SPOOL_OUT=$(FAX_SPOOL)/outgoing
  #
*** mgetty-0.22/locks.c	Sun Aug 21 08:48:30 1994
--- mgetty-0.22.patched/locks.c	Sat Nov 26 14:34:02 1994
***************
*** 173,180 ****
--- 173,210 ----
   *
   *	if lockfile found, return PID of process holding it, 0 otherwise
   */
+ #ifdef NeXT
+ int checklock _P1( (device), char * device)
+ {
+     char name[8] ;
+     char *names[] = {
+ 	"ttydf%c", "ttyd%c", "ttyf%c", "tty%c",
+ 	"cudf%c", "cuf%c", "cud%c", "cu%c", (char  *)0
+     } ;
+     register int i ;
+     char 	c ;
+     char **	cp ;
  
+     /*
+      *	Try each type of lock name in case we are using another.
+      */
+     if ((i = do_checklock (device)) != NO_LOCK)
+ 	return (i) ;
+     for (cp = names; *cp; ++cp)
+ 	if (sscanf (device, *cp, &c) == 1)
+ 	    break ;
+     for (cp = names; *cp; ++cp) {
+ 	(void)sprintf (name, *cp, c) ;
+ 	if ((i = do_checklock (name)) != NO_LOCK)
+ 	    return (i) ;
+     }
+     return (NO_LOCK) ;
+ }
+ 
+ int do_checklock _P1( (device), char * device)
+ #else
  int checklock _P1( (device), char * device)
+ #endif
  {
      int pid;
      struct stat st;
*** mgetty-0.22/login.c	Fri Nov  4 15:39:54 1994
--- mgetty-0.22.patched/login.c	Sat Nov 26 00:30:01 1994
***************
*** 23,28 ****
--- 23,32 ----
  #include "policy.h"
  #include "mg_utmp.h"
  
+ #ifdef NeXT
+ # include <sys/ioctl.h>
+ #endif
+ 
  #ifdef SECUREWARE
  extern int setluid();
  #endif
***************
*** 284,289 ****
--- 288,301 ----
  	Device, getpid(), CallerId, Connect, CallName,
  	cmd, user );
  
+ #   ifdef NeXT
+     {   struct sgttyb t ;
+ 
+ 	(void)ioctl (0, TIOCGETP, &t) ;
+ 	t.sg_flags |= EVENP | ODDP ;
+ 	(void)ioctl (0, TIOCSETN, &t) ;
+     }
+ #   endif
      /* execute login */
      execv( cmd, argv );
  
*** mgetty-0.22/mgetty.c	Wed Nov  2 11:21:44 1994
--- mgetty-0.22.patched/mgetty.c	Wed Nov 23 08:03:24 1994
***************
*** 16,21 ****
--- 16,22 ----
  #include <pwd.h>
  #include <sys/types.h>
  #include <sys/times.h>
+ #include <sys/fcntl.h>
  
  #include <sys/stat.h>
  #include <signal.h>
*** mgetty-0.22/sendfax.c	Tue Oct  4 03:35:21 1994
--- mgetty-0.22.patched/sendfax.c	Sun Dec 18 10:48:30 1994
***************
*** 51,56 ****
--- 51,57 ----
  			 char * fax_tty, boolean use_stdin )
  {
      char	device[MAXPATH];
+     extern char *ttyname() ;
      int	fd;
  
      if ( use_stdin )			/* fax modem on stdin */
*** mgetty-0.22/tio.c	Sat Oct 22 09:27:41 1994
--- mgetty-0.22.patched/tio.c	Sat Nov 26 00:21:44 1994
***************
*** 9,15 ****
  #include <unistd.h>
  #include <sys/types.h>
  
! #ifdef _AIX
  #include <sys/ioctl.h>
  #endif
  
--- 9,15 ----
  #include <unistd.h>
  #include <sys/types.h>
  
! #if (defined(_AIX) || defined(NeXT))
  #include <sys/ioctl.h>
  #endif
  
***************
*** 32,38 ****
  # include <sys/modem.h>
  #endif
  
! #if defined( M_UNIX ) && defined( MAM_BUG )
  #include <fcntl.h>
  #endif
  
--- 32,38 ----
  # include <sys/modem.h>
  #endif
  
! #if (defined( M_UNIX ) && defined( MAM_BUG )) || defined(NeXT)
  #include <fcntl.h>
  #endif
  
***************
*** 152,158 ****
  
  int tio_set _P2( (fd, t), int fd, TIO * t)	/*!! FIXME: flags, wait */
  {
! #ifdef sunos4
      int modem_lines;
  #endif
  #ifdef SYSV_TERMIO
--- 152,158 ----
  
  int tio_set _P2( (fd, t), int fd, TIO * t)	/*!! FIXME: flags, wait */
  {
! #if (defined(sunos4) || defined(NeXT))
      int modem_lines;
  #endif
  #ifdef SYSV_TERMIO
***************
*** 178,183 ****
--- 178,202 ----
          ioctl(STDIN, TIOCMSET, &modem_lines);
      }
  #endif /* sunos4 */
+ #ifdef NeXT
+     /* 
+      *	Search out device types, if it is flow style device then we are on
+      * the money ...
+      */
+     {	char	buffer[30] ;
+ 	extern char *	ttyname ();
+ 
+ 	strcpy (buffer, ttyname (STDIN)) ;
+ 	buffer[strlen(buffer) - 1] = '\0' ;
+         if (index (buffer, 'f'))
+         {
+             /* make sure RTS is asserted!!!!!! */
+             ioctl(STDIN, TIOCMGET, &modem_lines);
+             modem_lines |= (TIOCM_RTS | TIOCM_DTR);
+             ioctl(STDIN, TIOCMSET, &modem_lines);
+         }
+     }
+ #endif
  #endif /* posix_termios */
  
  #ifdef BSD_SGTTY
***************
*** 292,299 ****
  		   | LOBLK
  #endif
  		   );
!     t->c_cflag|= CS8 | CREAD | HUPCL | ( local? CLOCAL:0 );
!     t->c_lflag = ECHOK | ECHOE | ECHO | ISIG | ICANON;
  
  #if !defined(POSIX_TERMIOS)
      t->c_line  = 0;
--- 311,326 ----
  		   | LOBLK
  #endif
  		   );
!     t->c_cflag|= CS8 | CREAD | HUPCL | ( local? CLOCAL:0 )
! #ifdef PAR1
! 		   | PAR1
! #endif
!     ;
!     t->c_lflag = ECHOK | ECHOE | ECHO | ISIG | ICANON
! #ifdef IEXTEN
! 		   | IEXTEN
! #endif
!     ;
  
  #if !defined(POSIX_TERMIOS)
      t->c_line  = 0;
***************
*** 387,393 ****
  	t->c_oflag &= ~ONLCR;
      }
  #else
! #include "not implemented yet"
  #endif
  }
  
--- 414,427 ----
  	t->c_oflag &= ~ONLCR;
      }
  #else
!     if ( perform_mapping )
!     {
!         t->sg_flags |= CRMOD ;
!     }
!     else
!     {
!         t->sg_flags &= ~CRMOD ;
!     }
  #endif
  }
  
***************
*** 413,419 ****
  	t->c_lflag &= ~XCASE;
      }
  # else
! # include "not implemented yet"
  # endif
  #endif		/* BSDI */
  }
--- 447,460 ----
  	t->c_lflag &= ~XCASE;
      }
  # else
!     if ( perform_mapping )
!     {
!         t->sg_flags |= LCASE ;
!     }
!     else
!     {
! 	t->sg_flags &= ~LCASE ;
!     }
  # endif
  #endif		/* BSDI */
  }
***************
*** 434,440 ****
  	t->c_cflag |= CLOCAL;
      }
  #else
! #include "not implemented yet"
  #endif
  }
  
--- 475,481 ----
  	t->c_cflag |= CLOCAL;
      }
  #else
! # include "not implemented yet"
  #endif
  }
  
***************
*** 507,513 ****
      if ( type & FLOW_XON_OUT )
  			t->c_iflag |= IXON | IXANY;
  #else
! #include "not yet implemented"
  #endif
      /* SVR4 came up with a new method of setting h/w flow control */
      /* unfortunately, it's broken in 4.2 and Solaris2! */
--- 548,554 ----
      if ( type & FLOW_XON_OUT )
  			t->c_iflag |= IXON | IXANY;
  #else
! # include "not yet implemented"
  #endif
      /* SVR4 came up with a new method of setting h/w flow control */
      /* unfortunately, it's broken in 4.2 and Solaris2! */
***************
*** 606,612 ****
  #if defined(SVR4) && defined(TIOCMBIS)		/* SVR4 special */
      int mctl = TIOCM_DTR;
  
! #ifdef sun
      if ( ioctl( fd, TIOCMBIC, &mctl ) < 0 )
  #else
      if ( ioctl( fd, TIOCMBIC, (char *) mctl ) < 0 )
--- 647,653 ----
  #if defined(SVR4) && defined(TIOCMBIS)		/* SVR4 special */
      int mctl = TIOCM_DTR;
  
! #if (defined(sun) || defined(NeXT))
      if ( ioctl( fd, TIOCMBIC, &mctl ) < 0 )
  #else
      if ( ioctl( fd, TIOCMBIC, (char *) mctl ) < 0 )
***************
*** 615,621 ****
  	lprintf( L_ERROR, "TIOCMBIC failed" ); return ERROR;
      }
      delay( msec_wait );
! #ifdef sun
      if ( ioctl( fd, TIOCMBIS, &mctl ) < 0 )
  #else
      if ( ioctl( fd, TIOCMBIS, (char *) mctl ) < 0 )
--- 656,662 ----
  	lprintf( L_ERROR, "TIOCMBIC failed" ); return ERROR;
      }
      delay( msec_wait );
! #if (defined(sun) || defined(NeXT))
      if ( ioctl( fd, TIOCMBIS, &mctl ) < 0 )
  #else
      if ( ioctl( fd, TIOCMBIS, (char *) mctl ) < 0 )
***************
*** 653,659 ****
      /* The "standard" way of doing things - via speed = B0
       */
      TIO t, save_t;
! #ifdef sunos4
      int modem_lines;
  #endif
      int result;
--- 694,700 ----
      /* The "standard" way of doing things - via speed = B0
       */
      TIO t, save_t;
! #if (defined(sunos4) || defined(NeXT))
      int modem_lines;
  #endif
      int result;
***************
*** 670,682 ****
      cfsetispeed( &t, B0 );
  #endif
  #ifdef BSD_SGTTY
!     t.sg_ispeed = t.sg_ospeed = B0
  #endif
  
      tio_set( fd, &t );
      delay( msec_wait );
      
! #ifdef sunos4
      /* on SunOS, if you hangup via B0, the DTR line will *stay* low.
       * So: enable it manually again.
       */
--- 711,723 ----
      cfsetispeed( &t, B0 );
  #endif
  #ifdef BSD_SGTTY
!     t.sg_ispeed = t.sg_ospeed = B0 ;
  #endif
  
      tio_set( fd, &t );
      delay( msec_wait );
      
! #if (defined(sunos4) || defined(NeXT))
      /* on SunOS, if you hangup via B0, the DTR line will *stay* low.
       * So: enable it manually again.
       */
***************
*** 686,692 ****
  #endif
      result = tio_set( fd, &save_t );
      
! #if (defined(M_UNIX) && defined(MAM_BUG)) || defined (sysV68)
      /* some Unix variants apparently forget to raise DTR again
       * after lowering it. Reopening the port fixes it. Crude, but works.
       */
--- 727,733 ----
  #endif
      result = tio_set( fd, &save_t );
      
! #if (defined(M_UNIX) && defined(MAM_BUG))
      /* some Unix variants apparently forget to raise DTR again
       * after lowering it. Reopening the port fixes it. Crude, but works.
       */
