date and time created 83/02/11 15:44:35 by rrh
[unix-history] / usr / src / usr.bin / tip / cmds.c
index ab0a3a6..8253950 100644 (file)
@@ -1,4 +1,4 @@
-/*     cmds.c  4.5     81/07/11        */
+/*     cmds.c  4.10    82/09/02        */
 #include "tip.h"
 /*
  * tip
 #include "tip.h"
 /*
  * tip
@@ -233,7 +233,7 @@ transmit(fd, eofchars, command)
        FILE *fd;
        char *eofchars, *command;
 {
        FILE *fd;
        char *eofchars, *command;
 {
-       char *pc, lastc;
+       char *pc, lastc, rc;
        int c, ccount, lcount;
        time_t start_t, stop_t;
 
        int c, ccount, lcount;
        time_t start_t, stop_t;
 
@@ -258,7 +258,7 @@ transmit(fd, eofchars, command)
        lcount = 0;
        lastc = '\0';
        start_t = time(0);
        lcount = 0;
        lastc = '\0';
        start_t = time(0);
-       while(1) {
+       while (1) {
                ccount = 0;
                do {
                        c = getc(fd);
                ccount = 0;
                do {
                        c = getc(fd);
@@ -275,11 +275,11 @@ transmit(fd, eofchars, command)
                                else if (c == '\t') {
                                        if (boolean(value(TABEXPAND))) {
                                                send(' ');
                                else if (c == '\t') {
                                        if (boolean(value(TABEXPAND))) {
                                                send(' ');
-                                               while((++ccount % 8) != 0)
+                                               while ((++ccount % 8) != 0)
                                                        send(' ');
                                                continue;
                                        }
                                                        send(' ');
                                                continue;
                                        }
-                               } else
+                               } else if (!any(c, value(EXCEPTIONS)))
                                        continue;
                        }
                        send(c);
                                        continue;
                        }
                        send(c);
@@ -290,14 +290,14 @@ transmit(fd, eofchars, command)
                        alarm(10);
                        timedout = 0;
                        do {    /* wait for prompt */
                        alarm(10);
                        timedout = 0;
                        do {    /* wait for prompt */
-                               read(FD, (char *)&c, 1);
+                               read(FD, (char *)&rc, 1);
                                if (timedout || stop) {
                                        if (timedout)
                                                printf("\r\ntimed out at eol\r\n");
                                        alarm(0);
                                        goto out;
                                }
                                if (timedout || stop) {
                                        if (timedout)
                                                printf("\r\ntimed out at eol\r\n");
                                        alarm(0);
                                        goto out;
                                }
-                       } while ((c&0177) != character(value(PROMPT)));
+                       } while ((rc&0177) != character(value(PROMPT)));
                        alarm(0);
                }
        }
                        alarm(0);
                }
        }
@@ -351,7 +351,7 @@ cu_put(cc)
 send(c)
        char c;
 {
 send(c)
        char c;
 {
-       int cc;
+       char cc;
        int retry = 0;
 
        cc = c;
        int retry = 0;
 
        cc = c;
@@ -587,7 +587,7 @@ variable()
        vlex(buf);
        if (vtable[BEAUTIFY].v_access&CHANGED) {
                vtable[BEAUTIFY].v_access &= ~CHANGED;
        vlex(buf);
        if (vtable[BEAUTIFY].v_access&CHANGED) {
                vtable[BEAUTIFY].v_access &= ~CHANGED;
-               signal(pid, SIGSYS);
+               kill(pid, SIGSYS);
        }
        if (vtable[SCRIPT].v_access&CHANGED) {
                vtable[SCRIPT].v_access &= ~CHANGED;
        }
        if (vtable[SCRIPT].v_access&CHANGED) {
                vtable[SCRIPT].v_access &= ~CHANGED;
@@ -612,7 +612,7 @@ variable()
  */
 genbrk()
 {
  */
 genbrk()
 {
-#ifdef VMUNIX
+#ifdef TIOCSBRK
        ioctl(FD, TIOCSBRK, NULL);
        sleep(1);
        ioctl(FD, TIOCCBRK, NULL);
        ioctl(FD, TIOCSBRK, NULL);
        sleep(1);
        ioctl(FD, TIOCCBRK, NULL);
@@ -630,3 +630,15 @@ genbrk()
        write(FD, "@", 1);
 #endif
 }
        write(FD, "@", 1);
 #endif
 }
+
+#ifdef SIGTSTP
+/*
+ * Suspend tip
+ */
+suspend()
+{
+       unraw();
+       kill(0, SIGTSTP);
+       raw();
+}
+#endif