so much...clean up after ralph's merge of wendel and mo code;
authorSam Leffler <sam@ucbvax.Berkeley.EDU>
Sat, 25 Jun 1983 16:15:31 +0000 (08:15 -0800)
committerSam Leffler <sam@ucbvax.Berkeley.EDU>
Sat, 25 Jun 1983 16:15:31 +0000 (08:15 -0800)
purge VMUNIX include since changes for signals make it no longer portable
to systems other than 4.2; fix ventel for no echo strapping; do setjmps
instead of assuming interrupted system calls; purge lcmd, if people use

SCCS-vsn: usr.bin/tip/acu.c 4.9
SCCS-vsn: usr.bin/tip/acutab.c 4.7
SCCS-vsn: usr.bin/tip/aculib/biz22.c 4.3
SCCS-vsn: usr.bin/tip/aculib/biz31.c 4.6
SCCS-vsn: usr.bin/tip/cmds.c 4.12
SCCS-vsn: usr.bin/tip/cmdtab.c 4.6
SCCS-vsn: usr.bin/tip/cu.c 4.5
SCCS-vsn: usr.bin/tip/aculib/df.c 4.7
SCCS-vsn: usr.bin/tip/aculib/dn11.c 4.13
SCCS-vsn: usr.bin/tip/hunt.c 4.7
SCCS-vsn: usr.bin/tip/log.c 4.5
SCCS-vsn: usr.bin/tip/partab.c 4.2
SCCS-vsn: usr.bin/tip/remcap.c 4.8
SCCS-vsn: usr.bin/tip/remote.c 4.7
SCCS-vsn: usr.bin/tip/tip.c 4.15
SCCS-vsn: usr.bin/tip/tip.h 4.11
SCCS-vsn: usr.bin/tip/tipout.c 4.8
SCCS-vsn: usr.bin/tip/uucplock.c 4.6
SCCS-vsn: usr.bin/tip/aculib/v3451.c 4.3
SCCS-vsn: usr.bin/tip/aculib/v831.c 4.4
SCCS-vsn: usr.bin/tip/value.c 4.5
SCCS-vsn: usr.bin/tip/vars.c 4.6
SCCS-vsn: usr.bin/tip/aculib/ventel.c 1.4

23 files changed:
usr/src/usr.bin/tip/acu.c
usr/src/usr.bin/tip/aculib/biz22.c
usr/src/usr.bin/tip/aculib/biz31.c
usr/src/usr.bin/tip/aculib/df.c
usr/src/usr.bin/tip/aculib/dn11.c
usr/src/usr.bin/tip/aculib/v3451.c
usr/src/usr.bin/tip/aculib/v831.c
usr/src/usr.bin/tip/aculib/ventel.c
usr/src/usr.bin/tip/acutab.c
usr/src/usr.bin/tip/cmds.c
usr/src/usr.bin/tip/cmdtab.c
usr/src/usr.bin/tip/cu.c
usr/src/usr.bin/tip/hunt.c
usr/src/usr.bin/tip/log.c
usr/src/usr.bin/tip/partab.c
usr/src/usr.bin/tip/remcap.c
usr/src/usr.bin/tip/remote.c
usr/src/usr.bin/tip/tip.c
usr/src/usr.bin/tip/tip.h
usr/src/usr.bin/tip/tipout.c
usr/src/usr.bin/tip/uucplock.c
usr/src/usr.bin/tip/value.c
usr/src/usr.bin/tip/vars.c

index ae95fda..f5cb05f 100644 (file)
@@ -1,8 +1,9 @@
-/*     acu.c   4.8     83/06/15        */
+#ifndef lint
+static char sccsid[] = "@(#)acu.c      4.9 (Berkeley) %G%";
+#endif
+
 #include "tip.h"
 #include "tip.h"
-#include <setjmp.h>
 
 
-static char *sccsid = "@(#)acu.c       4.8 %G%";
 static acu_t *acu = NOACU;
 static int conflag;
 static int acuabort();
 static acu_t *acu = NOACU;
 static int conflag;
 static int acuabort();
index 64beda5..384765e 100644 (file)
@@ -1,12 +1,15 @@
-/*     biz22.c 4.2     83/06/15        */
+#ifndef lint
+static char sccsid[] = "@(#)biz22.c    4.3 (Berkeley) %G%";
+#endif
+
 #include "tip.h"
 
 #if BIZ1022
 #include "tip.h"
 
 #if BIZ1022
-#define DISCONNECT     "\20\04"        /* disconnection string */
+#define DISCONNECT_CMD "\20\04"        /* disconnection string */
 
 
-static char *sccsid = "@(#)biz22.c     4.2 %G%";
-static int sigALRM();
-static int timeout = 0;
+static int sigALRM();
+static int timeout = 0;
+static jmp_buf timeoutbuf;
 
 /*
  * Dial up on a BIZCOMP Model 1022 with either
 
 /*
  * Dial up on a BIZCOMP Model 1022 with either
@@ -69,34 +72,38 @@ biz_dialer(num, mod)
 biz22w_dialer(num, acu)
        char *num, *acu;
 {
 biz22w_dialer(num, acu)
        char *num, *acu;
 {
+
        return (biz_dialer(num, "W"));
 }
 
 biz22f_dialer(num, acu)
        char *num, *acu;
 {
        return (biz_dialer(num, "W"));
 }
 
 biz22f_dialer(num, acu)
        char *num, *acu;
 {
+
        return (biz_dialer(num, "V"));
 }
 
 biz22_disconnect()
 {
        return (biz_dialer(num, "V"));
 }
 
 biz22_disconnect()
 {
-       write(FD, DISCONNECT, 4);
+       int rw = 2;
+
+       write(FD, DISCONNECT_CMD, 4);
        sleep(2);
        sleep(2);
-       ioctl(FD, TIOCFLUSH);
+       ioctl(FD, TIOCFLUSH, &rw);
 }
 
 biz22_abort()
 {
 }
 
 biz22_abort()
 {
+
        write(FD, "\02", 1);
        write(FD, "\02", 1);
-       timeout = 1;
 }
 
 static int
 sigALRM()
 {
 }
 
 static int
 sigALRM()
 {
-       signal(SIGALRM, SIG_IGN);
-       printf("\07timeout waiting for reply\n");
+
        timeout = 1;
        timeout = 1;
+       longjmp(timeoutbuf, 1);
 }
 
 static int
 }
 
 static int
@@ -104,16 +111,19 @@ cmd(s)
        register char *s;
 {
        char c;
        register char *s;
 {
        char c;
+       int (*f)();
 
        write(FD, s, strlen(s));
 
        write(FD, s, strlen(s));
-       timeout = 0;
-       signal(SIGALRM, biz22_abort);
+       f = signal(SIGALRM, sigALRM);
+       if (setjmp(timeoutbuf)) {
+               biz22_abort();
+               signal(SIGALRM, f);
+               return (1);
+       }
        alarm(number(value(DIALTIMEOUT)));
        read(FD, &c, 1);
        alarm(0);
        alarm(number(value(DIALTIMEOUT)));
        read(FD, &c, 1);
        alarm(0);
-       signal(SIGALRM, SIG_DFL);
-       if (timeout)
-               return (1);
+       signal(SIGALRM, f);
        c &= 0177;
        return (c != '\r');
 }
        c &= 0177;
        return (c != '\r');
 }
@@ -123,20 +133,23 @@ detect(s)
        register char *s;
 {
        char c;
        register char *s;
 {
        char c;
+       int (*f)();
 
 
-       signal(SIGALRM, biz22_abort);
+       f = signal(SIGALRM, sigALRM);
        timeout = 0;
        while (*s) {
        timeout = 0;
        while (*s) {
+               if (setjmp(timeoutbuf)) {
+                       biz22_abort();
+                       break;
+               }
                alarm(number(value(DIALTIMEOUT)));
                read(FD, &c, 1);
                alarm(0);
                alarm(number(value(DIALTIMEOUT)));
                read(FD, &c, 1);
                alarm(0);
-               if (timeout)
-                       return (0);
                c &= 0177;
                if (c != *s++)
                        return (0);
        }
                c &= 0177;
                if (c != *s++)
                        return (0);
        }
-       signal(SIGALRM, SIG_DFL);
-       return (1);
+       signal(SIGALRM, f);
+       return (timeout == 0);
 }
 #endif
 }
 #endif
index 3001ec9..fda6f19 100644 (file)
@@ -1,13 +1,16 @@
-/*     biz31.c 4.5     83/06/15        */
+#ifndef lint
+static char sccsid[] = "@(#)biz31.c    4.6 (Berkeley) %G%";
+#endif
+
 #include "tip.h"
 
 #if BIZ1031
 #define MAXRETRY       3               /* sync up retry count */
 #include "tip.h"
 
 #if BIZ1031
 #define MAXRETRY       3               /* sync up retry count */
-#define DISCONNECT     "\21\25\11\24"  /* disconnection string */
+#define DISCONNECT_CMD "\21\25\11\24"  /* disconnection string */
 
 
-static char *sccsid = "@(#)biz31.c     4.5 %G%";
-static int sigALRM();
-static int timeout = 0;
+static int sigALRM();
+static int timeout = 0;
+static jmp_buf timeoutbuf;
 
 /*
  * Dial up on a BIZCOMP Model 1031 with either
 
 /*
  * Dial up on a BIZCOMP Model 1031 with either
@@ -33,7 +36,7 @@ biz_dialer(num, mod)
        echo(mod);
        echo("$\r$\n");
        echo("$>$.$ #\re$ ");                   /* disconnection sequence */
        echo(mod);
        echo("$\r$\n");
        echo("$>$.$ #\re$ ");                   /* disconnection sequence */
-       echo(DISCONNECT);
+       echo(DISCONNECT_CMD);
        echo("\r$\n$\r$\n");
        echo("$>$.$ #\rr$ ");                   /* repeat dial */
        echo(num);
        echo("\r$\n$\r$\n");
        echo("$>$.$ #\rr$ ");                   /* repeat dial */
        echo(num);
@@ -67,26 +70,29 @@ biz_dialer(num, mod)
 biz31w_dialer(num, acu)
        char *num, *acu;
 {
 biz31w_dialer(num, acu)
        char *num, *acu;
 {
+
        return (biz_dialer(num, "w"));
 }
 
 biz31f_dialer(num, acu)
        char *num, *acu;
 {
        return (biz_dialer(num, "w"));
 }
 
 biz31f_dialer(num, acu)
        char *num, *acu;
 {
+
        return (biz_dialer(num, "f"));
 }
 
 biz31_disconnect()
 {
        return (biz_dialer(num, "f"));
 }
 
 biz31_disconnect()
 {
-       write(FD, DISCONNECT, 4);
+
+       write(FD, DISCONNECT_CMD, 4);
        sleep(2);
        ioctl(FD, TIOCFLUSH);
 }
 
 biz31_abort()
 {
        sleep(2);
        ioctl(FD, TIOCFLUSH);
 }
 
 biz31_abort()
 {
+
        write(FD, "\33", 1);
        write(FD, "\33", 1);
-       timeout = 1;
 }
 
 static int
 }
 
 static int
@@ -116,9 +122,9 @@ echo(s)
 static int
 sigALRM()
 {
 static int
 sigALRM()
 {
-       signal(SIGALRM, SIG_IGN);
-       printf("\07timeout waiting for reply\n");
+
        timeout = 1;
        timeout = 1;
+       longjmp(timeoutbuf, 1);
 }
 
 static int
 }
 
 static int
