BSD 4_3_Tahoe release
[unix-history] / usr / src / ucb / ex / ex_put.c
index 178e3d1..22d2d12 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char *sccsid = "@(#)ex_put.c    7.9 (Berkeley) 6/7/85";
+static char *sccsid = "@(#)ex_put.c    7.11 (Berkeley) 1/2/88";
 #endif not lint
 
 #include "ex.h"
 #endif not lint
 
 #include "ex.h"
@@ -29,7 +29,7 @@ static char *sccsid = "@(#)ex_put.c   7.9 (Berkeley) 6/7/85";
  * routines in the file ex_vput.c (vputchar, vinschar, etc.).
  */
 int    (*Outchar)() = termchar;
  * routines in the file ex_vput.c (vputchar, vinschar, etc.).
  */
 int    (*Outchar)() = termchar;
-int    (*Putchar)() = normchar;
+int    (*Put_char)() = normchar;
 int    (*Pline)() = normline;
 
 int (*
 int    (*Pline)() = normline;
 
 int (*
@@ -39,8 +39,8 @@ setlist(t))()
        register int (*P)();
 
        listf = t;
        register int (*P)();
 
        listf = t;
-       P = Putchar;
-       Putchar = t ? listchar : normchar;
+       P = Put_char;
+       Put_char = t ? listchar : normchar;
        return (P);
 }
 
        return (P);
 }
 
@@ -118,7 +118,7 @@ normchar(c)
                        c &= TRIM;
                }
        else if (c < ' ' && (c != '\b' || !OS) && c != '\n' && c != '\t' || c == DELETE)
                        c &= TRIM;
                }
        else if (c < ' ' && (c != '\b' || !OS) && c != '\n' && c != '\t' || c == DELETE)
-               putchar('^'), c = ctlof(c);
+               ex_putchar('^'), c = ctlof(c);
        else if (UPPERCASE)
                if (isupper(c)) {
                        outchar('\\');
        else if (UPPERCASE)
                if (isupper(c)) {
                        outchar('\\');
@@ -144,7 +144,7 @@ numbline(i)
 
        if (shudclob)
                slobber(' ');
 
        if (shudclob)
                slobber(' ');
-       printf("%6d  ", i);
+       ex_printf("%6d  ", i);
        normline();
 }
 
        normline();
 }
 
@@ -160,9 +160,9 @@ normline()
        /* pdp-11 doprnt is not reentrant so can't use "printf" here
           in case we are tracing */
        for (cp = linebuf; *cp;)
        /* pdp-11 doprnt is not reentrant so can't use "printf" here
           in case we are tracing */
        for (cp = linebuf; *cp;)
-               putchar(*cp++);
+               ex_putchar(*cp++);
        if (!inopen)
        if (!inopen)
-               putchar('\n' | QUOTE);
+               ex_putchar('\n' | QUOTE);
 }
 
 /*
 }
 
 /*
@@ -178,7 +178,7 @@ slobber(c)
        switch (c) {
 
        case '\t':
        switch (c) {
 
        case '\t':
-               if (Putchar == listchar)
+               if (Put_char == listchar)
                        return;
                break;
 
                        return;
                break;
 
@@ -217,11 +217,11 @@ static    bool phadnl;
 /*
  * Indirect to current definition of putchar.
  */
 /*
  * Indirect to current definition of putchar.
  */
