l_time(): give the rss fields more room
[unix-history] / usr / src / usr.bin / window / lcmd.c
CommitLineData
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 19static 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 26int l_alias();
1c0ca238 27int l_close();
7a57b3e2 28int l_cursormodes();
b0640643 29int l_debug();
6a1ef78a
EW
30int l_def_nline();
31int l_def_shell();
32int l_def_smooth();
1b736021 33int l_echo();
6a571c25 34int l_escape();
e1dba5dd 35int l_foreground();
94a746af 36int l_iostat();
6a571c25 37int l_label();
e404c17a 38int l_list();
1c0ca238 39int l_select();
2422abab 40int l_smooth();
6a571c25 41int l_source();
1c0ca238 42int l_terse();
94a746af 43int l_time();
bb4a0c0b 44int l_unalias();
b65b69eb 45int l_unset();
e404c17a 46int l_variable();
1c0ca238 47int l_window();
6a571c25
EW
48int l_write();
49
b15b4a3f
EW
50extern struct lcmd_arg arg_alias[];
51extern struct lcmd_arg arg_cursormodes[];
52extern struct lcmd_arg arg_debug[];
53extern struct lcmd_arg arg_echo[];
54extern struct lcmd_arg arg_escape[];
55extern struct lcmd_arg arg_foreground[];
56extern struct lcmd_arg arg_label[];
6a1ef78a
EW
57extern struct lcmd_arg arg_def_nline[];
58extern struct lcmd_arg arg_def_shell[];
59extern struct lcmd_arg arg_def_smooth[];
b15b4a3f
EW
60extern struct lcmd_arg arg_close[];
61extern struct lcmd_arg arg_select[];
b15b4a3f
EW
62extern struct lcmd_arg arg_smooth[];
63extern struct lcmd_arg arg_source[];
64extern struct lcmd_arg arg_terse[];
65extern struct lcmd_arg arg_time[];
66extern struct lcmd_arg arg_unalias[];
67extern struct lcmd_arg arg_unset[];
68extern struct lcmd_arg arg_window[];
69extern struct lcmd_arg arg_write[];
b7f88b16 70struct lcmd_arg arg_null[1] = { { 0 } };
1c0ca238
EW
71
72struct 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
101struct lcmd_tab *
102lcmd_lookup(name)
103char *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
113dosource(filename)
114char *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 124dolongcmd(buffer, arg, narg)
1c0ca238 125char *buffer;
bb4a0c0b
EW
126struct value *arg;
127int 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}