@@ -126,20 +132,24 @@ detect(s)
        register char *s;
 {
        char c;
        register char *s;
 {
        char c;
+       int (*f)();
 
 
-       signal(SIGALRM, biz31_abort);
+       f = signal(SIGALRM, sigALRM);
        timeout = 0;
        while (*s) {
        timeout = 0;
        while (*s) {
+               if (setjmp(timeoutbuf)) {
+                       printf("\07timeout waiting for reply\n");
+                       biz31_abort();
+                       break;
+               }
                alarm(number(value(DIALTIMEOUT)));
                read(FD, &c, 1);
                alarm(0);
                alarm(number(value(DIALTIMEOUT)));
                read(FD, &c, 1);
                alarm(0);
-               if (timeout)
-                       return (0);
                if (c != *s++)
                if (c != *s++)
-                       return (0);
+                       break;
        }
        }
-       signal(SIGALRM, SIG_DFL);
-       return (1);
+       signal(SIGALRM, f);
+       return (timeout == 0);
 }
 
 static int
 }
 
 static int
@@ -147,19 +157,18 @@ flush(s)
        register char *s;
 {
        char c;
        register char *s;
 {
        char c;
+       int (*f)();
 
 
-       signal(SIGALRM, sigALRM);
-       timeout = 0;
+       f = signal(SIGALRM, sigALRM);
        while (*s++) {
        while (*s++) {
+               if (setjmp(timeoutbuf))
+                       break;
                alarm(10);
                read(FD, &c, 1);
                alarm(0);
                alarm(10);
                read(FD, &c, 1);
                alarm(0);
-               if (timeout)
-                       break;
        }
        }
-       signal(SIGALRM, SIG_DFL);
+       signal(SIGALRM, f);
        timeout = 0;                    /* guard against disconnection */
        timeout = 0;                    /* guard against disconnection */
-       return (1);
 }
 
 /*
 }
 
 /*
@@ -193,7 +202,7 @@ retry:
        nono:
                        if (already > MAXRETRY)
                                return (0);
        nono:
                        if (already > MAXRETRY)
                                return (0);
-                       write(fd, DISCONNECT, 4);
+                       write(fd, DISCONNECT_CMD, 4);
                        sleep(2);
                        already++;
                        goto retry;
                        sleep(2);
                        already++;
                        goto retry;
index 0f9f7a4..504e97e 100644 (file)
@@ -1,20 +1,22 @@
-/*     df.c    4.6     83/06/15        */
+#ifndef lint
+static char sccsid[] = "@(#)df.c       4.7 (Berkeley) %G%";
+#endif
+
 /*
  * Dial the DF02-AC or DF03-AC
  */
 
 #if defined(DF02) || defined(DF03)
 #include "tip.h"
 /*
  * Dial the DF02-AC or DF03-AC
  */
 
 #if defined(DF02) || defined(DF03)
 #include "tip.h"
-#include <setjmp.h>
 
 
-static char *sccsid = "@(#)df.c        4.6 %G%";
-static jmp_buf Sjbuf;
+static jmp_buf Sjbuf;
 static timeout();
 
 #if DF02
 df02_dialer(num, acu)
        char *num, *acu;
 {
 static timeout();
 
 #if DF02
 df02_dialer(num, acu)
        char *num, *acu;
 {
+
        return (df_dialer(num, acu, 0));
 }
 #endif
        return (df_dialer(num, acu, 0));
 }
 #endif
@@ -23,6 +25,7 @@ df02_dialer(num, acu)
 df03_dialer(num, acu)
        char *num, *acu;
 {
 df03_dialer(num, acu)
        char *num, *acu;
 {
+
        return (df_dialer(num, acu, 1));
 }
 #endif
        return (df_dialer(num, acu, 1));
 }
 #endif
@@ -33,10 +36,8 @@ df_dialer(num, acu, df03)
 {
        register int f = FD;
        struct sgttyb buf;
 {
        register int f = FD;
        struct sgttyb buf;
-       int speed = 0, c = 0;
-#ifdef TIOCMSET
-       int st = MST;           /* Secondary Transmit flag, for speed select */
-#endif
+       int speed = 0, rw = 2;
+       char c = '\0';
 
        ioctl(f, TIOCHPCL, 0);          /* make sure it hangs up when done */
        if (setjmp(Sjbuf)) {
 
        ioctl(f, TIOCHPCL, 0);          /* make sure it hangs up when done */
        if (setjmp(Sjbuf)) {
@@ -49,6 +50,8 @@ df_dialer(num, acu, df03)
        fflush(stdout);
 #ifdef TIOCMSET
        if (df03) {
        fflush(stdout);
 #ifdef TIOCMSET
        if (df03) {
+               int st = TIOCM_ST;      /* secondary Transmit flag */
+
                ioctl(f, TIOCGETP, &buf);
                if (buf.sg_ospeed != B1200) {   /* must dial at 1200 baud */
                        speed = buf.sg_ospeed;
                ioctl(f, TIOCGETP, &buf);
                if (buf.sg_ospeed != B1200) {   /* must dial at 1200 baud */
                        speed = buf.sg_ospeed;
@@ -61,12 +64,12 @@ df_dialer(num, acu, df03)
 #endif
        signal(SIGALRM, timeout);
        alarm(5 * strlen(num) + 10);
 #endif
        signal(SIGALRM, timeout);
        alarm(5 * strlen(num) + 10);
-       ioctl(f, TIOCFLUSH, 0);
+       ioctl(f, TIOCFLUSH, &rw);
        write(f, "\001", 1);
        sleep(1);
        write(f, "\002", 1);
        write(f, num, strlen(num));
        write(f, "\001", 1);
        sleep(1);
        write(f, "\002", 1);
        write(f, num, strlen(num));
-       read(f, (char *)&c, 1);
+       read(f, &c, 1);
 #ifdef TIOCMSET
        if (df03 && speed) {
                buf.sg_ispeed = buf.sg_ospeed = speed;
 #ifdef TIOCMSET
        if (df03 && speed) {
                buf.sg_ispeed = buf.sg_ospeed = speed;
@@ -76,26 +79,27 @@ df_dialer(num, acu, df03)
        return (c == 'A');
 }
 
        return (c == 'A');
 }
 
-
 df_disconnect()
 {
 df_disconnect()
 {
+       int rw = 2;
+
        write(FD, "\001", 1);
        sleep(1);
        write(FD, "\001", 1);
        sleep(1);
-       ioctl(FD, TIOCFLUSH, 0);
+       ioctl(FD, TIOCFLUSH, &rw);
 }
 
 
 df_abort()
 {
 }
 
 
 df_abort()
 {
-       write(FD, "\001", 1);
-       sleep(1);
-       ioctl(FD, TIOCFLUSH, 0);
+
+       df_disconnect();
 }
 
 
 static
 timeout()
 {
 }
 
 
 static
 timeout()
 {
+
        longjmp(Sjbuf, 1);
 }
 #endif
        longjmp(Sjbuf, 1);
 }
 #endif
index 483384f..07616f8 100644 (file)
@@ -1,18 +1,14 @@
-/*     dn11.c  4.12    83/06/15        */
+#ifndef lint
+static char sccsid[] = "@(#)dn11.c     4.13 (Berkeley) %G%";
+#endif
 
 #if DN11
 /*
  * Routines for dialing up on DN-11
  */
 #include "tip.h"
 
 #if DN11
 /*
  * Routines for dialing up on DN-11
  */
 #include "tip.h"
-#include <setjmp.h>
-#include <errno.h>
-
-int dn_abort();
 
 
-int alarmtr();
-
-static char *sccsid = "@(#)dn11.c      4.12 %G%";
+int dn_abort(), alarmtr();
 static jmp_buf jmpbuf;
 static int child = -1, dn;
 
 static jmp_buf jmpbuf;
 static int child = -1, dn;
 
@@ -81,6 +77,7 @@ dn_dialer(num, acu)
 
 alarmtr()
 {
 
 alarmtr()
 {
+
        alarm(0);
        longjmp(jmpbuf, 1);
 }
        alarm(0);
        longjmp(jmpbuf, 1);
 }
@@ -91,25 +88,23 @@ alarmtr()
  */
 dn_disconnect()
 {
  */
 dn_disconnect()
 {
+
        sleep(2);
        sleep(2);
-#ifdef VMUNIX
        if (FD > 0)
                ioctl(FD, TIOCCDTR, 0);
        if (FD > 0)
                ioctl(FD, TIOCCDTR, 0);
-#endif
        close(FD);
 }
 
 dn_abort()
 {
        close(FD);
 }
 
 dn_abort()
 {
+
        sleep(2);
        if (child > 0)
                kill(child, SIGKILL);
        if (dn > 0)
                close(dn);
        sleep(2);
        if (child > 0)
                kill(child, SIGKILL);
        if (dn > 0)
                close(dn);
-#ifdef VMUNIX
        if (FD > 0)
                ioctl(FD, TIOCCDTR, 0);
        if (FD > 0)
                ioctl(FD, TIOCCDTR, 0);
-#endif
        close(FD);
 }
 #endif
        close(FD);
 }
 #endif
index ad91d4e..bbf8527 100644 (file)
@@ -1,17 +1,16 @@
-/*     v3451.c 4.2     83/06/24        */
+#ifndef lint
+static char sccsid[] = "@(#)v3451.c    4.3 (Berkeley) %G%";
+#endif
 
 
-#if VADIC
+#ifdef V3451
 /*
  * Routines for calling up on a Vadic 3451 Modem
  */
 #include "tip.h"
 /*
  * Routines for calling up on a Vadic 3451 Modem
  */
 #include "tip.h"
-#include <setjmp.h>
-#include <errno.h>
-#include <signal.h>
 
 static jmp_buf Sjbuf;
 
 
 static jmp_buf Sjbuf;
 
-vadic_dialer(num, acu)
+v3451_dialer(num, acu)
        register char *num;
        char *acu;
 {
        register char *num;
        char *acu;
 {
@@ -86,13 +85,13 @@ vadic_dialer(num, acu)
        return (1);
 }
 
        return (1);
 }
 
-vadic_disconnect()
+v3451_disconnect()
 {
 
        close(FD);
 }
 
 {
 
        close(FD);
 }
 
-vadic_abort()
+v3451_abort()
 {
 
        close(FD);
 {
 
        close(FD);
@@ -176,3 +175,4 @@ prefix(s1, s2)
                        return (1);
        return (c == '\0');
 }
                        return (1);
        return (c == '\0');
 }
+#endif
index ef8e269..88ff50c 100644 (file)
@@ -1,20 +1,15 @@
-/*     v831.c  4.3     83/06/18        */
+#ifndef lint
+static char sccsid[] = "@(#)v831.c     4.4 (Berkeley) %G%";
+#endif
 
 #ifdef V831
 /*
  * Routines for dialing up on Vadic 831
  */
 
 #ifdef V831
 /*
  * Routines for dialing up on Vadic 831
  */
-#include <sys/file.h>
 #include <sys/time.h>
 
 #include <sys/time.h>
 
-#include <setjmp.h>
-#include <errno.h>
-#include <sgtty.h>
-
 #include "tip.h"
 
 #include "tip.h"
 
-static char *sccsid = "@(#)v831.c      4.3 %G%";
-
 int    v831_abort();
 static int alarmtr();
 extern errno;
 int    v831_abort();
 static int alarmtr();
 extern errno;
@@ -105,7 +100,6 @@ v831_disconnect()
         struct sgttyb cntrl;
 
         sleep(2);
         struct sgttyb cntrl;
 
         sleep(2);
-#ifdef VMUNIX
 #ifdef DEBUG
         printf("[disconnect: FD=%d]\n", FD);
 #endif
 #ifdef DEBUG
         printf("[disconnect: FD=%d]\n", FD);
 #endif
@@ -116,7 +110,6 @@ v831_disconnect()
                 ioctl(FD, TIOCSETP, &cntrl);
                 ioctl(FD, TIOCNXCL, (struct sgttyb *)NULL);
         }
                 ioctl(FD, TIOCSETP, &cntrl);
                 ioctl(FD, TIOCNXCL, (struct sgttyb *)NULL);
         }
-#endif
         close(FD);
 }
 
         close(FD);
 }
 
@@ -132,10 +125,8 @@ v831_abort()
         if (AC > 0)
                 ioctl(FD, TIOCNXCL, (struct sgttyb *)NULL);
                 close(AC);
         if (AC > 0)
                 ioctl(FD, TIOCNXCL, (struct sgttyb *)NULL);
                 close(AC);
-#ifdef VMUNIX
         if (FD > 0)
                 ioctl(FD, TIOCCDTR, 0);
         if (FD > 0)
                 ioctl(FD, TIOCCDTR, 0);
-#endif
         close(FD);
 }
 #endif
         close(FD);
 }
 #endif
index ba5c87f..859795e 100644 (file)
@@ -1,19 +1,19 @@
-/*     ventel.c        1.3     83/06/15        */
+#ifndef lint
+static char sccsid[] = "@(#)ventel.c   1.4 (Berkeley) %G%";
+#endif
 
 #if VENTEL
 /*
  * Routines for calling up on a Ventel Modem
 
 #if VENTEL
 /*
  * Routines for calling up on a Ventel Modem
+ * The Ventel is expected to be strapped for "no echo".
  */
 #include "tip.h"
  */
 #include "tip.h"
-#include <setjmp.h>
-#include <errno.h>
 
 #define        MAXRETRY        5
 
 #define        MAXRETRY        5
-#define        DISCONNECT      "\03"           /* ^C */
 
 
-static char *sccsid = "@(#)ventel.c    1.3 %G%";
-static int sigALRM();
-static int timeout = 0;
+static int sigALRM();
+static int timeout = 0;
+static jmp_buf timeoutbuf;
 
 ven_dialer(num, acu)
        register char *num;
 
 ven_dialer(num, acu)
        register char *num;
@@ -38,13 +38,12 @@ ven_dialer(num, acu)
                printf("\ndialing...");
        fflush(stdout);
        ioctl(FD, TIOCHPCL, 0);
                printf("\ndialing...");
        fflush(stdout);
        ioctl(FD, TIOCHPCL, 0);
-       echo("k$\r$\n$D$I$A$L$:$ <");
+       echo("#k$\r$\n$D$I$A$L$:$ ");
        for (cp = num; *cp; cp++) {
                sleep(1);
                write(FD, cp, 1);
        for (cp = num; *cp; cp++) {
                sleep(1);
                write(FD, cp, 1);
-               read(FD, cp, 1);
        }
        }
-       echo(">\r$\n");
+       echo("\r$\n");
        if (gobble('\n'))
                connected = gobble('!');
        ioctl(FD, TIOCFLUSH);
        if (gobble('\n'))
                connected = gobble('!');
        ioctl(FD, TIOCFLUSH);
@@ -62,11 +61,13 @@ ven_dialer(num, acu)
 
 ven_disconnect()
 {
 
 ven_disconnect()
 {
+
        close(FD);
 }
 
 ven_abort()
 {
        close(FD);
 }
 
 ven_abort()
 {
+
        write(FD, "\03", 1);
        close(FD);
 }
        write(FD, "\03", 1);
        close(FD);
 }
@@ -98,46 +99,49 @@ echo(s)
 static int
 sigALRM()
 {
 static int
 sigALRM()
 {
-       signal(SIGALRM, SIG_IGN);
+
        printf("\07timeout waiting for reply\n");
        timeout = 1;
        printf("\07timeout waiting for reply\n");
        timeout = 1;
+       longjmp(timeoutbuf, 1);
 }
 
 static int
 }
 
 static int
-gobble(s)
-       register char s;
+gobble(match)
+       register char match;
 {
        char c;
 {
        char c;
+       int (*f)();
 
        signal(SIGALRM, sigALRM);
        timeout = 0;
        do {
 
        signal(SIGALRM, sigALRM);
        timeout = 0;
        do {
+               if (setjmp(timeoutbuf)) {
+                       signal(SIGALRM, f);
+                       return (0);
+               }
                alarm(number(value(DIALTIMEOUT)));
                read(FD, &c, 1);
                alarm(number(value(DIALTIMEOUT)));
                read(FD, &c, 1);
-               c &= 0177;
                alarm(0);
                alarm(0);
+               c &= 0177;
 #ifdef notdef
                if (boolean(value(VERBOSE)))
                        putchar(c);
 #endif
 #ifdef notdef
                if (boolean(value(VERBOSE)))
                        putchar(c);
 #endif
-               if (timeout)
-                       return (0);
-       } while (c != '\n' && c != s);
+       } while (c != '\n' && c != match);
        signal(SIGALRM, SIG_DFL);
        signal(SIGALRM, SIG_DFL);
-       return (c == s);
+       return (c == match);
 }
 
 #define min(a,b)       ((a)>(b)?(b):(a))
 /*
  * This convoluted piece of code attempts to get
 }
 
 #define min(a,b)       ((a)>(b)?(b):(a))
 /*
  * This convoluted piece of code attempts to get
- * the ventel in sync.  If you don't have the capacity or nread
- * call there are gory ways to simulate this.
+ * the ventel in sync.  If you don't have FIONREAD
+ * there are gory ways to simulate this.
  */
 static int
 vensync(fd)
 {
  */
 static int
 vensync(fd)
 {
-       long nread;
-       register int already = 0, nbytes;
+       int already = 0, nread;
        char buf[60];
 
        /*
        char buf[60];
 
        /*
@@ -161,17 +165,18 @@ vensync(fd)
                sleep(1);
                write(fd, "\r", 1);
                sleep(3);
                sleep(1);
                write(fd, "\r", 1);
                sleep(3);
-               if (ioctl(fd, FIONREAD, (caddr_t)&nread) >= 0) {
-                       nbytes = nread;
-                       while (nbytes > 0) {
-                               read(fd, buf, min(nbytes, 60));
-                               if ((buf[nbytes-1]&0177) == '$')
-                                       return (1);
-                               nbytes -= min(nbytes, 60);
-                       }
-                       sleep(1);
-                       already++;
+               if (ioctl(fd, FIONREAD, (caddr_t)&nread) < 0) {
+                       perror("tip: ioctl");
+                       continue;
                }
                }
+               while (nread > 0) {
+                       read(fd, buf, min(nread, 60));
+                       if ((buf[nread - 1] & 0177) == '$')
+                               return (1);
+                       nread -= min(nread, 60);
+               }
+               sleep(1);
+               already++;
        }
        return (0);
 }
        }
        return (0);
 }
index e3c7d7e..104c6f7 100644 (file)
@@ -1,4 +1,7 @@
-/*     acutab.c        4.6     83/06/15        */
+#ifndef lint
+static char sccsid[] = "@(#)acutab.c   4.7 (Berkeley) %G%";
+#endif
+
 #include "tip.h"
 
 extern int df02_dialer(), df03_dialer(), df_disconnect(), df_abort(),
 #include "tip.h"
 
 extern int df02_dialer(), df03_dialer(), df_disconnect(), df_abort(),
@@ -7,7 +10,7 @@ extern int df02_dialer(), df03_dialer(), df_disconnect(), df_abort(),
           biz22f_dialer(), biz22_disconnect(), biz22_abort(),
           biz22w_dialer(),
           ven_dialer(), ven_disconnect(), ven_abort(),
           biz22f_dialer(), biz22_disconnect(), biz22_abort(),
           biz22w_dialer(),
           ven_dialer(), ven_disconnect(), ven_abort(),
-          vadic_dialer(), vadic_disconnect(), vadic_abort(),
+          v3451_dialer(), v3451_disconnect(), v3451_abort(),
           v831_dialer(), v831_disconnect(), v831_abort(),
           dn_dialer(), dn_disconnect(), dn_abort();
 
           v831_dialer(), v831_disconnect(), v831_abort(),
           dn_dialer(), dn_disconnect(), dn_abort();
 
@@ -32,10 +35,16 @@ acu_t acutable[] = {
 #ifdef VENTEL
        "ventel",ven_dialer,    ven_disconnect,         ven_abort,
 #endif
 #ifdef VENTEL
        "ventel",ven_dialer,    ven_disconnect,         ven_abort,
 #endif
-#ifdef VADIC
-       "vadic",vadic_dialer,   vadic_disconnect,       vadic_abort,
+#ifdef V3451
+#ifndef V831
+       "vadic",v3451_dialer,   v3451_disconnect,       v3451_abort,
+#endif
+       "v3451",v3451_dialer,   v3451_disconnect,       v3451_abort,
 #endif
 #ifdef V831
 #endif
 #ifdef V831
+#ifndef V3451
+       "vadic",v831_dialer,    v831_disconnect,        v831_abort,
+#endif
        "v831",v831_dialer,     v831_disconnect,        v831_abort,
 #endif
        0,      0,              0,                      0
        "v831",v831_dialer,     v831_disconnect,        v831_abort,
 #endif
        0,      0,              0,                      0
index 3e4d986..575b780 100644 (file)
@@ -1,4 +1,7 @@
-/*     cmds.c  4.11    83/06/15        */
+#ifndef lint
+static char sccsid[] = "@(#)cmds.c     4.12 (Berkeley) %G%";
+#endif
+
 #include "tip.h"
 /*
  * tip
 #include "tip.h"
 /*
  * tip
@@ -6,8 +9,6 @@
  * miscellaneous commands
  */
 
  * miscellaneous commands
  */
 
-static char *sccsid = "@(#)cmds.c      4.11 %G%";
-
 int    quant[] = { 60, 60, 24 };
 
 char   null = '\0';
 int    quant[] = { 60, 60, 24 };
 
 char   null = '\0';
@@ -26,9 +27,7 @@ int   intcopy();              /* interrupt routine for file transfers */
 getfl(c)
        char c;
 {
 getfl(c)
        char c;
 {
-       char buf[256];
-       char *copynamex;
-       char *expand();
+       char buf[256], *cp, *expand();
        
        putchar(c);
        /*
        
        putchar(c);
        /*
@@ -36,8 +35,8 @@ getfl(c)
         */
        if (prompt("Local file name? ", copyname))
                return;
         */
        if (prompt("Local file name? ", copyname))
                return;
-       copynamex = expand(copyname);
-       if ((sfd = creat(copynamex, 0666)) < 0) {
+       cp = expand(copyname);
+       if ((sfd = creat(cp, 0666)) < 0) {
                printf("\r\n%s: cannot creat\r\n", copyname);
                return;
        }
                printf("\r\n%s: cannot creat\r\n", copyname);
                return;
        }
@@ -59,9 +58,7 @@ cu_take(cc)
        char cc;
 {
        int fd, argc;
        char cc;
 {
        int fd, argc;
-       char line[BUFSIZ];
-       char *expand();
-       char *copynamex;
+       char line[BUFSIZ], *expand(), *cp;
 
        if (prompt("[take] ", copyname))
                return;
 
        if (prompt("[take] ", copyname))
                return;
@@ -71,8 +68,8 @@ cu_take(cc)
        }
        if (argc == 1)
                argv[1] = argv[0];
        }
        if (argc == 1)
                argv[1] = argv[0];
-       copynamex = expand(argv[1]);
-       if ((fd = creat(copynamex, 0666)) < 0) {
+       cp = expand(argv[1]);
+       if ((fd = creat(cp, 0666)) < 0) {
                printf("\r\n%s: cannot create\r\n", argv[1]);
                return;
        }
                printf("\r\n%s: cannot create\r\n", argv[1]);
                return;
        }
@@ -80,6 +77,7 @@ cu_take(cc)
        transfer(line, fd, "\01");
 }
 
        transfer(line, fd, "\01");
 }
 
+static jmp_buf intbuf;
 /*
  * Bulk transfer routine --
  *  used by getfl(), cu_take(), and pipefile()
 /*
  * Bulk transfer routine --
  *  used by getfl(), cu_take(), and pipefile()
@@ -92,10 +90,10 @@ transfer(buf, fd, eofchars)
        register char *p = buffer;
        register int cnt, eof;
        time_t start;
        register char *p = buffer;
        register int cnt, eof;
        time_t start;
+       int (*f)();
 
        pwrite(FD, buf, size(buf));
        quit = 0;
 
        pwrite(FD, buf, size(buf));
        quit = 0;
-       signal(SIGINT, intcopy);
        kill(pid, SIGIOT);
        read(repdes[0], (char *)&ccc, 1);  /* Wait until read process stops */
        
        kill(pid, SIGIOT);
        read(repdes[0], (char *)&ccc, 1);  /* Wait until read process stops */
        
@@ -108,7 +106,9 @@ transfer(buf, fd, eofchars)
        while ((c&0177) != '\n');
        ioctl(0, TIOCSETC, &defchars);
        
        while ((c&0177) != '\n');
        ioctl(0, TIOCSETC, &defchars);
        
+       f = signal(SIGINT, intcopy);
        start = time(0);
        start = time(0);
+       (void) setjmp(intbuf);
        for (ct = 0; !quit;) {
                eof = read(FD, &c, 1) <= 0;
                c &= 0177;
        for (ct = 0; !quit;) {
                eof = read(FD, &c, 1) <= 0;
                c &= 0177;
@@ -196,6 +196,7 @@ pipefile()
  */
 stopsnd()
 {
  */
 stopsnd()
 {
+
        stop = 1;
        signal(SIGINT, SIG_IGN);
 }
        stop = 1;
        signal(SIGINT, SIG_IGN);
 }
@@ -464,43 +465,6 @@ consh(c)
 }
 #endif
 
 }
 #endif
 
-/*
- * Execute command under local shell
- */
-lcmd()
-{
-       int shpid, status;
-       extern char **environ;
-       char *cp;
-       char    cmdline[255];
-       register char *cmdp = cmdline;
-
-       if (prompt("!", cmdline))
-               if (stoprompt)
-                       return;
-       signal(SIGINT, SIG_IGN);
-       signal(SIGQUIT, SIG_IGN);
-       unraw();
-       if (shpid = fork()) {
-               while (shpid != wait(&status));
-               raw();
-               printf("\r\n!\r\n");
-               signal(SIGINT, SIG_DFL);
-               signal(SIGQUIT, SIG_DFL);
-               return;
-       } else {
-               signal(SIGQUIT, SIG_DFL);
-               signal(SIGINT, SIG_DFL);
-               if ((cp = rindex(value(SHELL), '/')) == NULL)
-                       cp = value(SHELL);
-               else
-                       cp++;
-               execl(value(SHELL), cp, "-c", cmdline, 0);
-               printf("\r\ncan't execl!\r\n");
-               exit(1);
-       }
-}
-
 /*
  * Escape to local shell
  */
 /*
  * Escape to local shell
  */
@@ -562,14 +526,14 @@ setscript()
  */
 chdirectory()
 {
  */
 chdirectory()
 {
-       char    dirname[80];
+       char dirname[80];
        register char *cp = dirname;
 
        register char *cp = dirname;
 
-       if (prompt("[cd] ", dirname))
+       if (prompt("[cd] ", dirname)) {
                if (stoprompt)
                        return;
                if (stoprompt)
                        return;
-               else
-                       cp = value(HOME);
+               cp = value(HOME);
+       }
        if (chdir(cp) < 0)
                printf("%s: bad directory\r\n", cp);
        printf("!\r\n");
        if (chdir(cp) < 0)
                printf("%s: bad directory\r\n", cp);
        printf("!\r\n");
@@ -593,8 +557,10 @@ finish()
 
 intcopy()
 {
 
 intcopy()
 {
+
        raw();
        quit = 1;
        raw();
        quit = 1;
+       longjmp(intbuf, 1);
 }
 
 execute(s)
 }
 
 execute(s)
@@ -696,11 +662,10 @@ variable()
 }
 
 /*
 }
 
 /*
- * turn tandem mode on or off for remote tty
+ * Turn tandem mode on or off for remote tty.
  */
  */
-
 tandem(option)
 tandem(option)
-char *option;
+       char *option;
 {
        struct sgttyb rmtty;
 
 {
        struct sgttyb rmtty;
 
@@ -708,8 +673,7 @@ char *option;
        if (strcmp(option,"on") == 0) {
                rmtty.sg_flags |= TANDEM;
                arg.sg_flags |= TANDEM;
        if (strcmp(option,"on") == 0) {
                rmtty.sg_flags |= TANDEM;
                arg.sg_flags |= TANDEM;
-       }
-       else {
+       } else {
                rmtty.sg_flags &= ~TANDEM;
                arg.sg_flags &= ~TANDEM;
        }
                rmtty.sg_flags &= ~TANDEM;
                arg.sg_flags &= ~TANDEM;
        }
@@ -719,40 +683,25 @@ char *option;
 
 /*
  * Send a break.
 
 /*
  * Send a break.
- * If we can't do it directly (as on VMUNIX), then simulate it.
  */
 genbrk()
 {
  */
 genbrk()
 {
-#ifdef VMUNIX
+
        ioctl(FD, TIOCSBRK, NULL);
        sleep(1);
        ioctl(FD, TIOCCBRK, NULL);
        ioctl(FD, TIOCSBRK, NULL);
        sleep(1);
        ioctl(FD, TIOCCBRK, NULL);
-#else
-       struct sgttyb ttbuf;
-       int sospeed;
-
-       ioctl(FD, TIOCGETP, &ttbuf);
-       sospeed = ttbuf.sg_ospeed;
-       ttbuf.sg_ospeed = B150;
-       ioctl(FD, TIOCSETP, &ttbuf);
-       pwrite(FD, "\0\0\0\0\0\0\0\0\0\0", 10);
-       ttbuf.sg_ospeed = sospeed;
-       ioctl(FD, TIOCSETP, &ttbuf);
-       pwrite(FD, "@", 1);
-#endif
 }
 
 }
 
-#ifdef SIGTSTP
 /*
  * Suspend tip
  */
 suspend()
 {
 /*
  * Suspend tip
  */
 suspend()
 {
+
        unraw();
        kill(0, SIGTSTP);
        raw();
 }
        unraw();
        kill(0, SIGTSTP);
        raw();
 }
-#endif
 
 /*
  *     expand a file name if it includes shell meta characters
 
 /*
  *     expand a file name if it includes shell meta characters
index 20de4dd..6fb8fa8 100644 (file)
@@ -1,14 +1,15 @@
-/*     cmdtab.c        4.5     83/06/15        */
+#ifndef lint
+static char sccsid[] = "@(#)cmdtab.c   4.6 (Berkeley) %G%";
+#endif
+
 #include "tip.h"
 
 #include "tip.h"
 
-extern int shell(), lcmd(), getfl(), sendfile(), chdirectory(),
-       finish(), help(), pipefile(), consh(), variable(),
-       cu_take(), cu_put(), dollar(), genbrk(), suspend();
+extern int shell(), getfl(), sendfile(), chdirectory();
+extern int finish(), help(), pipefile(), consh(), variable();
+extern int cu_take(), cu_put(), dollar(), genbrk(), suspend();
 
 
-esctable_t etable[] =
-{
-       { '%',  NORM,   "shell",                         shell },
-       { '!',  NORM,   "local command",                 lcmd },
+esctable_t etable[] = {
+       { '!',  NORM,   "shell",                         shell },
        { '<',  NORM,   "receive file from remote host", getfl },
        { '>',  NORM,   "send file to remote host",      sendfile },
        { 't',  NORM,   "take file from remote UNIX",    cu_take },
        { '<',  NORM,   "receive file from remote host", getfl },
        { '>',  NORM,   "send file to remote host",      sendfile },
        { 't',  NORM,   "take file from remote UNIX",    cu_take },
@@ -20,9 +21,7 @@ esctable_t etable[] =
        { 'c',  NORM,   "change directory",              chdirectory },
        { '.',  NORM,   "exit from tip",                 finish },
        {CTRL(d),NORM,  "exit from tip",                 finish },
        { 'c',  NORM,   "change directory",              chdirectory },
        { '.',  NORM,   "exit from tip",                 finish },
        {CTRL(d),NORM,  "exit from tip",                 finish },
-#ifdef SIGTSTP
        {CTRL(z),NORM,  "suspend tip",                   suspend },
        {CTRL(z),NORM,  "suspend tip",                   suspend },
-#endif
        { 's',  NORM,   "set variable",                  variable },
        { '?',  NORM,   "get this summary",              help },
        { '#',  NORM,   "send break",                    genbrk },
        { 's',  NORM,   "set variable",                  variable },
        { '?',  NORM,   "get this summary",              help },
        { '#',  NORM,   "send break",                    genbrk },
index 71aa2e5..3e979ca 100644 (file)
@@ -1,8 +1,9 @@
-/*     cu.c    4.4     83/06/15        */
+#ifndef lint
+static char sccsid[] = "@(#)cu.c       4.5 (Berkeley) %G%";
+#endif
 
 #include "tip.h"
 
 
 #include "tip.h"
 
-static char *sccsid = "@(#)cu.c        4.4 %G%";
 int    cleanup();
 int    timeout();
 
 int    cleanup();
 int    timeout();
 
index 96b3bd0..adac659 100644 (file)
@@ -1,41 +1,32 @@
-/*     hunt.c  4.6     83/06/15        */
-#include "tip.h"
-#include <sys/stat.h>
+#ifndef lint
+static char sccsid[] = "@(#)hunt.c     4.7 (Berkeley) %G%";
+#endif
 
 
-#define RD     04
-#define EX     01
+#include "tip.h"
 
 
-static char *sccsid = "@(#)hunt.c      4.6 %G%";
 extern char *getremote();
 extern char *rindex();
 
 extern char *getremote();
 extern char *rindex();
 
-int deadfl;
+static jmp_buf deadline;
+static int deadfl;
 
 dead()
 {
 
 dead()
 {
+
        deadfl = 1;
        deadfl = 1;
+       longjmp(deadline, 1);
 }
 
 hunt(name)
        char *name;
 {
        register char *cp;
 }
 
 hunt(name)
        char *name;
 {
        register char *cp;
-       char string[100];
-       struct stat     statbuf;
+       int (*f)();
 
 
+       f = signal(SIGALRM, dead);
        deadfl = 0;
        deadfl = 0;
-       signal(SIGALRM, dead);
        while (cp = getremote(name)) {
                uucplock = rindex(cp, '/')+1;
        while (cp = getremote(name)) {
                uucplock = rindex(cp, '/')+1;
-               if(strncmp(uucplock,"ttyd",4) == 0){
-                       /* reverse dialin line */
-                       if((stat(cp,&statbuf) != 0) ||
-                       ((statbuf.st_mode & EX) == 0))
-                               continue;
-                       sprintf(string,"/usr/lib/uucp/disable %s",uucplock);
-                       if(system(string)) continue;
-                       sleep(5); /* insure that phone line is dropped */
-               }
                if (mlock(uucplock) < 0) {
                        delock(uucplock);
                        continue;
                if (mlock(uucplock) < 0) {
                        delock(uucplock);
                        continue;
@@ -49,20 +40,19 @@ hunt(name)
                 */
                if (!HW)
                        break;
                 */
                if (!HW)
                        break;
-               alarm(10);
-               if ((FD = open(cp, 2)) >= 0){
-                       alarm(0);
-                       if (!deadfl) {
-                               ioctl(FD, TIOCEXCL, 0);
-                               ioctl(FD, TIOCHPCL, 0);
-                               signal(SIGALRM, SIG_DFL);
-                               return ((int)cp);
-                       }
+               if (setjmp(deadline) == 0) {
+                       alarm(10);
+                       FD = open(cp, O_RDWR);
                }
                alarm(0);
                }
                alarm(0);
-               signal(SIGALRM, dead);
+               if (!deadfl) {
+                       ioctl(FD, TIOCEXCL, 0);
+                       ioctl(FD, TIOCHPCL, 0);
+                       signal(SIGALRM, SIG_DFL);
+                       return ((int)cp);
+               }
                delock(uucplock);
        }
                delock(uucplock);
        }
-       signal(SIGALRM, SIG_DFL);
+       signal(SIGALRM, f);
        return (deadfl ? -1 : (int)cp);
 }
        return (deadfl ? -1 : (int)cp);
 }
index c3b8d30..448677f 100644 (file)
@@ -1,9 +1,11 @@
-/*     log.c   4.4     83/06/15        */
-#include "tip.h"
+#ifndef lint
+static char sccsid[] = "@(#)log.c      4.5 (Berkeley) %G%";
+#endif
 
 #ifdef ACULOG
 
 #ifdef ACULOG
-static char *sccsid = "@(#)log.c       4.4 %G%";
-static FILE *flog = NULL;
+#include "tip.h"
+
+static FILE *flog = NULL;
 
 /*
  * Log file maintenance routines
 
 /*
  * Log file maintenance routines
@@ -18,8 +20,8 @@ logent(group, num, acu, message)
 
        if (flog == NULL)
                return;
 
        if (flog == NULL)
                return;
-       if (!lock(value(LOCK))) {
-               fprintf(stderr, "can't lock up accounting file\r\n");
+       if (flock(fileno(flog), LOCK_EX) < 0) {
+               perror("tip: flock");
                return;
        }
        if ((user = getlogin()) == NOSTR)
                return;
        }
        if ((user = getlogin()) == NOSTR)
@@ -39,12 +41,14 @@ logent(group, num, acu, message)
 #endif
                acu, message);
        fflush(flog);
 #endif
                acu, message);
        fflush(flog);
-       unlock();
+       (void) flock(fileno(flog), LOCK_UN);
 }
 
 loginit()
 {
 }
 
 loginit()
 {
-       if ((flog = fopen(value(LOG), "a")) == NULL)
+
+       flog = fopen(value(LOG), "a");
+       if (flog == NULL)
                fprintf(stderr, "can't open log file\r\n");
 }
 #endif
                fprintf(stderr, "can't open log file\r\n");
 }
 #endif
index 4cea6dd..0ce9394 100644 (file)
@@ -1,10 +1,11 @@
-/*     partab.c        4.1     83/06/15        */
+#ifndef lint
+static char sccsid[] = "@(#)partab.c   4.2 (Berkeley) %G%";
+#endif
+
 /*
  * Even parity table for 0-0177
  */
 /*
  * Even parity table for 0-0177
  */
-
-
-char chartab[] = {
+char evenpartab[] = {
        0000,0201,0202,0003,0204,0005,0006,0207,
        0210,0011,0012,0213,0014,0215,0216,0017,
        0220,0021,0022,0223,0024,0225,0226,0027,
        0000,0201,0202,0003,0204,0005,0006,0207,
        0210,0011,0012,0213,0014,0215,0216,0017,
        0220,0021,0022,0223,0024,0225,0226,0027,
@@ -21,4 +22,4 @@ char chartab[] = {
        0350,0151,0152,0353,0154,0355,0356,0157,
        0360,0161,0162,0363,0164,0365,0366,0167,
        0170,0371,0372,0173,0374,0175,0176,0377,
        0350,0151,0152,0353,0154,0355,0356,0157,
        0360,0161,0162,0363,0164,0365,0366,0167,
        0170,0371,0372,0173,0374,0175,0176,0377,
-       };
+};
index 3c9140d..e3f6784 100644 (file)
@@ -1,51 +1,32 @@
-/*     remcap.c        4.7     83/06/15        */
-/* Copyright (c) 1979 Regents of the University of California */
-/*
- *     Modified 9/27/82 - Michael Wendel
- *                        General Instrument R&D
- *             Looks in user Remote file first.
- *             Looks in system Remote file for each tc= entry
- *             that cannot be resolved in the user Remote file.
- *             Finally looks into the system Remote file to
- *             resolve remote name.
- *             User remote file will supplement the system file
- *             since all the entries in the user file occur
- *             ahead of duplicate entries from the system file.
- */
-#ifndef BUFSIZ
-#define        BUFSIZ  1024
+#ifndef lint
+static char sccsid[] = "@(#)remcap.c   4.8 (Berkeley) %G%";
 #endif
 #endif
-#define MAXHOP 32      /* max number of tc= indirections */
 
 
-#include <ctype.h>
-#ifdef VMUNIX
-#include "local/uparm.h"
-#endif
 /*
  * remcap - routines for dealing with the remote host data base
  *
 /*
  * remcap - routines for dealing with the remote host data base
  *
- *     Made from termcap with the following defines.
+ * derived from termcap
  */
  */
-#define REMOTE         /* special for tip */
-#define SYSREMOTE      "/etc/remote"  /* system remote file */
+#include <sys/file.h>
+#include <ctype.h>
+
+#ifndef BUFSIZ
+#define        BUFSIZ          1024
+#endif
+#define MAXHOP         32              /* max number of tc= indirections */
+#define SYSREMOTE      "/etc/remote"   /* system remote file */
 
 
-#ifdef REMOTE
 #define        tgetent         rgetent
 #define        tnchktc         rnchktc
 #define        tnamatch        rnamatch
 #define        tgetnum         rgetnum
 #define        tgetflag        rgetflag
 #define        tgetstr         rgetstr
 #define        tgetent         rgetent
 #define        tnchktc         rnchktc
 #define        tnamatch        rnamatch
 #define        tgetnum         rgetnum
 #define        tgetflag        rgetflag
 #define        tgetstr         rgetstr
-#undef E_TERMCAP
 #define        E_TERMCAP       RM = SYSREMOTE
 #define V_TERMCAP      "REMOTE"
 #define V_TERM         "HOST"
 
 char   *RM;
 #define        E_TERMCAP       RM = SYSREMOTE
 #define V_TERMCAP      "REMOTE"
 #define V_TERM         "HOST"
 
 char   *RM;
-#else
-#define        V_TERMCAP       "TERMCAP"
-#define V_TERM         "TERM"
-#endif
 
 /*
  * termcap - routines for dealing with the terminal capability data base
 
 /*
  * termcap - routines for dealing with the terminal capability data base
@@ -61,14 +42,13 @@ char        *RM;
  * doesn't, and because living w/o it is not hard.
  */
 
  * doesn't, and because living w/o it is not hard.
  */
 
-static char *sccsid = "@(#)remcap.c    4.7 %G%";
 static char *tbuf;
 static int hopcount;   /* detect infinite loops in termcap, init 0 */
 char   *tskip();
 char   *tgetstr();
 char   *tdecode();
 char   *getenv();
 static char *tbuf;
 static int hopcount;   /* detect infinite loops in termcap, init 0 */
 char   *tskip();
 char   *tgetstr();
 char   *tdecode();
 char   *getenv();
-static char    *remotefile;
+static char *remotefile;
 
 /*
  * Get an entry for terminal name in buffer bp,
 
 /*
  * Get an entry for terminal name in buffer bp,
@@ -78,22 +58,20 @@ static      char    *remotefile;
 tgetent(bp, name)
        char *bp, *name;
 {
 tgetent(bp, name)
        char *bp, *name;
 {
-       char lbuf[BUFSIZ];
-       int     rc1, rc2;
-       char *cp;
-       char *p;
+       char lbuf[BUFSIZ], *cp, *p;
+       int rc1, rc2;
 
        remotefile = cp = getenv(V_TERMCAP);
        if (cp == (char *)0 || strcmp(cp, SYSREMOTE) == 0) {
                remotefile = cp = SYSREMOTE;
 
        remotefile = cp = getenv(V_TERMCAP);
        if (cp == (char *)0 || strcmp(cp, SYSREMOTE) == 0) {
                remotefile = cp = SYSREMOTE;
-               return(getent(bp, name, cp));
+               return (getent(bp, name, cp));
        } else {
                if ((rc1 = getent(bp, name, cp)) != 1)
                        *bp = '\0';
                remotefile = cp = SYSREMOTE;
                rc2 = getent(lbuf, name, cp);
                if (rc1 != 1 && rc2 != 1)
        } else {
                if ((rc1 = getent(bp, name, cp)) != 1)
                        *bp = '\0';
                remotefile = cp = SYSREMOTE;
                rc2 = getent(lbuf, name, cp);
                if (rc1 != 1 && rc2 != 1)
-                       return(rc2);
+                       return (rc2);
                if (rc2 == 1) {
                        p = lbuf;
                        if (rc1 == 1)
                if (rc2 == 1) {
                        p = lbuf;
                        if (rc1 == 1)
@@ -101,12 +79,12 @@ tgetent(bp, name)
                                        ;
                        if (strlen(bp) + strlen(p) > BUFSIZ) {
                                write(2, "Remcap entry too long\n", 23);
                                        ;
                        if (strlen(bp) + strlen(p) > BUFSIZ) {
                                write(2, "Remcap entry too long\n", 23);
-                               return(-1);
+                               return (-1);
                        }
                        strcat(bp, p);
                }
                tbuf = bp;
                        }
                        strcat(bp, p);
                }
                tbuf = bp;
-               return(1);
+               return (1);
        }
 }
 
        }
 }
 
@@ -115,13 +93,11 @@ getent(bp, name, cp)
 {
        register int c;
        register int i = 0, cnt = 0;
 {
        register int c;
        register int i = 0, cnt = 0;
-       char ibuf[BUFSIZ];
-       char *cp2;
+       char ibuf[BUFSIZ], *cp2;
        int tf;
 
        tbuf = bp;
        tf = 0;
        int tf;
 
        tbuf = bp;
        tf = 0;
-#ifndef V6
        /*
         * TERMCAP can have one of two things in it. It can be the
         * name of a file to use instead of /etc/termcap. In this
        /*
         * TERMCAP can have one of two things in it. It can be the
         * name of a file to use instead of /etc/termcap. In this
@@ -132,24 +108,16 @@ getent(bp, name, cp)
        if (cp && *cp) {
                if (*cp!='/') {
                        cp2 = getenv(V_TERM);
        if (cp && *cp) {
                if (*cp!='/') {
                        cp2 = getenv(V_TERM);
-                       if (cp2==(char *) 0 || strcmp(name,cp2)==0) {
+                       if (cp2 == (char *)0 || strcmp(name,cp2) == 0) {
                                strcpy(bp,cp);
                                strcpy(bp,cp);
-                               return(tnchktc());
-                       } else {
-                               tf = open(E_TERMCAP, 0);
-                       }
+                               return (tnchktc());
+                       } else
+                               tf = open(E_TERMCAP, O_RDONLY);
                } else
                } else
-#ifdef REMOTE
-                       tf = open(RM = cp, 0);
-#else
-                       tf = open(cp, 0);
-#endif
+                       tf = open(RM = cp, O_RDONLY);
        }
        }
-       if (tf==0)
-               tf = open(E_TERMCAP, 0);
-#else
-       tf = open(E_TERMCAP, 0);
-#endif
+       if (tf == 0)
+               tf = open(E_TERMCAP, O_RDONLY);
        if (tf < 0)
                return (-1);
        for (;;) {
        if (tf < 0)
                return (-1);
        for (;;) {
@@ -184,7 +152,7 @@ getent(bp, name, cp)
                 */
                if (tnamatch(name)) {
                        close(tf);
                 */
                if (tnamatch(name)) {
                        close(tf);
-                       return(tnchktc());
+                       return (tnchktc());
                }
        }
 }
                }
        }
 }
@@ -214,7 +182,7 @@ tnchktc()
        p++;
        /* p now points to beginning of last field */
        if (p[0] != 't' || p[1] != 'c')
        p++;
        /* p now points to beginning of last field */
        if (p[0] != 't' || p[1] != 'c')
-               return(1);
+               return (1);
        strcpy(tcname, p+3);
        q = tcname;
        while (*q && *q != ':')
        strcpy(tcname, p+3);
        q = tcname;
        while (*q && *q != ':')
@@ -226,9 +194,9 @@ tnchktc()
        }
        if (getent(tcbuf, tcname, remotefile) != 1) {
                if (strcmp(remotefile, SYSREMOTE) == 0)
        }
        if (getent(tcbuf, tcname, remotefile) != 1) {
                if (strcmp(remotefile, SYSREMOTE) == 0)
-                       return(0);
+                       return (0);
                else if (getent(tcbuf, tcname, SYSREMOTE) != 1)
                else if (getent(tcbuf, tcname, SYSREMOTE) != 1)
-                       return(0);
+                       return (0);
        }
        for (q = tcbuf; *q++ != ':'; )
                ;
        }
        for (q = tcbuf; *q++ != ':'; )
                ;
@@ -239,7 +207,7 @@ tnchktc()
        }
        strcpy(p, q);
        tbuf = holdtbuf;
        }
        strcpy(p, q);
        tbuf = holdtbuf;
-       return(1);
+       return (1);
 }
 
 /*
 }
 
 /*
@@ -255,7 +223,7 @@ tnamatch(np)
 
        Bp = tbuf;
        if (*Bp == '#')
 
        Bp = tbuf;
        if (*Bp == '#')
-               return(0);
+               return (0);
        for (;;) {
                for (Np = np; *Np && *Bp == *Np; Bp++, Np++)
                        continue;
        for (;;) {
                for (Np = np; *Np && *Bp == *Np; Bp++, Np++)
                        continue;
@@ -307,7 +275,7 @@ tgetnum(id)
                if (*bp++ != id[0] || *bp == 0 || *bp++ != id[1])
                        continue;
                if (*bp == '@')
                if (*bp++ != id[0] || *bp == 0 || *bp++ != id[1])
                        continue;
                if (*bp == '@')
-                       return(-1);
+                       return (-1);
                if (*bp != '#')
                        continue;
                bp++;
                if (*bp != '#')
                        continue;
                bp++;
@@ -340,7 +308,7 @@ tgetflag(id)
                        if (!*bp || *bp == ':')
                                return (1);
                        else if (*bp == '@')
                        if (!*bp || *bp == ':')
                                return (1);
                        else if (*bp == '@')
-                               return(0);
+                               return (0);
                }
        }
 }
                }
        }
 }
@@ -366,7 +334,7 @@ tgetstr(id, area)
                if (*bp++ != id[0] || *bp == 0 || *bp++ != id[1])
                        continue;
                if (*bp == '@')
                if (*bp++ != id[0] || *bp == 0 || *bp++ != id[1])
                        continue;
                if (*bp == '@')
-                       return(0);
+                       return (0);
                if (*bp != '=')
                        continue;
                bp++;
                if (*bp != '=')
                        continue;
                bp++;
index 141fa08..24bef96 100644 (file)
@@ -1,7 +1,8 @@
-/*     remote.c        4.6     83/06/15        */
-# include "tip.h"
+#ifndef lint
+static char sccsid[] = "@(#)remote.c   4.7 (Berkeley) %G%";
+#endif
 
 
-static char *sccsid = "@(#)remote.c    4.6 %G%";
+# include "tip.h"
 
 /*
  * Attributes to be gleened from remote host description
 
 /*
  * Attributes to be gleened from remote host description
@@ -70,27 +71,48 @@ getremcap(host)
        /*
         * see if uppercase mode should be turned on initially
         */
        /*
         * see if uppercase mode should be turned on initially
         */
-       if (rgetflag("ra")) boolean(value(RAISE)) = 1;
-       if (rgetflag("ec")) boolean(value(ECHOCHECK)) = 1;
-       if (rgetflag("be")) boolean(value(BEAUTIFY)) = 1;
-       if (rgetflag("nb")) boolean(value(BEAUTIFY)) = 0;
-       if (rgetflag("sc")) boolean(value(SCRIPT)) = 1;
-       if (rgetflag("tb")) boolean(value(TABEXPAND)) = 1;
-       if (rgetflag("vb")) boolean(value(VERBOSE)) = 1;
-       if (rgetflag("nv")) boolean(value(VERBOSE)) = 0;
-       if (rgetflag("ta")) boolean(value(TAND)) = 1;
-       if (rgetflag("nt")) boolean(value(TAND)) = 0;
-       if (rgetflag("rw")) boolean(value(RAWFTP)) = 1;
-       if (rgetflag("hd")) boolean(value(HALFDUPLEX)) = 1;
-       if (*RE == NULL) RE = (char *)"tip.record";
-       if (*EX == NULL) EX = (char *)"\t\n\b\f";
-       if (ES != NOSTR) vstring("es",ES);
-       if (FO != NOSTR) vstring("fo",FO);
-       if (PR != NOSTR) vstring("pr",PR);
-       if (RC != NOSTR) vstring("rc",RC);
-       if ((DL = rgetnum("dl")) < 0) DL = 0;
-       if ((CL = rgetnum("cl")) < 0) CL = 0;
-       if ((ET = rgetnum("et")) < 0) ET = 10;
+       if (rgetflag("ra"))
+               boolean(value(RAISE)) = 1;
+       if (rgetflag("ec"))
+               boolean(value(ECHOCHECK)) = 1;
+       if (rgetflag("be"))
+               boolean(value(BEAUTIFY)) = 1;
+       if (rgetflag("nb"))
+               boolean(value(BEAUTIFY)) = 0;
+       if (rgetflag("sc"))
+               boolean(value(SCRIPT)) = 1;
+       if (rgetflag("tb"))
+               boolean(value(TABEXPAND)) = 1;
+       if (rgetflag("vb"))
+               boolean(value(VERBOSE)) = 1;
+       if (rgetflag("nv"))
+               boolean(value(VERBOSE)) = 0;
+       if (rgetflag("ta"))
+               boolean(value(TAND)) = 1;
+       if (rgetflag("nt"))
+               boolean(value(TAND)) = 0;
+       if (rgetflag("rw"))
+               boolean(value(RAWFTP)) = 1;
+       if (rgetflag("hd"))
+               boolean(value(HALFDUPLEX)) = 1;
+       if (*RE == NULL)
+               RE = (char *)"tip.record";
+       if (*EX == NULL)
+               EX = (char *)"\t\n\b\f";
+       if (ES != NOSTR)
+               vstring("es", ES);
+       if (FO != NOSTR)
+               vstring("fo", FO);
+       if (PR != NOSTR)
+               vstring("pr", PR);
+       if (RC != NOSTR)
+               vstring("rc", RC);
+       if ((DL = rgetnum("dl")) < 0)
+               DL = 0;
+       if ((CL = rgetnum("cl")) < 0)
+               CL = 0;
+       if ((ET = rgetnum("et")) < 0)
+               ET = 10;
 }
 
 char *
 }
 
 char *
index 4e168f2..898ec23 100644 (file)
@@ -1,4 +1,6 @@
-/*     tip.c   4.14    83/06/15        */
+#ifndef lint
+static char sccsid[] = "@(#)tip.c      4.15 (Berkeley) %G%";
+#endif
 
 /*
  * tip - UNIX link to other systems
 
 /*
  * tip - UNIX link to other systems
@@ -8,8 +10,6 @@
  */
 #include "tip.h"
 
  */
 #include "tip.h"
 
-static char *sccsid = "@(#)tip.c       4.14 %G%";
-
 /*
  * Baud rate mapping table
  */
 /*
  * Baud rate mapping table
  */
@@ -18,10 +18,7 @@ int bauds[] = {
        1200, 1800, 2400, 4800, 9600, 19200, -1
 };
 
        1200, 1800, 2400, 4800, 9600, 19200, -1
 };
 
-#ifdef VMUNIX
 int    disc = OTTYDISC;                /* tip normally runs this way */
 int    disc = OTTYDISC;                /* tip normally runs this way */
-#endif
-
 int    intprompt();
 int    timeout();
 int    cleanup();
 int    intprompt();
 int    timeout();
 int    cleanup();
@@ -142,9 +139,7 @@ cucommon:
        ioctl(0, TIOCGETP, (char *)&defarg);
        ioctl(0, TIOCGETC, (char *)&defchars);
        ioctl(0, TIOCGLTC, (char *)&deflchars);
        ioctl(0, TIOCGETP, (char *)&defarg);
        ioctl(0, TIOCGETC, (char *)&defchars);
        ioctl(0, TIOCGLTC, (char *)&deflchars);
-#ifdef VMUNIX
        ioctl(0, TIOCGETD, (char *)&odisc);
        ioctl(0, TIOCGETD, (char *)&odisc);
-#endif
        arg = defarg;
        arg.sg_flags = ANYP | CBREAK;
        tchars = defchars;
        arg = defarg;
        arg.sg_flags = ANYP | CBREAK;
        tchars = defchars;
@@ -174,11 +169,10 @@ cucommon:
 
 cleanup()
 {
 
 cleanup()
 {
+
        delock(uucplock);
        delock(uucplock);
-#ifdef VMUNIX
        if (odisc)
                ioctl(0, TIOCSETD, (char *)&odisc);
        if (odisc)
                ioctl(0, TIOCSETD, (char *)&odisc);
-#endif
        exit(0);
 }
 
        exit(0);
 }
 
@@ -187,12 +181,11 @@ cleanup()
  */
 raw()
 {
  */
 raw()
 {
+
        ioctl(0, TIOCSETP, &arg);
        ioctl(0, TIOCSETC, &tchars);
        ioctl(0, TIOCSLTC, &ltchars);
        ioctl(0, TIOCSETP, &arg);
        ioctl(0, TIOCSETC, &tchars);
        ioctl(0, TIOCSLTC, &ltchars);
-#ifdef VMUNIX
        ioctl(0, TIOCSETD, (char *)&disc);
        ioctl(0, TIOCSETD, (char *)&disc);
-#endif
 }
 
 
 }
 
 
@@ -201,14 +194,15 @@ raw()
  */
 unraw()
 {
  */
 unraw()
 {
-#ifdef VMUNIX
+
        ioctl(0, TIOCSETD, (char *)&odisc);
        ioctl(0, TIOCSETD, (char *)&odisc);
-#endif
        ioctl(0, TIOCSETP, (char *)&defarg);
        ioctl(0, TIOCSETC, (char *)&defchars);
        ioctl(0, TIOCSLTC, (char *)&deflchars);
 }
 
        ioctl(0, TIOCSETP, (char *)&defarg);
        ioctl(0, TIOCSETC, (char *)&defchars);
        ioctl(0, TIOCSLTC, (char *)&deflchars);
 }
 
+static jmp_buf promptbuf;
+
 /*
  * Print string ``s'', then read a string
  *  in from the terminal.  Handles signals & allows use of
 /*
  * Print string ``s'', then read a string
  *  in from the terminal.  Handles signals & allows use of
@@ -219,23 +213,22 @@ prompt(s, p)
        register char *p;
 {
        register char *b = p;
        register char *p;
 {
        register char *b = p;
+       int (*oint)(), (*oquit)();
 
        stoprompt = 0;
 
        stoprompt = 0;
-       signal(SIGINT, intprompt);
-       signal(SIGQUIT, SIG_IGN);
+       oint = signal(SIGINT, intprompt);
+       oint = signal(SIGQUIT, SIG_IGN);
        unraw();
        printf("%s", s);
        unraw();
        printf("%s", s);
-       while ((*p = getchar()) != EOF && *p != '\n') {
-               if (stoprompt)
-                       goto pbreak;
-               p++;
-       }
+       if (setjmp(promptbuf) == 0)
+               while ((*p = getchar()) != EOF && *p != '\n')
+                       p++;
        *p = '\0';
        *p = '\0';
-pbreak:
+
        raw();
        raw();
-       signal(SIGINT, SIG_DFL);
-       signal(SIGQUIT,SIG_DFL);
-       return(stoprompt || p == b);
+       signal(SIGINT, oint);
+       signal(SIGQUIT, oint);
+       return (stoprompt || p == b);
 }
 
 /*
 }
 
 /*
@@ -243,9 +236,11 @@ pbreak:
  */
 intprompt()
 {
  */
 intprompt()
 {
+
        signal(SIGINT, SIG_IGN);
        stoprompt = 1;
        printf("\r\n");
        signal(SIGINT, SIG_IGN);
        stoprompt = 1;
        printf("\r\n");
+       longjmp(promptbuf, 1);
 }
 
 /*
 }
 
 /*
@@ -310,41 +305,42 @@ escape()
                                continue;
                        printf("%s", ctrl(c));
                        (*p->e_func)(gch);
                                continue;
                        printf("%s", ctrl(c));
                        (*p->e_func)(gch);
-                       return(0);
+                       return (0);
                }
        /* ESCAPE ESCAPE forces ESCAPE */
        if (c != gch)
                pwrite(FD, &c, 1);
                }
        /* ESCAPE ESCAPE forces ESCAPE */
        if (c != gch)
                pwrite(FD, &c, 1);
-       return(gch);
+       return (gch);
 }
 
 speed(n)
 }
 
 speed(n)
+       int n;
 {
        register int *p;
 
        for (p = bauds; *p != -1;  p++)
                if (*p == n)
 {
        register int *p;
 
        for (p = bauds; *p != -1;  p++)
                if (*p == n)
-                       return(p-bauds);
-       return(NULL);
+                       return (p - bauds);
+       return (NULL);
 }
 
 any(c, p)
        register char c, *p;
 {
 }
 
 any(c, p)
        register char c, *p;
 {
-       if (p)
-       while (*p)
+       while (p && *p)
                if (*p++ == c)
                if (*p++ == c)
-                       return(1);
-       return(0);
+                       return (1);
+       return (0);
 }
 
 size(s)
        register char   *s;
 {
 }
 
 size(s)
        register char   *s;
 {
-       register int    i = 0;
+       register int i = 0;
 
 
-       while (*s++) i++;
-       return(i);
+       while (s && *s++)
+               i++;
+       return (i);
 }
 
 char *
 }
 
 char *
@@ -370,7 +366,7 @@ interp(s)
                ;
        }
        *p = '\0';
                ;
        }
        *p = '\0';
