*** mgetty/Makefile.orig	Sat May  8 01:50:00 1993
--- mgetty/Makefile	Sat May  8 01:36:23 1993
***************
*** 38,48 ****
  #
  
  CC = gcc
! CFLAGS = -g -Wall -DDEBUG=7 -DLIB_DIR=\"$(LIBDIR)\" -DETC_DIR=\"$(ETCDIR)\" \
  	 -DTMP_DIR=\"$(TMPDIR)\" -DBIN_DIR=\"$(BINDIR)\" \
  	 -DPBMPLUS=\"$(PBMPLUS)\"
! LDFLAGS = -g -ldbmalloc -lstdc -ltcl -lx
! INSTALL = /usr/local/gnubin/install
  BINDIR = /usr/local/bin
  ETCDIR = /usr/local/etc
  LIBDIR = /usr/local/lib/mgetty
--- 38,50 ----
  #
  
  CC = gcc
! CFLAGS = -O3 -Wall \
! 	 -DLIB_DIR=\"$(LIBDIR)\" -DETC_DIR=\"$(ETCDIR)\" \
  	 -DTMP_DIR=\"$(TMPDIR)\" -DBIN_DIR=\"$(BINDIR)\" \
  	 -DPBMPLUS=\"$(PBMPLUS)\"
! LDFLAGS = -s
! LIBS = -ltcl
! INSTALL = /usr/bin/install
  BINDIR = /usr/local/bin
  ETCDIR = /usr/local/etc
  LIBDIR = /usr/local/lib/mgetty
***************
*** 49,55 ****
  TMPDIR = /tmp
  PBMPLUS = /usr/local/pbmplus
  
! BINARIES = localize mgetty c2rec xgetty record play
  SCRIPTS = printfax listen
  
  %: %.sh
--- 51,57 ----
  TMPDIR = /tmp
  PBMPLUS = /usr/local/pbmplus
  
! BINARIES = localize mgetty c2rec record play # xgetty
  SCRIPTS = printfax listen
  
  %: %.sh
***************
*** 67,72 ****
--- 69,75 ----
  play: play.o common.o modemio.o zyxel.o voice.o
  xgetty: xgetty.o
  mgetty: mgetty.o common.o locks.o temp.o modemio.o
+ 	gcc $(LDFLAGS) mgetty.o common.o locks.o temp.o modemio.o $(LIBS) -o mgetty
  
  #
  # Object modules
*** mgetty/c2rec.c.orig	Sat May  8 01:50:03 1993
--- mgetty/c2rec.c	Sat May  8 01:09:12 1993
***************
*** 55,63 ****
   */
  
  #include <sys/types.h>
! #ifdef DEBUG
! #include <dbmalloc.h>
! #endif
  #include <stdio.h>
  #include <fcntl.h>
  #include <termio.h>
--- 55,61 ----
   */
  
  #include <sys/types.h>
! #include <sys/stat.h>
  #include <stdio.h>
  #include <fcntl.h>
  #include <termio.h>
***************
*** 86,92 ****
  {
    timedout = TRUE;
    signal(sig, timeout);
! #if SIGTYPE == int
    return 0;
  #endif
  }
--- 84,90 ----
  {
    timedout = TRUE;
    signal(sig, timeout);
! #ifndef SIGH_VOID
    return 0;
  #endif
  }
***************
*** 263,269 ****
    dprint(0, (stderr, "%s: got HANGUP signal\n", myname));
    mdhangup(1);
    exit(0);
! #if SIGTYPE == int
    return 0;
  #endif
  }
--- 261,267 ----
    dprint(0, (stderr, "%s: got HANGUP signal\n", myname));
    mdhangup(1);
    exit(0);
! #ifndef SIGH_VOID
    return 0;
  #endif
  }
*** mgetty/class2rec.c.orig	Sat May  8 01:50:05 1993
--- mgetty/class2rec.c	Thu May  6 22:03:24 1993
***************
*** 140,146 ****
  static SIGTYPE catcher(int sig)
  {
    signal(sig, catcher);
! #if SIGTYPE == int
    return 0;
  #endif
  }
