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