summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/dialog/rc.h
blob: 225ff6ddf3060653a8dd5ea8162afe7215926426 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
/*
 *  rc.h -- declarations for configuration file processing
 *
 *  AUTHOR: Savio Lam (lam836@cs.cuhk.hk)
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  as published by the Free Software Foundation; either version 2
 *  of the License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */


#define DIALOGRC ".dialogrc"
#define VAR_LEN 30
#define COMMENT_LEN 70

/* Types of values */
#define VAL_INT  0
#define VAL_STR  1
#define VAL_BOOL 2
#define VAL_ATTR 3

/* Type of line in configuration file */
#define LINE_BLANK    2
#define LINE_COMMENT  1
#define LINE_OK       0
#define LINE_ERROR   -1

/* number of configuration variables */
#define VAR_COUNT        (sizeof(vars) / sizeof(vars_st))

/* check if character is white space */
#define whitespace(c)    (c == ' ' || c == '\t')

/* check if character is string quoting characters */
#define isquote(c)       (c == '"' || c == '\'')

/* get last character of string */
#define lastch(str)      str[strlen(str)-1]

/*
 * Configuration variables
 */
typedef struct {
  unsigned char      name[VAR_LEN];  /* name of configuration variable as in DIALOGRC */
  void     *var;            /* address of actually variable to change */
  int       type;           /* type of value */
  unsigned char      comment[COMMENT_LEN];    /* comment to put in "rc" file */
} vars_st;

vars_st vars[] = {
  {  "use_shadow",
     &use_shadow,
     VAL_BOOL,
     "Shadow dialog boxes? This also turns on color."                        },

  {  "use_colors",
     &use_colors,
     VAL_BOOL,
     "Turn color support ON or OFF"                                          },

  {  "screen_color",
     color_table[0],
     VAL_ATTR,
     "Screen color"                                                          },

  {  "shadow_color",
     color_table[1],
     VAL_ATTR,
     "Shadow color"                                                          },

  {  "dialog_color",
     color_table[2],
     VAL_ATTR,
     "Dialog box color"                                                      },

  {  "title_color",
     color_table[3],
     VAL_ATTR,
     "Dialog box title color"                                                },

  {  "border_color",
     color_table[4],
     VAL_ATTR,
     "Dialog box border color"                                               },

  {  "button_active_color",
     color_table[5],
     VAL_ATTR,
     "Active button color"                                                   },

  {  "button_inactive_color",
     color_table[6],
     VAL_ATTR,
     "Inactive button color"                                                 },

  {  "button_key_active_color",
     color_table[7],
     VAL_ATTR,
     "Active button key color"                                               },

  {  "button_key_inactive_color",
     color_table[8],
     VAL_ATTR,
     "Inactive button key color"                                             },

  {  "button_label_active_color",
     color_table[9],
     VAL_ATTR,
     "Active button label color"                                             },

  {  "button_label_inactive_color",
     color_table[10],
     VAL_ATTR,
     "Inactive button label color"                                           },

  {  "inputbox_color",
     color_table[11],
     VAL_ATTR,
     "Input box color"                                                       },

  {  "inputbox_border_color",
     color_table[12],
     VAL_ATTR,
     "Input box border color"                                                },

  {  "searchbox_color",
     color_table[13],
     VAL_ATTR,
     "Search box color"                                                      },

  {  "searchbox_title_color",
     color_table[14],
     VAL_ATTR,
     "Search box title color"                                                },

  {  "searchbox_border_color",
     color_table[15],
     VAL_ATTR,
     "Search box border color"                                               },

  {  "position_indicator_color",
     color_table[16],
     VAL_ATTR,
     "File position indicator color"                                         },

  {  "menubox_color",
     color_table[17],
     VAL_ATTR,
     "Menu box color"                                                        },

  {  "menubox_border_color",
     color_table[18],
     VAL_ATTR,
     "Menu box border color"                                                 },

  {  "item_color",
     color_table[19],
     VAL_ATTR,
     "Item color"                                                            },

  {  "item_selected_color",
     color_table[20],
     VAL_ATTR,
     "Selected item color"                                                   },

  {  "tag_color",
     color_table[21],
     VAL_ATTR,
     "Tag color"                                                             },

  {  "tag_selected_color",
     color_table[22],
     VAL_ATTR,
     "Selected tag color"                                                    },

  {  "tag_key_color",
     color_table[23],
     VAL_ATTR,
     "Tag key color"                                                         },

  {  "tag_key_selected_color",
     color_table[24],
     VAL_ATTR,
     "Selected tag key color"                                                },

  {  "check_color",
     color_table[25],
     VAL_ATTR,
     "Check box color"                                                       },

  {  "check_selected_color",
     color_table[26],
     VAL_ATTR,
     "Selected check box color"                                              },

  {  "uarrow_color",
     color_table[27],
     VAL_ATTR,
     "Up arrow color"                                                        },

  {  "darrow_color",
     color_table[28],
     VAL_ATTR,
     "Down arrow color"                                                      }
};    /* vars */



/*
 * Routines to process configuration file
 */
void create_rc(unsigned char *filename);
int parse_rc(void);
OpenPOWER on IntegriCloud