--- 140,146 ----
  static SIGTYPE catcher(int sig)
  {
    signal(sig, catcher);
! #ifndef SIGH_VOID
    return 0;
  #endif
  }
*** mgetty/common.c.orig	Sat May  8 01:50:07 1993
--- mgetty/common.c	Thu May  6 22:06:46 1993
***************
*** 68,74 ****
  	{
  	  int c;
  
! 	  if (c = tolower(*s1) -tolower(*s2))
  	    return c;
  	}
        else
--- 68,74 ----
  	{
  	  int c;
  
! 	  if ((c = tolower(*s1) -tolower(*s2)))
  	    return c;
  	}
        else
*** mgetty/config.h.orig	Sat May  8 01:50:09 1993
--- mgetty/config.h	Sat May  8 01:08:49 1993
***************
*** 31,38 ****
  #ifndef _config_h_INCLUDED
  #define _config_h_INCLUDED
  
! #define SIGTYPE int	/* set it to the return value type of your
! 			   signal handling functions [wally] */
  			/* some common bits 'n pieces */
  
  #define LOCK_DIR	"/usr/spool/uucp"
--- 31,45 ----
  #ifndef _config_h_INCLUDED
  #define _config_h_INCLUDED
  
! #define SIGH_VOID       /* define this if signal handlers return void */
!                         /* I've changed this to accomodate gcc    -ot */
! 
! #ifdef SIGH_VOID
!   #define SIGTYPE void
! #else
!   #define SIGTYPE int
! #endif
! 
  			/* some common bits 'n pieces */
  
  #define LOCK_DIR	"/usr/spool/uucp"
***************
*** 39,45 ****
--- 46,71 ----
  #define MAX_NAME_LEN	14	/* Maximum file name length. Define it if
  				   your file system have such constraint.
  				   Otherwise leave it undefined. */
+ #define NAP usleep      /* nap or usleep, depending on your lib  -ot */
+ #undef HAVE_DBMALLOC    /* define this if you have <dbmalloc.h>  -ot */
+ #define STDLIB          /* define this to use <stdlib.h> (Linux) -ot */
+ 
+ 
+ 
  
+ #ifdef STDLIB
+ #include <stdlib.h>
+ #endif
+ #include <unistd.h>
+ #include <termios.h>
+ #include <sys/ioctl.h>
+ #ifdef HAVE_DBMALLOC
+ #ifdef DEBUG
+ #include <dbmalloc.h>
+ #endif
+ #endif
+ 
+ #ifndef STDLIB
  #ifdef __cplusplus
  extern "C" {
  #endif
***************
*** 66,71 ****
--- 92,98 ----
    char *ctime(long *);
  #ifdef __cplusplus
  }
+ #endif
  #endif
  
  #endif	/* _config_h_INCLUDED */
*** mgetty/locks.c.orig	Sat May  8 01:50:12 1993
--- mgetty/locks.c	Sat May  8 01:05:20 1993
***************
*** 30,38 ****
   */
  
  #include <sys/types.h>
- #ifdef DEBUG
- #include <dbmalloc.h>
- #endif
  #include <stdio.h>
  #include <string.h>
  #include <fcntl.h>
--- 30,35 ----
***************
*** 66,71 ****
--- 63,69 ----
  	  buf[nread - 1] = '\0';
  	  pid = atoi(buf);
  #else
+ 	  memcpy(&pid, buf, sizeof(pid));
  #endif
  	}
        else
***************
*** 95,106 ****
    else
      {
        char buf[32];
  
  #if defined(M_XENIX)
!       sprintf(buf, "%10u\n", getpid());
        write(fd, buf, strlen(buf));
  #else
! # error unsupported UUCP locking system
  #endif
        close(fd);
      }
