Fix a 64-bit warning. While here, also fix a gcc34 warning.
[dragonfly.git] / gnu / lib / libdialog / rc.h
blobfc19d033ed828d4b80ac1b1de75f4870546f6921
1 /*
2 * rc.h -- declarations for configuration file processing
4 * AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #define DIALOGRC ".dialogrc"
23 #define VAR_LEN 30
24 #define COMMENT_LEN 70
26 /* Types of values */
27 #define VAL_INT 0
28 #define VAL_STR 1
29 #define VAL_BOOL 2
30 #define VAL_ATTR 3
32 /* Type of line in configuration file */
33 #define LINE_BLANK 2
34 #define LINE_COMMENT 1
35 #define LINE_OK 0
36 #define LINE_ERROR -1
38 /* number of configuration variables */
39 #define VAR_COUNT (sizeof(vars) / sizeof(vars_st))
41 /* check if character is white space */
42 #define whitespace(c) (c == ' ' || c == '\t')
44 /* check if character is string quoting characters */
45 #define isquote(c) (c == '"' || c == '\'')
47 /* get last character of string */
48 #define lastch(str) str[strlen(str)-1]
51 * Configuration variables
53 typedef struct {
54 unsigned char name[VAR_LEN]; /* name of configuration variable as in DIALOGRC */
55 void *var; /* address of actually variable to change */
56 int type; /* type of value */
57 unsigned char comment[COMMENT_LEN]; /* comment to put in "rc" file */
58 } vars_st;
60 vars_st vars[] = {
61 { "use_shadow",
62 &use_shadow,
63 VAL_BOOL,
64 "Shadow dialog boxes? This also turns on color." },
66 { "use_colors",
67 &use_colors,
68 VAL_BOOL,
69 "Turn color support ON or OFF" },
71 { "screen_color",
72 color_table[0],
73 VAL_ATTR,
74 "Screen color" },
76 { "shadow_color",
77 color_table[1],
78 VAL_ATTR,
79 "Shadow color" },
81 { "dialog_color",
82 color_table[2],
83 VAL_ATTR,
84 "Dialog box color" },
86 { "title_color",
87 color_table[3],
88 VAL_ATTR,
89 "Dialog box title color" },
91 { "border_color",
92 color_table[4],
93 VAL_ATTR,
94 "Dialog box border color" },
96 { "button_active_color",
97 color_table[5],
98 VAL_ATTR,
99 "Active button color" },
101 { "button_inactive_color",
102 color_table[6],
103 VAL_ATTR,
104 "Inactive button color" },
106 { "button_key_active_color",
107 color_table[7],
108 VAL_ATTR,
109 "Active button key color" },
111 { "button_key_inactive_color",
112 color_table[8],
113 VAL_ATTR,
114 "Inactive button key color" },
116 { "button_label_active_color",
117 color_table[9],
118 VAL_ATTR,
119 "Active button label color" },
121 { "button_label_inactive_color",
122 color_table[10],
123 VAL_ATTR,
124 "Inactive button label color" },
126 { "inputbox_color",
127 color_table[11],
128 VAL_ATTR,
129 "Input box color" },
131 { "inputbox_border_color",
132 color_table[12],
133 VAL_ATTR,
134 "Input box border color" },
136 { "searchbox_color",
137 color_table[13],
138 VAL_ATTR,
139 "Search box color" },
141 { "searchbox_title_color",
142 color_table[14],
143 VAL_ATTR,
144 "Search box title color" },
146 { "searchbox_border_color",
147 color_table[15],
148 VAL_ATTR,
149 "Search box border color" },
151 { "position_indicator_color",
152 color_table[16],
153 VAL_ATTR,
154 "File position indicator color" },
156 { "menubox_color",
157 color_table[17],
158 VAL_ATTR,
159 "Menu box color" },
161 { "menubox_border_color",
162 color_table[18],
163 VAL_ATTR,
164 "Menu box border color" },
166 { "item_color",
167 color_table[19],
168 VAL_ATTR,
169 "Item color" },
171 { "item_selected_color",
172 color_table[20],
173 VAL_ATTR,
174 "Selected item color" },
176 { "tag_color",
177 color_table[21],
178 VAL_ATTR,
179 "Tag color" },
181 { "tag_selected_color",
182 color_table[22],
183 VAL_ATTR,
184 "Selected tag color" },
186 { "tag_key_color",
187 color_table[23],
188 VAL_ATTR,
189 "Tag key color" },
191 { "tag_key_selected_color",
192 color_table[24],
193 VAL_ATTR,
194 "Selected tag key color" },
196 { "check_color",
197 color_table[25],
198 VAL_ATTR,
199 "Check box color" },
201 { "check_selected_color",
202 color_table[26],
203 VAL_ATTR,
204 "Selected check box color" },
206 { "uarrow_color",
207 color_table[27],
208 VAL_ATTR,
209 "Up arrow color" },
211 { "darrow_color",
212 color_table[28],
213 VAL_ATTR,
214 "Down arrow color" }
215 }; /* vars */
220 * Routines to process configuration file
222 int parse_rc(void);