-       return(buf);
+       return (buf);
 }
 
 char *
 }
 
 char *
@@ -387,7 +383,7 @@ ctrl(c)
                s[0] = c;
                s[1] = '\0';
        }
                s[0] = c;
                s[1] = '\0';
        }
-       return(s);
+       return (s);
 }
 
 /*
 }
 
 /*
@@ -413,20 +409,16 @@ help(c)
  * Set up the "remote" tty's state
  */
 ttysetup(speed)
  * Set up the "remote" tty's state
  */
 ttysetup(speed)
+       int speed;
 {
 {
-#ifdef VMUNIX
        unsigned bits = LDECCTQ;
        unsigned bits = LDECCTQ;
-#endif
 
        arg.sg_ispeed = arg.sg_ospeed = speed;
 
        arg.sg_ispeed = arg.sg_ospeed = speed;
+       arg.sg_flags = RAW;
        if (boolean(value(TAND)))
        if (boolean(value(TAND)))
-               arg.sg_flags = TANDEM|RAW;
-       else
-               arg.sg_flags = RAW;
+               arg.sg_flags |= TANDEM;
        ioctl(FD, TIOCSETP, (char *)&arg);
        ioctl(FD, TIOCSETP, (char *)&arg);
-#ifdef VMUNIX
        ioctl(FD, TIOCLBIS, (char *)&bits);
        ioctl(FD, TIOCLBIS, (char *)&bits);
-#endif
 }
 
 /*
 }
 
 /*
@@ -445,12 +437,11 @@ sname(s)
        return (p);
 }
 
        return (p);
 }
 
-extern char chartab[];
 static char partab[0200];
 
 /*
 static char partab[0200];
 
 /*
- * do a write to the remote machine with the correct parity
- * we are doing 8 bit wide output, so we just generate a character
+ * Do a write to the remote machine with the correct parity.
+ * We are doing 8 bit wide output, so we just generate a character
  * with the right parity and output it.
  */
 pwrite(fd, buf, n)
  * with the right parity and output it.
  */
 pwrite(fd, buf, n)
@@ -459,48 +450,47 @@ pwrite(fd, buf, n)
        register int n;
 {
        register int i;
        register int n;
 {
        register int i;
-       register char *bp = buf;
+       register char *bp;
 
 
-       for (i = 0, bp = buf; i < n; i++, bp++) {
+       bp = buf;
+       for (i = 0; i < n; i++) {
                *bp = partab[(*bp) & 0177];
                *bp = partab[(*bp) & 0177];
+               bp++;
        }
        write(fd, buf, n);
 }
 
 /*
        }
        write(fd, buf, n);
 }
 
 /*
- * build a parity table with the right high-order bit
- * copy an even-parity table and doctor it
+ * Build a parity table with appropriate high-order bit.
  */
 setparity()
 {
  */
 setparity()
 {
-       int i;
+       register int i;
        char *parity;
        char *parity;
+       extern char evenpartab[];
 
        if (value(PARITY) == NOSTR)
                value(PARITY) = "even";
 
        if (value(PARITY) == NOSTR)
                value(PARITY) = "even";
-
        parity = value(PARITY);
        parity = value(PARITY);
-
        for (i = 0; i < 0200; i++)
        for (i = 0; i < 0200; i++)
-               partab[i] = chartab[i];
-
+               partab[i] = evenpartab[i];
+       if (equal(parity, "even"))
+               return;
        if (equal(parity, "odd")) {
                for (i = 0; i < 0200; i++)
                        partab[i] ^= 0200;      /* reverse bit 7 */
        if (equal(parity, "odd")) {
                for (i = 0; i < 0200; i++)
                        partab[i] ^= 0200;      /* reverse bit 7 */
+               return;
        }
        }
-       else if (equal(parity, "none") || equal(parity, "zero")) {
+       if (equal(parity, "none") || equal(parity, "zero")) {
                for (i = 0; i < 0200; i++)
                        partab[i] &= ~0200;     /* turn off bit 7 */
                for (i = 0; i < 0200; i++)
                        partab[i] &= ~0200;     /* turn off bit 7 */
+               return;
        }
        }
-       else if (equal(parity, "one")) {
+       if (equal(parity, "one")) {
                for (i = 0; i < 0200; i++)
                        partab[i] |= 0200;      /* turn on bit 7 */
                for (i = 0; i < 0200; i++)
                        partab[i] |= 0200;      /* turn on bit 7 */
+               return;
        }
        }
-       else if (equal(parity, "even")) {
-               /* table is already even parity */
-       }
-       else {
-               fprintf(stderr, "parity value %s unknown\n", PA);
-               fflush(stderr);
-       }
+       fprintf(stderr, "%s: unknown parity value\n", PA);
+       fflush(stderr);
 }
 }
index 22c1feb..dd1490f 100644 (file)
@@ -1,16 +1,19 @@
-/*     tip.h   4.10    83/06/15        */
+/*     tip.h   4.11    83/06/25        */
+
 /*
  * tip - terminal interface program
 /*
  * tip - terminal interface program
- *
- * Samuel J. Leffler
  */
 
  */
 
+#include <sys/types.h>
+#include <sys/file.h>
+
 #include <sgtty.h>
 #include <signal.h>
 #include <stdio.h>
 #include <pwd.h>
 #include <sgtty.h>
 #include <signal.h>
 #include <stdio.h>
 #include <pwd.h>
-#include <sys/types.h>
 #include <ctype.h>
 #include <ctype.h>
+#include <setjmp.h>
+#include <errno.h>
 
 /*
  * Remote host attributes
 
 /*
  * Remote host attributes
@@ -159,53 +162,28 @@ extern value_t    vtable[];       /* variable table */
 #define FORCE          8
 #define FRAMESIZE      9
 #define HOST           10
 #define FORCE          8
 #define FRAMESIZE      9
 #define HOST           10
-#if ACULOG
-#define LOCK           11
-#define LOG            12
-#define PHONES         13
-#define PROMPT         14
-#define RAISE          15
-#define RAISECHAR      16
-#define RECORD         17
-#define REMOTE         18
-#define SCRIPT         19
-#define TABEXPAND      20
-#define VERBOSE                21
-#define SHELL          22
-#define HOME           23
-#define ECHOCHECK      24
-#define DISCONNECT     25
-#define TAND           26
-#define LDELAY         27
-#define CDELAY         28
-#define ETIMEOUT       29
-#define RAWFTP         30
-#define HALFDUPLEX     31
-#define        LECHO           32
-#define        PARITY          33
-#else
-#define PHONES         11
-#define PROMPT         12
-#define RAISE          13
-#define RAISECHAR      14
-#define RECORD         15
-#define REMOTE         16
-#define SCRIPT         17
-#define TABEXPAND      18
-#define VERBOSE                19
-#define SHELL          20
-#define HOME           21
-#define ECHOCHECK      22
-#define DISCONNECT     23
-#define TAND           24
-#define LDELAY         25
-#define CDELAY         26
-#define ETIMEOUT       27
-#define RAWFTP         28
-#define HALFDUPLEX     29
-#define        LECHO           30
-#define        PARITY          31
-#endif
+#define LOG            11
+#define PHONES         12
+#define PROMPT         13
+#define RAISE          14
+#define RAISECHAR      15
+#define RECORD         16
+#define REMOTE         17
+#define SCRIPT         18
+#define TABEXPAND      19
+#define VERBOSE                20
+#define SHELL          21
+#define HOME           22
+#define ECHOCHECK      23
+#define DISCONNECT     24
+#define TAND           25
+#define LDELAY         26
+#define CDELAY         27
+#define ETIMEOUT       28
+#define RAWFTP         29
+#define HALFDUPLEX     30
+#define        LECHO           31
+#define        PARITY          32
 
 #define NOVAL  ((value_t *)NULL)
 #define NOACU  ((acu_t *)NULL)
 
 #define NOVAL  ((value_t *)NULL)
 #define NOACU  ((acu_t *)NULL)
@@ -242,40 +220,17 @@ char      ccc;                    /* synchronization character */
 char   ch;                     /* for tipout */
 char   *uucplock;              /* name of lock file for uucp's */
 
 char   ch;                     /* for tipout */
 char   *uucplock;              /* name of lock file for uucp's */
 
-/*
- * From <sys/tty.h> (PDP-11 V7) ... it's put in here to avoid lots
- *  of naming conflicts with stuff we have to pull in to use tty.h
- */
-#ifndef TIOCFLUSH
-#      define TIOCFLUSH        (('t'<<8)|16)
-#endif
-
-/*
- * On PDP-11 V7 systems with Rand's capacity call use this
- *  stuff, otherwise <assuming it's a VM system> use FIONREAD
- */
-#ifndef FIONREAD
-#define        FIOCAPACITY     (('f'<<8)|3)
-
-struct capacity {
-       off_t   cp_nbytes;
-       char    cp_eof;
-};
-#endif
-
-#ifdef VMUNIX
 int    odisc;                          /* initial tty line discipline */
 int    odisc;                          /* initial tty line discipline */
-extern int disc;                       /* current tty discpline */
-#endif
-
-extern char            *ctrl();
-extern char            *ctime();
-extern long            time();
-extern struct passwd   *getpwuid();
-extern char            *getlogin();
-extern char            *vinterp();
-extern char            *getenv();
-extern char            *rindex();
-extern char            *index();
-extern char            *malloc();
-extern char            *connect();
+extern int disc;                       /* current tty discpline */
+
+extern char *ctrl();
+extern char *ctime();
+extern long time();
+extern struct passwd *getpwuid();
+extern char *getlogin();
+extern char *vinterp();
+extern char *getenv();
+extern char *rindex();
+extern char *index();
+extern char *malloc();
+extern char *connect();
index 074c4d3..de7aa7c 100644 (file)
@@ -1,4 +1,7 @@
-/*     tipout.c        4.7     83/06/15        */
+#ifndef lint
+static char sccsid[] = "@(#)tipout.c   4.8 (Berkeley) %G%";
+#endif
+
 #include "tip.h"
 /*
  * tip
 #include "tip.h"
 /*
  * tip
@@ -7,7 +10,7 @@
  *  reading from the remote host
  */
 
  *  reading from the remote host
  */
 
-static char *sccsid = "@(#)tipout.c    4.7 %G%";
+static jmp_buf sigbuf;
 
 /*
  * TIPOUT wait state routine --
 
 /*
  * TIPOUT wait state routine --
@@ -15,11 +18,10 @@ static char *sccsid = "@(#)tipout.c 4.7 %G%";
  */
 intIOT()
 {
  */
 intIOT()
 {
-       signal(SIGIOT, SIG_IGN);
+
        write(repdes[1],&ccc,1);
        read(fildes[0], &ccc,1);
        write(repdes[1],&ccc,1);
        read(fildes[0], &ccc,1);
-       signal(SIGIOT, intIOT);
-       intflag = 1;
+       longjmp(sigbuf, 1);
 }
 
 /*
 }
 
 /*
@@ -32,7 +34,6 @@ intEMT()
        register char *pline = line;
        char reply;
 
        register char *pline = line;
        char reply;
 
-       signal(SIGEMT, SIG_IGN);
        read(fildes[0], &c, 1);
        while (c != '\n') {
                *pline++ = c;
        read(fildes[0], &c, 1);
        while (c != '\n') {
                *pline++ = c;
@@ -53,13 +54,12 @@ intEMT()
                }
        }
        write(repdes[1], &reply, 1);
                }
        }
        write(repdes[1], &reply, 1);
-       signal(SIGEMT, intEMT);
-       intflag = 1;
+       longjmp(sigbuf, 1);
 }
 
 intTERM()
 {
 }
 
 intTERM()
 {
-       signal(SIGTERM, SIG_IGN);
+
        if (boolean(value(SCRIPT)) && fscript != NULL)
                fclose(fscript);
        exit(0);
        if (boolean(value(SCRIPT)) && fscript != NULL)
                fclose(fscript);
        exit(0);
@@ -67,9 +67,9 @@ intTERM()
 
 intSYS()
 {
 
 intSYS()
 {
-       signal(SIGSYS, intSYS);
+
        boolean(value(BEAUTIFY)) = !boolean(value(BEAUTIFY));
        boolean(value(BEAUTIFY)) = !boolean(value(BEAUTIFY));
-       intflag = 1;
+       longjmp(sigbuf, 1);
 }
 
 /*
 }
 
 /*
@@ -80,6 +80,7 @@ tipout()
        char buf[BUFSIZ];
        register char *cp;
        register int cnt;
        char buf[BUFSIZ];
        register char *cp;
        register int cnt;
+       int omask;
 
        signal(SIGINT, SIG_IGN);
        signal(SIGQUIT, SIG_IGN);
 
        signal(SIGINT, SIG_IGN);
        signal(SIGQUIT, SIG_IGN);
@@ -88,14 +89,14 @@ tipout()
        signal(SIGIOT, intIOT);         /* scripting going on signal */
        signal(SIGHUP, intTERM);        /* for dial-ups */
        signal(SIGSYS, intSYS);         /* beautify toggle */
        signal(SIGIOT, intIOT);         /* scripting going on signal */
        signal(SIGHUP, intTERM);        /* for dial-ups */
        signal(SIGSYS, intSYS);         /* beautify toggle */
-
-       for (;;) {
-               do {
-                       intflag = 0;
-                       cnt = read(FD, buf, BUFSIZ);
-               } while (intflag);
+       (void) setjmp(sigbuf);
+       for (omask = 0;; sigsetmask(omask)) {
+               cnt = read(FD, buf, BUFSIZ);
                if (cnt <= 0)
                        continue;
                if (cnt <= 0)
                        continue;
+#define        mask(s) (1 << ((s) - 1))
+#define        ALLSIGS mask(SIGEMT)|mask(SIGTERM)|mask(SIGIOT)|mask(SIGSYS)
+               omask = sigblock(ALLSIGS);
                for (cp = buf; cp < buf + cnt; cp++)
                        *cp &= 0177;
                write(1, buf, cnt);
                for (cp = buf; cp < buf + cnt; cp++)
                        *cp &= 0177;
                write(1, buf, cnt);
@@ -104,11 +105,10 @@ tipout()
                                fwrite(buf, 1, cnt, fscript);
                                continue;
                        }
                                fwrite(buf, 1, cnt, fscript);
                                continue;
                        }
-                       for (cp = buf; cp < buf + cnt; cp++) {
-                               if ((*cp < ' ' || *cp > '~') && !any(*cp, value(EXCEPTIONS)))
-                                       continue;
-                               putc(*cp, fscript);
-                       }
+                       for (cp = buf; cp < buf + cnt; cp++)
+                               if ((*cp >= ' ' && *cp <= '~') ||
+                                   any(*cp, value(EXCEPTIONS)))
+                                       putc(*cp, fscript);
                }
        }
 }
                }
        }
 }