--- 93,105 ----
    else
      {
        char buf[32];
+       int pid = getpid();
  
  #if defined(M_XENIX)
!       sprintf(buf, "%10u\n", pid);
        write(fd, buf, strlen(buf));
  #else
!       write(fd, &pid, sizeof(pid));
  #endif
        close(fd);
      }
***************
*** 147,152 ****
--- 146,152 ----
  	  buf[nread - 1] = '\0';
  	  pid = atoi(buf);
  #else
+ 	  memcpy(&pid, buf, sizeof(pid));
  #endif
  	  if (kill(pid, 0) == 0)
  	    ret = TRUE;
*** mgetty/mgetty.c.orig	Sat May  8 01:50:15 1993
--- mgetty/mgetty.c	Sat May  8 01:28:17 1993
***************
*** 37,45 ****
   */
  
  #include <sys/types.h>
- #ifdef DEBUG
- #include <dbmalloc.h>
- #endif
  #include <stdio.h>
  #include <fcntl.h>
  #include <termio.h>
--- 37,42 ----
***************
*** 110,116 ****
        while(suspended)
  	sleep(1024);
      }
! #if SIGTYPE == int
    return 0;
  #endif
  }
--- 107,113 ----
        while(suspended)
  	sleep(1024);
      }
! #ifndef SIGH_VOID
    return 0;
  #endif
  }
***************
*** 120,126 ****
    suspended = FALSE;
    signal(sig, restart);
    setUtmp(UTMP_LOGIN, line);
! #if SIGTYPE == int
    return 0;
  #endif
  }
--- 117,123 ----
    suspended = FALSE;
    signal(sig, restart);
    setUtmp(UTMP_LOGIN, line);
! #ifndef SIGH_VOID
    return 0;
  #endif
  }
***************
*** 166,178 ****
      {
        if (verbosity > 8)
  	fprintf(stderr, "%s: setting MD_CTSRTS\n", myname);
!       tty_settings.c_cflag |= CTSFLOW | RTSFLOW;
      }
    if (mode & MD_NOFLOW)
      {
        if (verbosity > 8)
  	fprintf(stderr, "%s: setting MD_NOFLOW\n", myname);
!       tty_settings.c_cflag &= ~(CTSFLOW | RTSFLOW);
        tty_settings.c_iflag &= ~(IXON | IXANY);
      }
    if (mode & MD_LOCAL)
--- 163,175 ----
      {
        if (verbosity > 8)
  	fprintf(stderr, "%s: setting MD_CTSRTS\n", myname);
!       tty_settings.c_cflag |= CRTSCTS;
      }
    if (mode & MD_NOFLOW)
      {
        if (verbosity > 8)
  	fprintf(stderr, "%s: setting MD_NOFLOW\n", myname);
!       tty_settings.c_cflag &= ~(CRTSCTS);
        tty_settings.c_iflag &= ~(IXON | IXANY);
      }
    if (mode & MD_LOCAL)
***************
*** 240,253 ****
    /* The following two open()s should have O_RDONLY and O_WRONLY
       respectively but tset (and other programs?) cannot work properly
       if we do so. */
!   if (open(portname, (O_RDWR | O_NDELAY)) < 0 ||
!       open(portname, (O_RDWR | O_NDELAY)) < 0)
!     {
        if (errno == EBUSY)
  	fprintf(stderr, "%s: port %s BUSY\n", myname, portname);
        else
  	fprintf(stderr, "%s: can't connect into %s (%s)\n", myname,
  		portname, sys_errlist[errno]);
        return FAILED;
      }
    setMode(MD_RAW | MD_NOFLOW | MD_LOCAL);
--- 237,251 ----
    /* The following two open()s should have O_RDONLY and O_WRONLY
       respectively but tset (and other programs?) cannot work properly
       if we do so. */
