the echo command
authorEdward Wang <edward@ucbvax.Berkeley.EDU>
Fri, 20 Jul 1984 08:34:55 +0000 (00:34 -0800)
committerEdward Wang <edward@ucbvax.Berkeley.EDU>
Fri, 20 Jul 1984 08:34:55 +0000 (00:34 -0800)
SCCS-vsn: usr.bin/window/lcmd.c 3.22
SCCS-vsn: usr.bin/window/lcmd2.c 3.8

usr/src/usr.bin/window/lcmd.c
usr/src/usr.bin/window/lcmd2.c

index dc6fad3..389a697 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)lcmd.c     3.21 %G%";
+static char sccsid[] = "@(#)lcmd.c     3.22 %G%";
 #endif
 
 #include "defs.h"
 #endif
 
 #include "defs.h"
@@ -10,6 +10,7 @@ int l_alias();
 int l_close();
 int l_cursormodes();
 int l_debug();
 int l_close();
 int l_cursormodes();
 int l_debug();
+int l_echo();
 int l_escape();
 int l_foreground();
 int l_iostat();
 int l_escape();
 int l_foreground();
 int l_iostat();
@@ -30,6 +31,7 @@ int l_write();
 struct lcmd_arg arg_alias[];
 struct lcmd_arg arg_cursormodes[];
 struct lcmd_arg arg_debug[];
 struct lcmd_arg arg_alias[];
 struct lcmd_arg arg_cursormodes[];
 struct lcmd_arg arg_debug[];
+struct lcmd_arg arg_echo[];
 struct lcmd_arg arg_escape[];
 struct lcmd_arg arg_foreground[];
 struct lcmd_arg arg_label[];
 struct lcmd_arg arg_escape[];
 struct lcmd_arg arg_foreground[];
 struct lcmd_arg arg_label[];
@@ -53,7 +55,8 @@ struct lcmd_tab lcmd_tab[] = {
        "close",        2,      l_close,        arg_close,
        "cursormodes",  2,      l_cursormodes,  arg_cursormodes,
        "debug",        1,      l_debug,        arg_debug,
        "close",        2,      l_close,        arg_close,
        "cursormodes",  2,      l_cursormodes,  arg_cursormodes,
        "debug",        1,      l_debug,        arg_debug,
-       "escape",       1,      l_escape,       arg_escape,
+       "echo",         2,      l_echo,         arg_echo,
+       "escape",       2,      l_escape,       arg_escape,
        "foreground",   1,      l_foreground,   arg_foreground,
        "iostat",       1,      l_iostat,       arg_null,
        "label",        2,      l_label,        arg_label,
        "foreground",   1,      l_foreground,   arg_foreground,
        "iostat",       1,      l_iostat,       arg_null,
        "label",        2,      l_label,        arg_label,
index 909c88f..ea71d37 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)lcmd2.c    3.7 %G%";
+static char sccsid[] = "@(#)lcmd2.c    3.8 %G%";
 #endif
 
 #include "defs.h"
 #endif
 
 #include "defs.h"
@@ -308,3 +308,31 @@ struct value *v, *a;
                v->v_num = alias_unset(a->v_str);
        v->v_type = V_NUM;
 }
                v->v_num = alias_unset(a->v_str);
        v->v_type = V_NUM;
 }
+
+struct lcmd_arg arg_echo[] = {
+       { "window",     1,      ARG_NUM },
+       { "",           0,      ARG_ANY|ARG_LIST },
+       0
+};
+
+/*ARGSUSED*/
+l_echo(v, a)
+struct value *v;
+register struct value *a;
+{
+       char buf[20];
+       struct ww *w;
+
+       if ((w = vtowin(a++)) == 0)
+               return;
+       while (a->v_type != V_ERR) {
+               if (a->v_type == V_NUM) {
+                       (void) sprintf(buf, "%d", a->v_num);
+                       (void) wwwrite(w, buf, strlen(buf));
+               } else
+                       (void) wwwrite(w, a->v_str, strlen(a->v_str));
+               if ((++a)->v_type != V_ERR)
+                       (void) wwwrite(w, " ", 1);
+       }
+       (void) wwwrite(w, "\r\n", 2);
+}