index d584f7f..ddf5230 100644 (file)
@@ -1,4 +1,6 @@
-/*     uucplock.c      4.5     83/06/15        */
+#ifndef lint
+static char sccsid[] = "@(#)uucplock.c 4.6 (Berkeley) %G%";
+#endif
 /*
  * defs that come from uucp.h
  */
 /*
  * defs that come from uucp.h
  */
@@ -26,8 +28,6 @@
 #include <sys/stat.h>
 #include <stdio.h>
 
 #include <sys/stat.h>
 #include <stdio.h>
 
-static char *sccsid = "@(#)uucplock.c  4.5 %G%";
-
 /*******
  *     ulockf(file, atime)
  *     char *file;
 /*******
  *     ulockf(file, atime)
  *     char *file;
index 8fea2f7..fd30778 100644 (file)
@@ -1,9 +1,11 @@
-/*     value.c 4.4     83/06/15        */
+#ifndef lint
+static char sccsid[] = "@(#)value.c    4.5 (Berkeley) %G%";
+#endif
+
 #include "tip.h"
 
 #define MIDDLE 35
 
 #include "tip.h"
 
 #define MIDDLE 35
 
-static char *sccsid = "@(#)value.c     4.4 %G%";
 static value_t *vlookup();
 static int col = 0;
 
 static value_t *vlookup();
 static int col = 0;
 