!   if (open(portname, (O_RDWR | O_NDELAY)) != 0 ||
!       open(portname, (O_RDWR | O_NDELAY)) != 1)  {
! #ifdef DEBUG
        if (errno == EBUSY)
  	fprintf(stderr, "%s: port %s BUSY\n", myname, portname);
        else
  	fprintf(stderr, "%s: can't connect into %s (%s)\n", myname,
  		portname, sys_errlist[errno]);
+ #endif
        return FAILED;
      }
    setMode(MD_RAW | MD_NOFLOW | MD_LOCAL);
***************
*** 255,268 ****
    if (fcntl(0, F_SETFL, O_RDONLY) == ERROR ||
        fcntl(1, F_SETFL, O_WRONLY) == ERROR)
      {
        fprintf(stderr, "%s: can't unset O_NDELAY for %s\n", myname, portname);
        return FAILED;
      }
  #ifndef DEBUG
    dup(1);
  #endif
-   if (verbosity > 5)
-     fprintf(stderr, "%s: line parameters set for %s\n", myname, portname);
    return SUCCEEDED;
  }
  
--- 253,268 ----
    if (fcntl(0, F_SETFL, O_RDONLY) == ERROR ||
        fcntl(1, F_SETFL, O_WRONLY) == ERROR)
      {
+ #ifdef DEBUG
        fprintf(stderr, "%s: can't unset O_NDELAY for %s\n", myname, portname);
+ #endif
        return FAILED;
      }
+   if (verbosity > 5)
+     fprintf(stderr, "%s: line parameters set for %s\n", myname, portname);
  #ifndef DEBUG
    dup(1);
  #endif
    return SUCCEEDED;
  }
  
***************
*** 282,289 ****
  
        strncpy(buf, ut.ut_line, sizeof(ut.ut_line));
        buf[sizeof(buf) - 1] = 0;
!       if((!strcmp(buf, line) || ut.ut_type == INIT_PROCESS)
! 	 && pid == ut.ut_pid)
  	{
  	  strncpy(ut.ut_line, line, sizeof(ut.ut_line));
  	  strncpy(ut.ut_id, id, sizeof(ut.ut_id));
--- 282,289 ----
  
        strncpy(buf, ut.ut_line, sizeof(ut.ut_line));
        buf[sizeof(buf) - 1] = 0;
!       if(!strcmp(buf, line) ||
!          ((ut.ut_type == INIT_PROCESS) && pid == ut.ut_pid))  /* -ot */
  	{
  	  strncpy(ut.ut_line, line, sizeof(ut.ut_line));
  	  strncpy(ut.ut_id, id, sizeof(ut.ut_id));
***************
*** 325,331 ****
    closeLine();
    setUtmp(UTMP_EXIT, line);
    exit(0);
! #if SIGTYPE == int
    return 0;
  #endif
  }
--- 325,331 ----
    closeLine();
    setUtmp(UTMP_EXIT, line);
    exit(0);
! #ifndef SIGH_VOID
    return 0;
  #endif
  }
