Commit | Line | Data |
---|---|---|
6a571c25 | 1 | #ifndef lint |
60de5df9 | 2 | static char sccsid[] = "@(#)lcmd.c 3.24 %G%"; |
6a571c25 EW |
3 | #endif |
4 | ||
60de5df9 EW |
5 | /* |
6 | * Copyright (c) 1983 Regents of the University of California, | |
7 | * All rights reserved. Redistribution permitted subject to | |
8 | * the terms of the Berkeley Software License Agreement. | |
9 | */ | |
10 | ||
6a571c25 | 11 | #include "defs.h" |
1c0ca238 EW |
12 | #include "value.h" |
13 | #include "lcmd.h" | |
6a571c25 | 14 | |
bb4a0c0b | 15 | int l_alias(); |
1c0ca238 | 16 | int l_close(); |
7a57b3e2 | 17 | int l_cursormodes(); |
b0640643 | 18 | int l_debug(); |
1b736021 | 19 | int l_echo(); |
6a571c25 | 20 | int l_escape(); |
e1dba5dd | 21 | int l_foreground(); |
94a746af | 22 | int l_iostat(); |
6a571c25 | 23 | int l_label(); |
e404c17a | 24 | int l_list(); |
1f12ea41 | 25 | int l_nline(); |
1c0ca238 | 26 | int l_select(); |
7ecf4dca | 27 | int l_shell(); |
6a571c25 | 28 | int l_source(); |
1c0ca238 | 29 | int l_terse(); |
94a746af | 30 | int l_time(); |
bb4a0c0b | 31 | int l_unalias(); |
b65b69eb | 32 | int l_unset(); |
e404c17a | 33 | int l_variable(); |
1c0ca238 | 34 | int l_window(); |
6a571c25 EW |
35 | int l_write(); |
36 | ||
bb4a0c0b | 37 | struct lcmd_arg arg_alias[]; |
7a57b3e2 | 38 | struct lcmd_arg arg_cursormodes[]; |
b0640643 | 39 | struct lcmd_arg arg_debug[]; |
1b736021 | 40 | struct lcmd_arg arg_echo[]; |
1c0ca238 | 41 | struct lcmd_arg arg_escape[]; |
e1dba5dd | 42 | struct lcmd_arg arg_foreground[]; |
1c0ca238 | 43 | struct lcmd_arg arg_label[]; |
1f12ea41 | 44 | struct lcmd_arg arg_nline[]; |
855d0f8f | 45 | struct lcmd_arg arg_close[]; |
1c0ca238 | 46 | struct lcmd_arg arg_select[]; |
7ecf4dca | 47 | struct lcmd_arg arg_shell[]; |
1c0ca238 EW |
48 | struct lcmd_arg arg_source[]; |
49 | struct lcmd_arg arg_terse[]; | |
94a746af | 50 | struct lcmd_arg arg_time[]; |
bb4a0c0b | 51 | struct lcmd_arg arg_unalias[]; |
b65b69eb | 52 | struct lcmd_arg arg_unset[]; |
1c0ca238 | 53 | struct lcmd_arg arg_window[]; |
855d0f8f | 54 | struct lcmd_arg arg_write[]; |
e404c17a | 55 | struct lcmd_arg arg_null[] = 0; |
1c0ca238 EW |
56 | |
57 | struct lcmd_tab lcmd_tab[] = { | |
bb4a0c0b | 58 | "alias", 1, l_alias, arg_alias, |
855d0f8f | 59 | "close", 2, l_close, arg_close, |
7a57b3e2 | 60 | "cursormodes", 2, l_cursormodes, arg_cursormodes, |
b0640643 | 61 | "debug", 1, l_debug, arg_debug, |
1b736021 EW |
62 | "echo", 2, l_echo, arg_echo, |
63 | "escape", 2, l_escape, arg_escape, | |
e1dba5dd | 64 | "foreground", 1, l_foreground, arg_foreground, |
e404c17a EW |
65 | "iostat", 1, l_iostat, arg_null, |
66 | "label", 2, l_label, arg_label, | |
67 | "list", 2, l_list, arg_null, | |
1f12ea41 | 68 | "nlines", 1, l_nline, arg_nline, |
1c0ca238 | 69 | "select", 2, l_select, arg_select, |
7ecf4dca | 70 | "shell", 2, l_shell, arg_shell, |
1c0ca238 | 71 | "source", 2, l_source, arg_source, |
94a746af EW |
72 | "terse", 2, l_terse, arg_terse, |
73 | "time", 2, l_time, arg_time, | |
bb4a0c0b EW |
74 | "unalias", 3, l_unalias, arg_unalias, |
75 | "unset", 3, l_unset, arg_unset, | |
e404c17a | 76 | "variable", 1, l_variable, arg_null, |
1c0ca238 | 77 | "window", 2, l_window, arg_window, |
855d0f8f | 78 | "write", 2, l_write, arg_write, |
e1dba5dd | 79 | 0 |
6a571c25 EW |
80 | }; |
81 | ||
1c0ca238 EW |
82 | struct lcmd_tab * |
83 | lcmd_lookup(name) | |
84 | char *name; | |
6a571c25 | 85 | { |
1c0ca238 | 86 | register struct lcmd_tab *p; |
6a571c25 | 87 | |
1c0ca238 EW |
88 | for (p = lcmd_tab; p->lc_name != 0; p++) |
89 | if (str_match(name, p->lc_name, p->lc_minlen)) | |
90 | return p; | |
6a571c25 EW |
91 | return 0; |
92 | } | |
93 | ||
1c0ca238 EW |
94 | dosource(filename) |
95 | char *filename; | |
6a571c25 | 96 | { |
a40a2f9a | 97 | if (cx_beginfile(filename) < 0) |
1c0ca238 EW |
98 | return -1; |
99 | p_start(); | |
100 | err_end(); | |
101 | cx_end(); | |
102 | return 0; | |
6a571c25 EW |
103 | } |
104 | ||
bb4a0c0b | 105 | dolongcmd(buffer, arg, narg) |
1c0ca238 | 106 | char *buffer; |
bb4a0c0b EW |
107 | struct value *arg; |
108 | int narg; | |
6a571c25 | 109 | { |
bb4a0c0b | 110 | if (cx_beginbuf(buffer, arg, narg) < 0) |
1c0ca238 EW |
111 | return -1; |
112 | p_start(); | |
113 | err_end(); | |
114 | cx_end(); | |
115 | return 0; | |
6a571c25 | 116 | } |