@@ -299,15 +301,15 @@ vstring(s,v)
        register value_t *p;
        char *expand();
 
        register value_t *p;
        char *expand();
 
-       if (p = vlookup(s)) {
-               if (p->v_type&NUMBER)
-                       vassign(p, atoi(v));
-               else {
-                       if (strcmp(s, "record") == 0)
-                               v = expand(v);
-                       vassign(p, v);
-               }
-               return(0);
-       } else
-               return(1);
+       p = vlookup(s); 
+       if (p == 0)
+               return (1);
+       if (p->v_type&NUMBER)
+               vassign(p, atoi(v));
+       else {
+               if (strcmp(s, "record") == 0)
+                       v = expand(v);
+               vassign(p, v);
+       }
+       return (0);
 }
 }
index 8416d2d..1a68e0b 100644 (file)
@@ -1,4 +1,7 @@
-/*     vars.c  4.5     83/06/15        */
+#ifndef lint
+static char sccsid[] = "@(#)vars.c     4.6 (Berkeley) %G%";
+#endif
+
 #include "tip.h"
 
 /*
 #include "tip.h"
 
 /*
@@ -27,12 +30,8 @@ value_t vtable[] = {
          "fr",         (char *)&FS },
        { "host",       STRING|IREMOTE|INIT,    READ<<PUBLIC,
          "ho",         (char *)&HO },
          "fr",         (char *)&FS },
        { "host",       STRING|IREMOTE|INIT,    READ<<PUBLIC,
          "ho",         (char *)&HO },
-#ifdef ACULOG
-       { "lock",       STRING|INIT,            (READ|WRITE)<<ROOT,
-         NOSTR,        "/tmp/aculock" },
        { "log",        STRING|INIT,            (READ|WRITE)<<ROOT,
          NOSTR,        "/usr/adm/aculog" },
        { "log",        STRING|INIT,            (READ|WRITE)<<ROOT,
          NOSTR,        "/usr/adm/aculog" },
-#endif
        { "phones",     STRING|INIT|IREMOTE,    READ<<PUBLIC,
          NOSTR,        (char *)&PH },
        { "prompt",     CHAR,                   (READ|WRITE)<<PUBLIC,
        { "phones",     STRING|INIT|IREMOTE,    READ<<PUBLIC,
          NOSTR,        (char *)&PH },
        { "prompt",     CHAR,                   (READ|WRITE)<<PUBLIC,
@@ -73,7 +72,7 @@ value_t vtable[] = {
          "hdx",        (char *)FALSE },
        { "localecho",  BOOL,                   (READ|WRITE)<<PUBLIC,
          "le",         (char *)FALSE },
          "hdx",        (char *)FALSE },
        { "localecho",  BOOL,                   (READ|WRITE)<<PUBLIC,
          "le",         (char *)FALSE },
-       { "parity",     STRING|INIT|IREMOTE,            (READ|WRITE)<<PUBLIC,
+       { "parity",     STRING|INIT|IREMOTE,    (READ|WRITE)<<PUBLIC,
          "par",        (char *)&PA },
        { NOSTR, NULL, NULL, NOSTR, NOSTR }
 };
          "par",        (char *)&PA },
        { NOSTR, NULL, NULL, NOSTR, NOSTR }
 };