-putchar(c)
+ex_putchar(c)
        int c;
 {
 
        int c;
 {
 
-       (*Putchar)(c);
+       (*Put_char)(c);
 }
 
 /*
 }
 
 /*
@@ -771,7 +771,11 @@ flusho()
 {
 
        if (obp != obuf) {
 {
 
        if (obp != obuf) {
+#ifndef vms
                write(1, obuf, obp - obuf);
                write(1, obuf, obp - obuf);
+#else
+               vms_write(1, obuf, obp - obuf);
+#endif
                obp = obuf;
        }
 }
                obp = obuf;
        }
 }
@@ -779,10 +783,10 @@ flusho()
 putnl()
 {
 
 putnl()
 {
 
-       putchar('\n');
+       ex_putchar('\n');
 }
 
 }
 
-putS(cp)
+ex_putS(cp)
        char *cp;
 {
 
        char *cp;
 {
 
@@ -833,15 +837,15 @@ setoutt()
 /*
  * Printf (temporarily) in list mode.
  */
 /*
  * Printf (temporarily) in list mode.
  */
-/*VARARGS2*/
+/*VARARGS1*/
 lprintf(cp, dp)
        char *cp, *dp;
 {
        register int (*P)();
 
        P = setlist(1);
 lprintf(cp, dp)
        char *cp, *dp;
 {
        register int (*P)();
 
        P = setlist(1);
-       printf(cp, dp);
-       Putchar = P;
+       ex_printf(cp, dp);
+       Put_char = P;
 }
 
 /*
 }
 
 /*
@@ -877,7 +881,7 @@ pstart()
        tty.c_oflag &= ~(ONLCR|TAB3);
        tty.c_lflag &= ~ECHO;
 #endif
        tty.c_oflag &= ~(ONLCR|TAB3);
        tty.c_lflag &= ~ECHO;
 #endif
-       sTTY(1);
+       ex_sTTY(1);
 }
 
 /*
 }
 
 /*
@@ -905,7 +909,7 @@ ostart()
 
        if (!intty)
                error("Open and visual must be used interactively");
 
        if (!intty)
                error("Open and visual must be used interactively");
-       gTTY(1);
+       ex_gTTY(1);
        normtty++;
 #ifndef USG3TTY
        f = tty.sg_flags;
        normtty++;
 #ifndef USG3TTY
        f = tty.sg_flags;
@@ -928,7 +932,7 @@ ostart()
        tty.c_cc[VTIME] = 1;
        ttcharoff();
 #endif
        tty.c_cc[VTIME] = 1;
        ttcharoff();
 #endif
-       sTTY(1);
+       ex_sTTY(1);
        tostart();
        pfast |= 2;
        return (f);
        tostart();
        pfast |= 2;
        return (f);
@@ -978,9 +982,9 @@ tostart()
 ttcharoff()
 {
        nttyc.t_quitc = '\377';
 ttcharoff()
 {
        nttyc.t_quitc = '\377';
-       if (nttyc.t_startc != CTRL(q))
+       if (nttyc.t_startc != CTRL('q'))
                nttyc.t_startc = '\377';
                nttyc.t_startc = '\377';
-       if (nttyc.t_stopc != CTRL(s))
+       if (nttyc.t_stopc != CTRL('s'))
                nttyc.t_stopc = '\377';
 # ifdef TIOCLGET
        nlttyc.t_suspc = '\377';        /* ^Z */
                nttyc.t_stopc = '\377';
 # ifdef TIOCLGET
        nlttyc.t_suspc = '\377';        /* ^Z */
@@ -1001,9 +1005,9 @@ ttcharoff()
         * their start/stop chars.  As long as they can't we can't get
         * into trouble so we just leave them alone.
         */
         * their start/stop chars.  As long as they can't we can't get
         * into trouble so we just leave them alone.
         */
-       if (tty.c_cc[VSTART] != CTRL(q))
+       if (tty.c_cc[VSTART] != CTRL('q'))
                tty.c_cc[VSTART] = '\377';
                tty.c_cc[VSTART] = '\377';
-       if (tty.c_cc[VSTOP] != CTRL(s))
+       if (tty.c_cc[VSTOP] != CTRL('s'))
                tty.c_cc[VSTOP] = '\377';
 # endif
 }
                tty.c_cc[VSTOP] = '\377';
 # endif
 }
