BSD 4_3_Reno release
[unix-history] / usr / src / usr.bin / ex / ex_vops2.c
index 8cd3a0b..55eb719 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)ex_vops2.c 5.1.1.1 (Berkeley) %G%";
+static char *sccsid = "@(#)ex_vops2.c  6.10 (Berkeley) 1/2/88";
 #endif not lint
 
 #include "ex.h"
 #endif not lint
 
 #include "ex.h"
@@ -31,7 +31,7 @@ bleep(i, cp)
 
        i -= column(cp);
        do
 
        i -= column(cp);
        do
-               putchar('\\' | QUOTE);
+               ex_putchar('\\' | QUOTE);
        while (--i >= 0);
        rubble = 1;
 }
        while (--i >= 0);
        rubble = 1;
 }
@@ -75,7 +75,7 @@ takeout(BUF)
                wcursor = cursor;
                cursor = cp;
        }
                wcursor = cursor;
                cursor = cp;
        }
-       setBUF(BUF);
+       ex_setBUF(BUF);
        if ((BUF[0] & (QUOTE|TRIM)) == OVERBUF)
                beep();
 }
        if ((BUF[0] & (QUOTE|TRIM)) == OVERBUF)
                beep();
 }
@@ -120,7 +120,9 @@ vappend(ch, cnt, indent)
        bool escape;
        int repcnt, savedoomed;
        short oldhold = hold;
        bool escape;
        int repcnt, savedoomed;
        short oldhold = hold;
+#ifdef SIGWINCH
        int oldmask;
        int oldmask;
+#endif
 
        /*
         * Before a move in hardopen when the line is dirty
 
        /*
         * Before a move in hardopen when the line is dirty
@@ -210,7 +212,9 @@ vappend(ch, cnt, indent)
         */
        gobblebl = 0;
 
         */
        gobblebl = 0;
 
+#ifdef SIGWINCH
        oldmask = sigblock(sigmask(SIGWINCH));
        oldmask = sigblock(sigmask(SIGWINCH));
+#endif
        /*
         * Text gathering loop.
         * New text goes into genbuf starting at gcursor.
        /*
         * Text gathering loop.
         * New text goes into genbuf starting at gcursor.
@@ -270,7 +274,7 @@ vappend(ch, cnt, indent)
 
                                Outchar = vinschar;
                                hold |= HOLDQIK;
 
                                Outchar = vinschar;
                                hold |= HOLDQIK;
-                               printf("%s", genbuf);
+                               ex_printf("%s", genbuf);
                                hold = oldhold;
                                Outchar = vputchar;
                        }
                                hold = oldhold;
                                Outchar = vputchar;
                        }
@@ -388,7 +392,9 @@ vappend(ch, cnt, indent)
        doomed = 0;
        wcursor = cursor;
        vmove();
        doomed = 0;
        wcursor = cursor;
        vmove();
+#ifdef SIGWINCH
        (void)sigsetmask(oldmask);
        (void)sigsetmask(oldmask);
+#endif
 }
 
 /*
 }
 
 /*
@@ -470,7 +476,7 @@ vgetline(cnt, gcursor, aescaped, commch)
                        c &= (QUOTE|TRIM);
                ch = c;
                maphopcnt = 0;
                        c &= (QUOTE|TRIM);
                ch = c;
                maphopcnt = 0;
-               if (vglobp == 0 && Peekkey == 0 && commch != 'r')
+               if (vglobp == 0 && Peek_key == 0 && commch != 'r')
                        while ((ch = map(c, immacs)) != c) {
                                c = ch;
                                if (!value(REMAP))
                        while ((ch = map(c, immacs)) != c) {
                                c = ch;
                                if (!value(REMAP))
@@ -488,12 +494,12 @@ vgetline(cnt, gcursor, aescaped, commch)
                         */
 #ifndef USG3TTY
                        if (c == tty.sg_erase)
                         */
 #ifndef USG3TTY
                        if (c == tty.sg_erase)
-                               c = CTRL(h);
+                               c = CTRL('h');
                        else if (c == tty.sg_kill)
                                c = -1;
 #else
                        if (c == tty.c_cc[VERASE])
                        else if (c == tty.sg_kill)
                                c = -1;
 #else
                        if (c == tty.c_cc[VERASE])
-                               c = CTRL(h);
+                               c = CTRL('h');
                        else if (c == tty.c_cc[VKILL])
                                c = -1;
 #endif
                        else if (c == tty.c_cc[VKILL])
                                c = -1;
 #endif
@@ -521,7 +527,7 @@ vgetline(cnt, gcursor, aescaped, commch)
                         *              This is hard because stuff has
                         *              already been saved for repeat.
                         */
                         *              This is hard because stuff has
                         *              already been saved for repeat.
                         */