***************
*** 375,382 ****
--- 375,392 ----
  {
    alarm(0);
    signal(SIGALRM, SIG_DFL);
+ #ifdef SIGUSR1
    signal(SIGUSR1, SIG_DFL);
+ #endif
+ #ifdef SIGUSR2
    signal(SIGUSR2, SIG_DFL);
+ #endif
+ #ifdef SIGTSTP
+   signal(SIGTSTP, SIG_DFL);
+ #endif
+ #ifdef SIGCONT
+   signal(SIGCONT, SIG_DFL);
+ #endif
    signal(SIGQUIT, SIG_DFL);
    signal(SIGTERM, SIG_DFL);
    signal(SIGHUP, SIG_DFL);
***************
*** 430,446 ****
  {
    timedout = TRUE;
    signal(sig, timeout);
! #if SIGTYPE == int
    return 0;
  #endif
  }
  
  
! static int catcher(int sig)
  {
    fprintf(stderr, "GOT SIGNAL %u\n", sig);
    signal(sig, catcher);
    return 0;
  }
  
  static void catchSignals()
--- 440,458 ----
  {
    timedout = TRUE;
    signal(sig, timeout);
! #ifndef SIGH_VOID
    return 0;
  #endif
  }
  
  
! static SIGTYPE catcher(int sig)
  {
    fprintf(stderr, "GOT SIGNAL %u\n", sig);
    signal(sig, catcher);
+ #ifndef SIGH_VOID
    return 0;
+ #endif
  }
  
  static void catchSignals()
***************
*** 451,459 ****
--- 463,481 ----
      if (i != SIGCLD)
        signal(i, catcher);
    signal(SIGALRM, timeout);
+ #ifdef SIGUSR1
    signal(SIGUSR1, suspend);
+ #endif
+ #ifdef SIGTSTP
+   signal(SIGTSTP, suspend);
+ #endif
+ #ifdef SIGUSR2
    signal(SIGUSR2, terminate);	/* when restarted we exit to redo all the
  				   settings we may have already done. */
+ #endif
+ #ifdef SIGCONT
+   signal(SIGCONT, terminate);
+ #endif
    signal(SIGQUIT, terminate);
    signal(SIGTERM, terminate);
    signal(SIGHUP, terminate);
***************
*** 509,515 ****
      {
        const char *p;
        
!       if (p = mdread(t, 0, (const char **)argv + 2, 0))
  	Tcl_SetResult(interp, (char *)p, TCL_VOLATILE);
        else
  	Tcl_SetResult(interp, "", TCL_STATIC);
--- 531,537 ----
      {
        const char *p;
        
!       if ((p = mdread(t, 0, (const char **)argv + 2, 0)))
  	Tcl_SetResult(interp, (char *)p, TCL_VOLATILE);
        else
  	Tcl_SetResult(interp, "", TCL_STATIC);
***************
*** 996,1003 ****
--- 1018,1027 ----
  	setBits(HUPCL, p == argv[i], &tty.c_cflag);
        else if (!strcomp(p, "CLOCAL"))
  	setBits(CLOCAL, p == argv[i], &tty.c_cflag);
+ #ifdef LOBLK
        else if (!strcomp(p, "LOBLK"))
  	setBits(LOBLK, p == argv[i], &tty.c_cflag);
+ #endif
  #ifdef CTSFLOW
        else if (!strcomp(p, "CTSFLOW"))
  	setBits(CTSFLOW, p == argv[i], &tty.c_cflag);
***************
*** 1023,1030 ****
--- 1047,1056 ----
  	setBits(ECHONL, p == argv[i], &tty.c_lflag);
        else if (!strcomp(p, "NOFLSH"))
  	setBits(NOFLSH, p == argv[i], &tty.c_lflag);
+ #ifdef XCLUDE
        else if (!strcomp(p, "XCLUDE"))
  	setBits(XCLUDE, p == argv[i], &tty.c_lflag);
+ #endif
        else
  	break;
      }
*** mgetty/modemio.c.orig	Sat May  8 01:50:18 1993
--- mgetty/modemio.c	Sat May  8 01:05:08 1993
***************
*** 26,34 ****
   */
  
  #include <sys/types.h>
- #ifdef DEBUG
- #include <dbmalloc.h>
- #endif
  #include <string.h>
  #include <signal.h>
  #include <stdio.h>
--- 26,31 ----
***************
*** 47,53 ****
  static SIGTYPE timeout(int sig)
  {
    mdtimedout = TRUE;
! #if SIGTYPE == int
    return 0;
  #endif
  }
--- 44,50 ----
  static SIGTYPE timeout(int sig)
  {
    mdtimedout = TRUE;
! #ifndef SIGH_VOID
    return 0;
  #endif
  }
***************
*** 118,124 ****
        if (mdverbosity > 6)
  	fprintf(stderr, "%s", vgets(*c));
        if (mdslowrite)
! 	nap(100);
        c++;
      }
    relSignals();
--- 115,121 ----
        if (mdverbosity > 6)
  	fprintf(stderr, "%s", vgets(*c));
        if (mdslowrite)
! 	NAP(100);
        c++;
      }
    relSignals();
