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