@@ -1043,7 +1047,7 @@ vcook()
 {
 
        tty.sg_flags &= ~RAW;
 {
 
        tty.sg_flags &= ~RAW;
-       sTTY(1);
+       ex_sTTY(1);
 }
 
 /*
 }
 
 /*
@@ -1053,7 +1057,7 @@ vraw()
 {
 
        tty.sg_flags |= RAW;
 {
 
        tty.sg_flags |= RAW;
-       sTTY(1);
+       ex_sTTY(1);
 }
 #endif
 
 }
 #endif
 
@@ -1065,7 +1069,7 @@ normal(f)
 {
 
        if (normtty > 0) {
 {
 
        if (normtty > 0) {
-               setty(f);
+               ignore(setty(f));
                normtty--;
        }
 }
                normtty--;
        }
 }
@@ -1085,6 +1089,7 @@ setty(f)
 #endif
 
 #ifndef USG3TTY
 #endif
 
 #ifndef USG3TTY
+# ifdef TIOCGETC
        if (f == normf) {
                nttyc = ottyc;
 # ifdef TIOCLGET
        if (f == normf) {
                nttyc = ottyc;
 # ifdef TIOCLGET
@@ -1092,40 +1097,41 @@ setty(f)
 # endif
        } else
                ttcharoff();
 # endif
        } else
                ttcharoff();
+# endif
        tty.sg_flags = f;
 #else
        if (tty.c_lflag & ICANON)
                ttcharoff();
        tty = f;
 #endif
        tty.sg_flags = f;
 #else
        if (tty.c_lflag & ICANON)
                ttcharoff();
        tty = f;
 #endif
-       sTTY(1);
+       ex_sTTY(1);
        return (ot);
 }
 
        return (ot);
 }
 
-gTTY(i)
+ex_gTTY(i)
        int i;
 {
 
 #ifndef USG3TTY
        ignore(gtty(i, &tty));
 # ifdef TIOCGETC
        int i;
 {
 
 #ifndef USG3TTY
        ignore(gtty(i, &tty));
 # ifdef TIOCGETC
-       ioctl(i, TIOCGETC, &ottyc);
+       ioctl(i, TIOCGETC, (char *) &ottyc);
        nttyc = ottyc;
 # endif
 # ifdef TIOCGLTC
        nttyc = ottyc;
 # endif
 # ifdef TIOCGLTC
-       ioctl(i, TIOCGLTC, &olttyc);
+       ioctl(i, TIOCGLTC, (char *) &olttyc);
        nlttyc = olttyc;
 # endif
 #else
        nlttyc = olttyc;
 # endif
 #else
-       ioctl(i, TCGETA, &tty);
+       ioctl(i, TCGETA, (char *) &tty);
 #endif
 }
 
 /*
 #endif
 }
 
 /*
- * sTTY: set the tty modes on file descriptor i to be what's
+ * ex_sTTY: set the tty modes on file descriptor i to be what's
  * currently in global "tty".  (Also use nttyc if needed.)
  */
  * currently in global "tty".  (Also use nttyc if needed.)
  */
-sTTY(i)
+ex_sTTY(i)
        int i;
 {
 
        int i;
 {
 
@@ -1138,7 +1144,7 @@ sTTY(i)
 
 # ifdef TIOCSETN
        /* Don't flush typeahead if we don't have to */
 
 # ifdef TIOCSETN
        /* Don't flush typeahead if we don't have to */
-       ioctl(i, TIOCSETN, &tty);
+       ioctl(i, TIOCSETN, (char *) &tty);
 # else
        /* We have to.  Too bad. */
        stty(i, &tty);
 # else
        /* We have to.  Too bad. */
        stty(i, &tty);
@@ -1146,15 +1152,15 @@ sTTY(i)
 
 # ifdef TIOCGETC
        /* Update the other random chars while we're at it. */
 
 # ifdef TIOCGETC
        /* Update the other random chars while we're at it. */
-       ioctl(i, TIOCSETC, &nttyc);
+       ioctl(i, TIOCSETC, (char *) &nttyc);
 # endif
 # ifdef TIOCSLTC
 # endif
 # ifdef TIOCSLTC
-       ioctl(i, TIOCSLTC, &nlttyc);
+       ioctl(i, TIOCSLTC, (char *) &nlttyc);
 # endif
 
 #else
        /* USG 3 very simple: just set everything */
 # endif
 
 #else
        /* USG 3 very simple: just set everything */
-       ioctl(i, TCSETAW, &tty);
+       ioctl(i, TCSETAW, (char *) &tty);
 #endif
 }
 
 #endif
 }
 
@@ -1164,5 +1170,5 @@ sTTY(i)
 noonl()
 {
 
 noonl()
 {
 
-       putchar(Outchar != termchar ? ' ' : '\n');
+       ex_putchar(Outchar != termchar ? ' ' : '\n');
 }
 }