Commit | Line | Data |
---|---|---|
1e64b3ba | 1 | /*- |
304585c1 | 2 | * Copyright (c) 1991, 1993, 1994 |
1e64b3ba JH |
3 | * The Regents of the University of California. All rights reserved. |
4 | * | |
5 | * Redistribution and use in source and binary forms, with or without | |
6 | * modification, are permitted provided that the following conditions | |
7 | * are met: | |
8 | * 1. Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * 2. Redistributions in binary form must reproduce the above copyright | |
11 | * notice, this list of conditions and the following disclaimer in the | |
12 | * documentation and/or other materials provided with the distribution. | |
13 | * 3. All advertising materials mentioning features or use of this software | |
14 | * must display the following acknowledgement: | |
15 | * This product includes software developed by the University of | |
16 | * California, Berkeley and its contributors. | |
17 | * 4. Neither the name of the University nor the names of its contributors | |
18 | * may be used to endorse or promote products derived from this software | |
19 | * without specific prior written permission. | |
20 | * | |
21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
31 | * SUCH DAMAGE. | |
32 | * | |
304585c1 | 33 | * @(#)options.h.stub 8.18 (Berkeley) 3/17/94 |
1e64b3ba JH |
34 | */ |
35 | ||
36 | struct _option { | |
37 | union { | |
38 | u_long val; /* Value or boolean. */ | |
39 | char *str; /* String. */ | |
40 | } o_u; | |
41 | size_t len; /* String length. */ | |
42 | ||
43 | #define OPT_ALLOCATED 0x01 /* Allocated space. */ | |
44 | #define OPT_SELECTED 0x02 /* Selected for display. */ | |
45 | #define OPT_SET 0x04 /* Set (display for the user). */ | |
46 | u_char flags; | |
47 | }; | |
48 | ||
49 | struct _optlist { | |
50 | char *name; /* Name. */ | |
51 | /* Change function. */ | |
52 | int (*func) __P((SCR *, OPTION *, char *, u_long)); | |
304585c1 | 53 | /* Type of object. */ |
1e64b3ba JH |
54 | enum { OPT_0BOOL, OPT_1BOOL, OPT_NUM, OPT_STR } type; |
55 | ||
56 | #define OPT_NEVER 0x01 /* Never display the option. */ | |
57 | #define OPT_NOSAVE 0x02 /* Mkexrc command doesn't save. */ | |
58 | #define OPT_NOSTR 0x04 /* String that takes a "no". */ | |
59 | u_int flags; | |
60 | }; | |
61 | ||
62 | /* Clear, set, test boolean options. */ | |
63 | #define O_SET(sp, o) (sp)->opts[(o)].o_u.val = 1 | |
64 | #define O_CLR(sp, o) (sp)->opts[(o)].o_u.val = 0 | |
65 | #define O_ISSET(sp, o) ((sp)->opts[(o)].o_u.val) | |
66 | ||
67 | /* Get option values. */ | |
68 | #define O_LEN(sp, o) (sp)->opts[(o)].len | |
69 | #define O_STR(sp, o) (sp)->opts[(o)].o_u.str | |
70 | #define O_VAL(sp, o) (sp)->opts[(o)].o_u.val | |
71 | ||
72 | /* Option routines. */ | |
73 | enum optdisp { NO_DISPLAY, ALL_DISPLAY, CHANGED_DISPLAY, SELECT_DISPLAY }; | |
74 | ||
75 | int opts_copy __P((SCR *, SCR *)); | |
76 | void opts_dump __P((SCR *, enum optdisp)); | |
77 | void opts_free __P((SCR *)); | |
78 | int opts_init __P((SCR *)); | |
79 | int opts_save __P((SCR *, FILE *)); | |
80 | int opts_set __P((SCR *, ARGS *[])); | |
81 | ||
82 | /* Per-option change routines. */ | |
83 | int f_altwerase __P((SCR *, OPTION *, char *, u_long)); | |
304585c1 | 84 | int f_cdpath __P((SCR *, OPTION *, char *, u_long)); |
1e64b3ba JH |
85 | int f_columns __P((SCR *, OPTION *, char *, u_long)); |
86 | int f_keytime __P((SCR *, OPTION *, char *, u_long)); | |
87 | int f_leftright __P((SCR *, OPTION *, char *, u_long)); | |
88 | int f_lines __P((SCR *, OPTION *, char *, u_long)); | |
89 | int f_lisp __P((SCR *, OPTION *, char *, u_long)); | |
90 | int f_list __P((SCR *, OPTION *, char *, u_long)); | |
91 | int f_matchtime __P((SCR *, OPTION *, char *, u_long)); | |
92 | int f_mesg __P((SCR *, OPTION *, char *, u_long)); | |
93 | int f_modeline __P((SCR *, OPTION *, char *, u_long)); | |
94 | int f_number __P((SCR *, OPTION *, char *, u_long)); | |
1e64b3ba JH |
95 | int f_paragraph __P((SCR *, OPTION *, char *, u_long)); |
96 | int f_readonly __P((SCR *, OPTION *, char *, u_long)); | |
97 | int f_ruler __P((SCR *, OPTION *, char *, u_long)); | |
98 | int f_section __P((SCR *, OPTION *, char *, u_long)); | |
99 | int f_shiftwidth __P((SCR *, OPTION *, char *, u_long)); | |
100 | int f_sidescroll __P((SCR *, OPTION *, char *, u_long)); | |
101 | int f_sourceany __P((SCR *, OPTION *, char *, u_long)); | |
102 | int f_tabstop __P((SCR *, OPTION *, char *, u_long)); | |
103 | int f_tags __P((SCR *, OPTION *, char *, u_long)); | |
104 | int f_term __P((SCR *, OPTION *, char *, u_long)); | |
105 | int f_ttywerase __P((SCR *, OPTION *, char *, u_long)); | |
106 | int f_w1200 __P((SCR *, OPTION *, char *, u_long)); | |
107 | int f_w300 __P((SCR *, OPTION *, char *, u_long)); | |
108 | int f_w9600 __P((SCR *, OPTION *, char *, u_long)); | |
109 | int f_window __P((SCR *, OPTION *, char *, u_long)); | |
110 | int f_wrapmargin __P((SCR *, OPTION *, char *, u_long)); |