-                       case CTRL(h):
+                       case CTRL('h'):
 bakchar:
                                cp = gcursor - 1;
                                if (cp < ogcursor) {
 bakchar:
                                cp = gcursor - 1;
                                if (cp < ogcursor) {
@@ -542,7 +548,7 @@ bakchar:
                        /*
                         * ^W           Back up a white/non-white word.
                         */
                        /*
                         * ^W           Back up a white/non-white word.
                         */
-                       case CTRL(w):
+                       case CTRL('w'):
                                wdkind = 1;
                                for (cp = gcursor; cp > ogcursor && isspace(cp[-1]); cp--)
                                        continue;
                                wdkind = 1;
                                for (cp = gcursor; cp > ogcursor && isspace(cp[-1]); cp--)
                                        continue;
@@ -577,7 +583,7 @@ vbackup:
                         */
                        case '\\':
                                x = destcol, y = destline;
                         */
                        case '\\':
                                x = destcol, y = destline;
-                               putchar('\\');
+                               ex_putchar('\\');
                                vcsync();
                                c = getkey();
 #ifndef USG3TTY
                                vcsync();
                                c = getkey();
 #ifndef USG3TTY
@@ -604,10 +610,10 @@ vbackup:
                         *
                         * ^V           Synonym for ^Q
                         */
                         *
                         * ^V           Synonym for ^Q
                         */
-                       case CTRL(q):
-                       case CTRL(v):
+                       case CTRL('q'):
+                       case CTRL('v'):
                                x = destcol, y = destline;
                                x = destcol, y = destline;
-                               putchar('^');
+                               ex_putchar('^');
                                vgoto(y, x);
                                c = getkey();
 #ifdef TIOCSETC
                                vgoto(y, x);
                                c = getkey();
 #ifdef TIOCSETC
@@ -692,22 +698,22 @@ vbackup:
                 */
                cstr[0] = c;
                if (anyabbrs && gcursor > ogcursor && !wordch(cstr) && wordch(gcursor-1)) {
                 */
                cstr[0] = c;
                if (anyabbrs && gcursor > ogcursor && !wordch(cstr) && wordch(gcursor-1)) {
-                               int wdtype, abno;
-
-                               cstr[1] = 0;
-                               wdkind = 1;
-                               cp = gcursor - 1;
-                               for (wdtype = wordch(cp - 1);
-                                   cp > ogcursor && wordof(wdtype, cp - 1); cp--)
-                                       ;
-                               *gcursor = 0;
-                               for (abno=0; abbrevs[abno].mapto; abno++) {
-                                       if (eq(cp, abbrevs[abno].cap)) {
-                                               macpush(cstr, 0);
-                                               macpush(abbrevs[abno].mapto);
-                                               goto vbackup;
-                                       }
+                       int wdtype, abno;
+
+                       cstr[1] = 0;
+                       wdkind = 1;
+                       cp = gcursor - 1;
+                       for (wdtype = wordch(cp - 1);
+                           cp > ogcursor && wordof(wdtype, cp - 1); cp--)
+                               ;
+                       *gcursor = 0;
+                       for (abno=0; abbrevs[abno].mapto; abno++) {
+                               if (eq(cp, abbrevs[abno].cap)) {
+                                       macpush(cstr, 0);
+                                       macpush(abbrevs[abno].mapto, 1);
+                                       goto vbackup;
                                }
                                }
+                       }
                }
 
                switch (c) {
                }
 
                switch (c) {
@@ -743,8 +749,8 @@ vbackup:
                 *              Unless in repeat where this means these
                 *              were superquoted in.
                 */
                 *              Unless in repeat where this means these
                 *              were superquoted in.
                 */
-               case CTRL(d):
-               case CTRL(t):
+               case CTRL('d'):
+               case CTRL('t'):
                        if (vglobp)
                                goto def;
                        /* fall into ... */
                        if (vglobp)
                                goto def;
                        /* fall into ... */
@@ -752,11 +758,11 @@ vbackup:
                /*
                 * ^D|QUOTE     Is a backtab (in a repeated command).
                 */
                /*
                 * ^D|QUOTE     Is a backtab (in a repeated command).
                 */
-               case CTRL(d) | QUOTE:
+               case CTRL('d') | QUOTE:
                        *gcursor = 0;
                        cp = vpastwh(genbuf);
                        c = whitecnt(genbuf);
                        *gcursor = 0;
                        cp = vpastwh(genbuf);
                        c = whitecnt(genbuf);
-                       if (ch == CTRL(t)) {
+                       if (ch == CTRL('t')) {
                                /*
                                 * ^t just generates new indent replacing
                                 * current white space rounded up to soft
                                /*
                                 * ^t just generates new indent replacing
                                 * current white space rounded up to soft
@@ -818,8 +824,7 @@ vbackup:
                        }
 def:
                        if (!backsl) {
                        }
 def:
                        if (!backsl) {
-                               int cnt;
-                               putchar(c);
+                               ex_putchar(c);
                                flush();
                        }
                        if (gcursor > &genbuf[LBSIZE - 2])
                                flush();
                        }
                        if (gcursor > &genbuf[LBSIZE - 2])