*** mgetty/play.c.orig	Sat May  8 01:50:20 1993
--- mgetty/play.c	Thu May  6 22:01:28 1993
***************
*** 74,80 ****
        terminated = TRUE;
        signal(sig, terminate);
      }
! #if SIGTYPE == int
    return 0;
  #endif
  }
--- 74,80 ----
        terminated = TRUE;
        signal(sig, terminate);
      }
! #ifndef SIGH_VOID
    return 0;
  #endif
  }
***************
*** 167,173 ****
    VoiceEncoding encoding = ADPCM2;
    unsigned volume = 5;	/* I don't know if it is relevant */
    Speaker spkr = TELCOLINE;
!   bool error;
    const char *device;
  
    myname = basename(argv[0]);
--- 167,173 ----
    VoiceEncoding encoding = ADPCM2;
    unsigned volume = 5;	/* I don't know if it is relevant */
    Speaker spkr = TELCOLINE;
!   bool error = FALSE;
    const char *device;
  
    myname = basename(argv[0]);
*** mgetty/record.c.orig	Sat May  8 01:50:22 1993
--- mgetty/record.c	Sat May  8 01:05:01 1993
***************
*** 32,40 ****
   */
  
  #include <sys/types.h>
! #ifdef DEBUG
! #include <dbmalloc.h>
! #endif
  #include <stdio.h>
  #include <fcntl.h>
  #include <termio.h>
--- 32,38 ----
   */
  
  #include <sys/types.h>
! #include <sys/stat.h>
  #include <stdio.h>
  #include <fcntl.h>
  #include <termio.h>
***************
*** 85,91 ****
        timedout = TRUE;
        signal(sig, terminate);
      }
! #if SIGTYPE == int
    return 0;
  #endif
  }
--- 83,89 ----
        timedout = TRUE;
        signal(sig, terminate);
      }
! #ifndef SIGH_VOID
    return 0;
  #endif
  }
***************
*** 94,100 ****
  {
    timedout = TRUE;
    signal(sig, timeout);
! #if SIGTYPE == int
    return 0;
  #endif
  }
--- 92,98 ----
  {
    timedout = TRUE;
    signal(sig, timeout);
! #ifndef SIGH_VOID
    return 0;
  #endif
  }
*** mgetty/temp.c.orig	Sat May  8 01:50:25 1993
--- mgetty/temp.c	Sat May  8 01:04:54 1993
***************
*** 29,39 ****
   */
  
  #include <sys/types.h>
- #ifdef DEBUG
- #include <dbmalloc.h>
- #else
  #include <malloc.h>
- #endif
  #include <string.h>
  #include <stdio.h>
  #include "common.h"
--- 29,35 ----
*** mgetty/voice.c.orig	Sat May  8 01:50:27 1993
--- mgetty/voice.c	Sun Apr 25 14:54:49 1993
***************
*** 48,54 ****
    tty_settings.c_iflag |= IXON | IXANY;
    tty_settings.c_cflag &= ~(PARENB | CBAUD);
    tty_settings.c_cflag |= HUPCL | CSIZE | CS8 | CREAD | B38400;
!   tty_settings.c_cflag |= CTSFLOW | RTSFLOW | CLOCAL;
    tty_settings.c_lflag &= ~(ISIG | ECHO | ICANON);
    tty_settings.c_cc[VMIN] = 1;
    tty_settings.c_cc[VTIME] = 0;
--- 48,54 ----
    tty_settings.c_iflag |= IXON | IXANY;
    tty_settings.c_cflag &= ~(PARENB | CBAUD);
    tty_settings.c_cflag |= HUPCL | CSIZE | CS8 | CREAD | B38400;
!   tty_settings.c_cflag |= CRTSCTS | CLOCAL;
    tty_settings.c_lflag &= ~(ISIG | ECHO | ICANON);
    tty_settings.c_cc[VMIN] = 1;
    tty_settings.c_cc[VTIME] = 0;
