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