|
|
1.1 root 1: /*
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
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.
16: */
17:
18: #ifndef lint
19: static char sccsid[] = "@(#)lcmd.c 3.28 (Berkeley) 6/29/88";
20: #endif /* not lint */
21:
22: #include "defs.h"
23: #include "value.h"
24: #include "lcmd.h"
25:
26: int l_alias();
27: int l_close();
28: int l_cursormodes();
29: int l_debug();
30: int l_echo();
31: int l_escape();
32: int l_foreground();
33: int l_iostat();
34: int l_label();
35: int l_list();
36: int l_nline();
37: int l_select();
38: int l_shell();
39: int l_smooth();
40: int l_source();
41: int l_terse();
42: int l_time();
43: int l_unalias();
44: int l_unset();
45: int l_variable();
46: int l_window();
47: int l_write();
48:
49: extern struct lcmd_arg arg_alias[];
50: extern struct lcmd_arg arg_cursormodes[];
51: extern struct lcmd_arg arg_debug[];
52: extern struct lcmd_arg arg_echo[];
53: extern struct lcmd_arg arg_escape[];
54: extern struct lcmd_arg arg_foreground[];
55: extern struct lcmd_arg arg_label[];
56: extern struct lcmd_arg arg_nline[];
57: extern struct lcmd_arg arg_close[];
58: extern struct lcmd_arg arg_select[];
59: extern struct lcmd_arg arg_shell[];
60: extern struct lcmd_arg arg_smooth[];
61: extern struct lcmd_arg arg_source[];
62: extern struct lcmd_arg arg_terse[];
63: extern struct lcmd_arg arg_time[];
64: extern struct lcmd_arg arg_unalias[];
65: extern struct lcmd_arg arg_unset[];
66: extern struct lcmd_arg arg_window[];
67: extern struct lcmd_arg arg_write[];
68: struct lcmd_arg arg_null[] = 0;
69:
70: struct lcmd_tab lcmd_tab[] = {
71: "alias", 1, l_alias, arg_alias,
72: "close", 2, l_close, arg_close,
73: "cursormodes", 2, l_cursormodes, arg_cursormodes,
74: "debug", 1, l_debug, arg_debug,
75: "echo", 2, l_echo, arg_echo,
76: "escape", 2, l_escape, arg_escape,
77: "foreground", 1, l_foreground, arg_foreground,
78: "iostat", 1, l_iostat, arg_null,
79: "label", 2, l_label, arg_label,
80: "list", 2, l_list, arg_null,
81: "nlines", 1, l_nline, arg_nline,
82: "select", 2, l_select, arg_select,
83: "shell", 2, l_shell, arg_shell,
84: "smooth", 2, l_smooth, arg_smooth,
85: "source", 2, l_source, arg_source,
86: "terse", 2, l_terse, arg_terse,
87: "time", 2, l_time, arg_time,
88: "unalias", 3, l_unalias, arg_unalias,
89: "unset", 3, l_unset, arg_unset,
90: "variable", 1, l_variable, arg_null,
91: "window", 2, l_window, arg_window,
92: "write", 2, l_write, arg_write,
93: 0
94: };
95:
96: struct lcmd_tab *
97: lcmd_lookup(name)
98: char *name;
99: {
100: register struct lcmd_tab *p;
101:
102: for (p = lcmd_tab; p->lc_name != 0; p++)
103: if (str_match(name, p->lc_name, p->lc_minlen))
104: return p;
105: return 0;
106: }
107:
108: dosource(filename)
109: char *filename;
110: {
111: if (cx_beginfile(filename) < 0)
112: return -1;
113: p_start();
114: err_end();
115: cx_end();
116: return 0;
117: }
118:
119: dolongcmd(buffer, arg, narg)
120: char *buffer;
121: struct value *arg;
122: int narg;
123: {
124: if (cx_beginbuf(buffer, arg, narg) < 0)
125: return -1;
126: p_start();
127: err_end();
128: cx_end();
129: return 0;
130: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.