inet6: only mark autoconf addresses tentative if detached
[dragonfly.git] / usr.bin / window / lcmd.c
CommitLineData
2c872e05 1/* @(#)lcmd.c 8.1 (Berkeley) 6/6/93 */
abecab39
SW
2/* $NetBSD: lcmd.c,v 1.9 2009/04/14 08:50:06 lukem Exp $ */
3
984263bc
MD
4/*
5 * Copyright (c) 1983, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * Edward Wang at The University of California, Berkeley.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
abecab39 19 * 3. Neither the name of the University nor the names of its contributors
984263bc
MD
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 */
35
984263bc 36#include "defs.h"
984263bc 37#include "lcmd.h"
abecab39 38#include "window_string.h"
984263bc
MD
39
40extern struct lcmd_arg arg_alias[];
41extern struct lcmd_arg arg_cursormodes[];
42extern struct lcmd_arg arg_debug[];
43extern struct lcmd_arg arg_echo[];
44extern struct lcmd_arg arg_escape[];
45extern struct lcmd_arg arg_foreground[];
46extern struct lcmd_arg arg_label[];
47extern struct lcmd_arg arg_def_nline[];
48extern struct lcmd_arg arg_def_shell[];
49extern struct lcmd_arg arg_def_smooth[];
50extern struct lcmd_arg arg_close[];
51extern struct lcmd_arg arg_select[];
52extern struct lcmd_arg arg_smooth[];
53extern struct lcmd_arg arg_source[];
54extern struct lcmd_arg arg_terse[];
55extern struct lcmd_arg arg_time[];
56extern struct lcmd_arg arg_unalias[];
57extern struct lcmd_arg arg_unset[];
58extern struct lcmd_arg arg_window[];
59extern struct lcmd_arg arg_write[];
abecab39 60struct lcmd_arg arg_null[1] = { { NULL, 0, 0 } };
984263bc
MD
61
62struct lcmd_tab lcmd_tab[] = {
abecab39
SW
63 { "alias", 1, l_alias, arg_alias },
64 { "close", 2, l_close, arg_close },
65 { "cursormodes", 2, l_cursormodes, arg_cursormodes },
66 { "debug", 1, l_debug, arg_debug },
67 { "default_nlines", 9, l_def_nline, arg_def_nline },
68 { "default_shell", 10, l_def_shell, arg_def_shell },
69 { "default_smooth", 10, l_def_smooth, arg_def_smooth },
70 { "echo", 2, l_echo, arg_echo },
71 { "escape", 2, l_escape, arg_escape },
72 { "foreground", 1, l_foreground, arg_foreground },
73 { "iostat", 1, l_iostat, arg_null },
74 { "label", 2, l_label, arg_label },
75 { "list", 2, l_list, arg_null },
76 { "nlines", 1, l_def_nline, arg_def_nline },
77 { "select", 2, l_select, arg_select },
78 { "shell", 2, l_def_shell, arg_def_shell },
79 { "smooth", 2, l_smooth, arg_smooth },
80 { "source", 2, l_source, arg_source },
81 { "terse", 2, l_terse, arg_terse },
82 { "time", 2, l_time, arg_time },
83 { "unalias", 3, l_unalias, arg_unalias },
84 { "unset", 3, l_unset, arg_unset },
85 { "variable", 1, l_variable, arg_null },
86 { "window", 2, l_window, arg_window },
87 { "write", 2, l_write, arg_write },
88 { 0, 0, 0, 0 }
984263bc
MD
89};
90
91struct lcmd_tab *
abecab39 92lcmd_lookup(const char *name)
984263bc 93{
1e1668dd 94 struct lcmd_tab *p;
984263bc
MD
95
96 for (p = lcmd_tab; p->lc_name != 0; p++)
97 if (str_match(name, p->lc_name, p->lc_minlen))
98 return p;
99 return 0;
100}
101
abecab39
SW
102int
103dosource(char *filename)
984263bc
MD
104{
105 if (cx_beginfile(filename) < 0)
106 return -1;
107 p_start();
108 err_end();
109 cx_end();
110 return 0;
111}
112
abecab39
SW
113int
114dolongcmd(char *buffer, struct value *arg, int narg)
984263bc
MD
115{
116 if (cx_beginbuf(buffer, arg, narg) < 0)
117 return -1;
118 p_start();
119 err_end();
120 cx_end();
121 return 0;
122}