string operators, +, <<, >>
[unix-history] / usr / src / usr.bin / window / lcmd.c
CommitLineData
6a571c25 1#ifndef lint
d7c2cbb0 2static char *sccsid = "@(#)lcmd.c 3.14 84/04/05";
6a571c25
EW
3#endif
4
5#include "defs.h"
1c0ca238
EW
6#include "value.h"
7#include "lcmd.h"
6a571c25 8
4cbe417d 9int l_buffer();
1c0ca238 10int l_close();
7a57b3e2 11int l_cursormodes();
b0640643 12int l_debug();
6a571c25 13int l_escape();
e1dba5dd 14int l_foreground();
6a571c25 15int l_label();
1c0ca238 16int l_select();
6a571c25 17int l_source();
1c0ca238 18int l_terse();
b65b69eb 19int l_unset();
1c0ca238 20int l_window();
6a571c25
EW
21int l_write();
22
1c0ca238
EW
23struct lcmd_arg arg_buffer[];
24struct lcmd_arg arg_close[];
7a57b3e2 25struct lcmd_arg arg_cursormodes[];
b0640643 26struct lcmd_arg arg_debug[];
1c0ca238 27struct lcmd_arg arg_escape[];
e1dba5dd 28struct lcmd_arg arg_foreground[];
1c0ca238
EW
29struct lcmd_arg arg_label[];
30struct lcmd_arg arg_select[];
31struct lcmd_arg arg_source[];
32struct lcmd_arg arg_terse[];
b65b69eb 33struct lcmd_arg arg_unset[];
1c0ca238
EW
34struct lcmd_arg arg_window[];
35struct lcmd_arg arg_write[];
36
37struct lcmd_tab lcmd_tab[] = {
38 "%", 1, l_select, arg_select,
e1dba5dd 39 "buffer", 2, l_buffer, arg_buffer,
7a57b3e2
EW
40 "close", 2, l_close, arg_close,
41 "cursormodes", 2, l_cursormodes, arg_cursormodes,
b0640643 42 "debug", 1, l_debug, arg_debug,
1c0ca238 43 "escape", 1, l_escape, arg_escape,
e1dba5dd 44 "foreground", 1, l_foreground, arg_foreground,
1c0ca238
EW
45 "label", 1, l_label, arg_label,
46 "select", 2, l_select, arg_select,
47 "source", 2, l_source, arg_source,
48 "terse", 1, l_terse, arg_terse,
b65b69eb 49 "unset", 1, l_unset, arg_unset,
1c0ca238
EW
50 "window", 2, l_window, arg_window,
51 "write", 2, l_write, arg_write,
e1dba5dd 52 0
6a571c25
EW
53};
54
1c0ca238
EW
55struct lcmd_tab *
56lcmd_lookup(name)
57char *name;
6a571c25 58{
1c0ca238 59 register struct lcmd_tab *p;
6a571c25 60
1c0ca238
EW
61 for (p = lcmd_tab; p->lc_name != 0; p++)
62 if (str_match(name, p->lc_name, p->lc_minlen))
63 return p;
6a571c25
EW
64 return 0;
65}
66
1c0ca238
EW
67dosource(filename)
68char *filename;
6a571c25 69{
a40a2f9a 70 if (cx_beginfile(filename) < 0)
1c0ca238
EW
71 return -1;
72 p_start();
73 err_end();
74 cx_end();
75 return 0;
6a571c25
EW
76}
77
1c0ca238
EW
78dolongcmd(buffer)
79char *buffer;
6a571c25 80{
a40a2f9a 81 if (cx_beginbuf(buffer) < 0)
1c0ca238
EW
82 return -1;
83 p_start();
84 err_end();
85 cx_end();
86 return 0;
6a571c25 87}