BSD 4_3_Reno release
[unix-history] / usr / src / usr.bin / ex / ex_vput.c
index 4c8d0b0..b51e027 100644 (file)
@@ -1,5 +1,13 @@
-/* Copyright (c) 1980 Regents of the University of California */
-static char *sccsid = "@(#)ex_vput.c   5.1 %G%";
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * All rights reserved.  The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
+#ifndef lint
+static char *sccsid = "@(#)ex_vput.c   7.5 (Berkeley) 3/9/87";
+#endif not lint
+
 #include "ex.h"
 #include "ex_tty.h"
 #include "ex_vis.h"
 #include "ex.h"
 #include "ex_tty.h"
 #include "ex_vis.h"
@@ -23,7 +31,7 @@ vclear()
        destline = 0;
        outline = 0;
        if (inopen)
        destline = 0;
        outline = 0;
        if (inopen)
-               vclrbyte(vtube0, WCOLS * (WECHO - ZERO + 1));
+               vclrbyte(vtube0, WCOLS * (WECHO - ex_ZERO + 1));
 }
 
 /*
 }
 
 /*
@@ -50,7 +58,7 @@ vclrlin(l, tp)
 
        vigoto(l, 0);
        if ((hold & HOLDAT) == 0)
 
        vigoto(l, 0);
        if ((hold & HOLDAT) == 0)
-               putchar(tp > dol ? ((UPPERCASE || HZ) ? '^' : '~') : '@');
+               ex_putchar(tp > dol ? ((UPPERCASE || HZ) ? '^' : '~') : '@');
        if (state == HARDOPEN)
                sethard();
        vclreol();
        if (state == HARDOPEN)
                sethard();
        vclreol();
@@ -103,7 +111,7 @@ vclrech(didphys)
        bool didphys;
 {
 
        bool didphys;
 {
 
-       if (Peekkey == ATTN)
+       if (Peek_key == ATTN)
                return;
        if (hold & HOLDECH) {
                heldech = !didphys;
                return;
        if (hold & HOLDECH) {
                heldech = !didphys;
@@ -464,7 +472,7 @@ vmaktop(p, cp)
 
        if (p < 0 || vtube[p] == cp)
                return;
 
        if (p < 0 || vtube[p] == cp)
                return;
-       for (i = ZERO; i <= WECHO; i++)
+       for (i = ex_ZERO; i <= WECHO; i++)
                if (vtube[i] == cp) {
                        copy(temp, vtube[i], WCOLS);
                        copy(vtube[i], vtube[p], WCOLS);
                if (vtube[i] == cp) {
                        copy(temp, vtube[i], WCOLS);
                        copy(vtube[i], vtube[p], WCOLS);
@@ -484,7 +492,7 @@ vmaktop(p, cp)
  * to make life simpler.
  */
 vinschar(c)
  * to make life simpler.
  */
 vinschar(c)
-       char c;
+       int c;          /* mjm: char --> int */
 {
        register int i;
        register char *tp;
 {
        register int i;
        register char *tp;
@@ -715,9 +723,10 @@ vnpins(dosync)
                e = vglitchup(vcline, d);
                vigoto(e, 0); vclreol();
                if (dosync) {
                e = vglitchup(vcline, d);
                vigoto(e, 0); vclreol();
                if (dosync) {
+                       int (*Ooutchar)() = Outchar;
                        Outchar = vputchar;
                        vsync(e + 1);
                        Outchar = vputchar;
                        vsync(e + 1);
-                       Outchar = vinschar;
+                       Outchar = Ooutchar;
                }
        } else {
                vup1();
                }
        } else {
                vup1();
@@ -828,7 +837,7 @@ vishft()
  * Now do the insert of the characters (finally).
  */
 viin(c)
  * Now do the insert of the characters (finally).
  */
 viin(c)
-       char c;
+       int c;          /* mjm: char --> int */
 {
        register char *tp, *up;
        register int i, j;
 {
        register char *tp, *up;
        register int i, j;
@@ -1196,9 +1205,13 @@ def:
                 * CONCEPT braindamage in early models:  after a wraparound
                 * the next newline is eaten.  It's hungry so we just
                 * feed it now rather than worrying about it.
                 * CONCEPT braindamage in early models:  after a wraparound
                 * the next newline is eaten.  It's hungry so we just
                 * feed it now rather than worrying about it.
+                * Fixed to use return linefeed to work right
+                * on vt100/tab132 as well as concept.
                 */
                 */
-               if (XN && outcol % WCOLS == 0)
+               if (XN && outcol % WCOLS == 0) {
+                       vputc('\r');
                        vputc('\n');
                        vputc('\n');
+               }
        }
 }
 
        }
 }
 
@@ -1324,13 +1337,15 @@ tvliny()
 }
 
 tracec(c)
 }
 
 tracec(c)
-       char c;
+       int c;          /* mjm: char --> int */
 {
 
        if (!techoin)
                trubble = 1;
        if (c == ESCAPE)
                fprintf(trace, "$");
 {
 
        if (!techoin)
                trubble = 1;
        if (c == ESCAPE)
                fprintf(trace, "$");
+       else if (c & QUOTE)     /* mjm: for 3B (no sign extension) */
+               fprintf(trace, "~%c", ctlof(c&TRIM));
        else if (c < ' ' || c == DELETE)
                fprintf(trace, "^%c", ctlof(c));
        else
        else if (c < ' ' || c == DELETE)
                fprintf(trace, "^%c", ctlof(c));
        else