Release 3.5, August 20, 1980
[unix-history] / usr / src / usr.bin / ex / ex_set.c
index 721836c..f74e411 100644 (file)
@@ -1,4 +1,5 @@
-/* Copyright (c) 1979 Regents of the University of California */
+/* Copyright (c) 1980 Regents of the University of California */
+static char *sccsid = "@(#)ex_set.c    5.1 %G%";
 #include "ex.h"
 #include "ex_temp.h"
 
 #include "ex.h"
 #include "ex_temp.h"
 
@@ -13,6 +14,7 @@ set()
        register struct option *op;
        register int c;
        bool no;
        register struct option *op;
        register int c;
        bool no;
+       extern short ospeed;
 
        setnoaddr();
        if (skipend()) {
 
        setnoaddr();
        if (skipend()) {
@@ -26,7 +28,7 @@ set()
                do {
                        if (cp < &optname[ONMSZ - 2])
                                *cp++ = getchar();
                do {
                        if (cp < &optname[ONMSZ - 2])
                                *cp++ = getchar();
-               } while (isalpha(peekchar()));
+               } while (isalnum(peekchar()));
                *cp = 0;
                cp = optname;
                if (eq("all", cp)) {
                *cp = 0;
                cp = optname;
                if (eq("all", cp)) {
@@ -40,6 +42,24 @@ set()
                        cp += 2;
                        no++;
                }
                        cp += 2;
                        no++;
                }
+               /* Implement w300, w1200, and w9600 specially */
+               if (eq(cp, "w300")) {
+                       if (ospeed >= B1200) {
+dontset:
+                               ignore(getchar());      /* = */
+                               ignore(getnum());       /* value */
+                               continue;
+                       }
+                       cp = "window";
+               } else if (eq(cp, "w1200")) {
+                       if (ospeed < B1200 || ospeed >= B2400)
+                               goto dontset;
+                       cp = "window";
+               } else if (eq(cp, "w9600")) {
+                       if (ospeed < B2400)
+                               goto dontset;
+                       cp = "window";
+               }
                for (op = options; op < &options[NOPTS]; op++)
                        if (eq(op->oname, cp) || op->oabbrev && eq(op->oabbrev, cp))
                                break;
                for (op = options; op < &options[NOPTS]; op++)
                        if (eq(op->oname, cp) || op->oabbrev && eq(op->oabbrev, cp))
                                break;
@@ -55,6 +75,8 @@ printone:
                }
                if (op->otype == ONOFF) {
                        op->ovalue = 1 - no;
                }
                if (op->otype == ONOFF) {
                        op->ovalue = 1 - no;
+                       if (op == &options[PROMPT])
+                               oprompt = 1 - no;
                        goto next;
                }
                if (no)
                        goto next;
                }
                if (no)
@@ -67,10 +89,12 @@ printone:
 
                case NUMERIC:
                        if (!isdigit(peekchar()))
 
                case NUMERIC:
                        if (!isdigit(peekchar()))
-error("Digits required@after = when assigning numeric option");
+                               error("Digits required@after =");
                        op->ovalue = getnum();
                        if (value(TABSTOP) <= 0)
                                value(TABSTOP) = TABS;
                        op->ovalue = getnum();
                        if (value(TABSTOP) <= 0)
                                value(TABSTOP) = TABS;
+                       if (op == &options[WINDOW])
+                               vsetsiz(value(WINDOW));
                        break;
 
                case STRING:
                        break;
 
                case STRING: