Commit | Line | Data |
---|---|---|
60de5df9 | 1 | /* |
46e9ea25 KB |
2 | * Copyright (c) 1983 Regents of the University of California. |
3 | * All rights reserved. | |
4 | * | |
3dd3a9e5 KB |
5 | * This code is derived from software contributed to Berkeley by |
6 | * Edward Wang at The University of California, Berkeley. | |
7 | * | |
1c15e888 C |
8 | * Redistribution and use in source and binary forms are permitted provided |
9 | * that: (1) source distributions retain this entire copyright notice and | |
10 | * comment, and (2) distributions including binaries display the following | |
11 | * acknowledgement: ``This product includes software developed by the | |
12 | * University of California, Berkeley and its contributors'' in the | |
13 | * documentation or other materials provided with the distribution and in | |
14 | * all advertising materials mentioning features or use of this software. | |
15 | * Neither the name of the University nor the names of its contributors may | |
16 | * be used to endorse or promote products derived from this software without | |
17 | * specific prior written permission. | |
18 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED | |
19 | * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF | |
20 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
60de5df9 EW |
21 | */ |
22 | ||
46e9ea25 | 23 | #ifndef lint |
1c15e888 | 24 | static char sccsid[] = "@(#)lcmd.c 3.34 (Berkeley) 6/6/90"; |
46e9ea25 KB |
25 | #endif /* not lint */ |
26 | ||
6a571c25 | 27 | #include "defs.h" |
1c0ca238 EW |
28 | #include "value.h" |
29 | #include "lcmd.h" | |
6a571c25 | 30 | |
bb4a0c0b | 31 | int l_alias(); |
1c0ca238 | 32 | int l_close(); |
7a57b3e2 | 33 | int l_cursormodes(); |
b0640643 | 34 | int l_debug(); |
6a1ef78a EW |
35 | int l_def_nline(); |
36 | int l_def_shell(); | |
37 | int l_def_smooth(); | |
1b736021 | 38 | int l_echo(); |
6a571c25 | 39 | int l_escape(); |
e1dba5dd | 40 | int l_foreground(); |
94a746af | 41 | int l_iostat(); |
6a571c25 | 42 | int l_label(); |
e404c17a | 43 | int l_list(); |
1c0ca238 | 44 | int l_select(); |
2422abab | 45 | int l_smooth(); |
6a571c25 | 46 | int l_source(); |
1c0ca238 | 47 | int l_terse(); |
94a746af | 48 | int l_time(); |
bb4a0c0b | 49 | int l_unalias(); |
b65b69eb | 50 | int l_unset(); |
e404c17a | 51 | int l_variable(); |
1c0ca238 | 52 | int l_window(); |
6a571c25 EW |
53 | int l_write(); |
54 | ||
b15b4a3f EW |
55 | extern struct lcmd_arg arg_alias[]; |
56 | extern struct lcmd_arg arg_cursormodes[]; | |
57 | extern struct lcmd_arg arg_debug[]; | |
58 | extern struct lcmd_arg arg_echo[]; | |
59 | extern struct lcmd_arg arg_escape[]; | |
60 | extern struct lcmd_arg arg_foreground[]; | |
61 | extern struct lcmd_arg arg_label[]; | |
6a1ef78a EW |
62 | extern struct lcmd_arg arg_def_nline[]; |
63 | extern struct lcmd_arg arg_def_shell[]; | |
64 | extern struct lcmd_arg arg_def_smooth[]; | |
b15b4a3f EW |
65 | extern struct lcmd_arg arg_close[]; |
66 | extern struct lcmd_arg arg_select[]; | |
b15b4a3f EW |
67 | extern struct lcmd_arg arg_smooth[]; |
68 | extern struct lcmd_arg arg_source[]; | |
69 | extern struct lcmd_arg arg_terse[]; | |
70 | extern struct lcmd_arg arg_time[]; | |
71 | extern struct lcmd_arg arg_unalias[]; | |
72 | extern struct lcmd_arg arg_unset[]; | |
73 | extern struct lcmd_arg arg_window[]; | |
74 | extern struct lcmd_arg arg_write[]; | |
b7f88b16 | 75 | struct lcmd_arg arg_null[1] = { { 0 } }; |
1c0ca238 EW |
76 | |
77 | struct lcmd_tab lcmd_tab[] = { | |
6a1ef78a EW |
78 | "alias", 1, l_alias, arg_alias, |
79 | "close", 2, l_close, arg_close, | |
80 | "cursormodes", 2, l_cursormodes, arg_cursormodes, | |
81 | "debug", 1, l_debug, arg_debug, | |
82 | "default_nlines", 9, l_def_nline, arg_def_nline, | |
3d30c0a6 EW |
83 | "default_shell", 10, l_def_shell, arg_def_shell, |
84 | "default_smooth", 10, l_def_smooth, arg_def_smooth, | |
6a1ef78a EW |
85 | "echo", 2, l_echo, arg_echo, |
86 | "escape", 2, l_escape, arg_escape, | |
87 | "foreground", 1, l_foreground, arg_foreground, | |
88 | "iostat", 1, l_iostat, arg_null, | |
89 | "label", 2, l_label, arg_label, | |
90 | "list", 2, l_list, arg_null, | |
91 | "nlines", 1, l_def_nline, arg_def_nline, | |
92 | "select", 2, l_select, arg_select, | |
93 | "shell", 2, l_def_shell, arg_def_shell, | |
94 | "smooth", 2, l_smooth, arg_smooth, | |
95 | "source", 2, l_source, arg_source, | |
96 | "terse", 2, l_terse, arg_terse, | |
97 | "time", 2, l_time, arg_time, | |
98 | "unalias", 3, l_unalias, arg_unalias, | |
99 | "unset", 3, l_unset, arg_unset, | |
100 | "variable", 1, l_variable, arg_null, | |
101 | "window", 2, l_window, arg_window, | |
102 | "write", 2, l_write, arg_write, | |
e1dba5dd | 103 | 0 |
6a571c25 EW |
104 | }; |
105 | ||
1c0ca238 EW |
106 | struct lcmd_tab * |
107 | lcmd_lookup(name) | |
108 | char *name; | |
6a571c25 | 109 | { |
1c0ca238 | 110 | register struct lcmd_tab *p; |
6a571c25 | 111 | |
1c0ca238 EW |
112 | for (p = lcmd_tab; p->lc_name != 0; p++) |
113 | if (str_match(name, p->lc_name, p->lc_minlen)) | |
114 | return p; | |
6a571c25 EW |
115 | return 0; |
116 | } | |
117 | ||
1c0ca238 EW |
118 | dosource(filename) |
119 | char *filename; | |
6a571c25 | 120 | { |
a40a2f9a | 121 | if (cx_beginfile(filename) < 0) |
1c0ca238 EW |
122 | return -1; |
123 | p_start(); | |
124 | err_end(); | |
125 | cx_end(); | |
126 | return 0; | |
6a571c25 EW |
127 | } |
128 | ||
bb4a0c0b | 129 | dolongcmd(buffer, arg, narg) |
1c0ca238 | 130 | char *buffer; |
bb4a0c0b EW |
131 | struct value *arg; |
132 | int narg; | |
6a571c25 | 133 | { |
bb4a0c0b | 134 | if (cx_beginbuf(buffer, arg, narg) < 0) |
1c0ca238 EW |
135 | return -1; |
136 | p_start(); | |
137 | err_end(); | |
138 | cx_end(); | |
139 | return 0; | |
6a571c25 | 140 | } |