2 * option-struct.h - Structures and enums used to process program options.
6 * Neven Has <haski@sezampro.yu>
7 * Kevin P. Fleming <kpfleming@linuxfromscratch.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #ifndef H_OPTION_STRUCT_
26 #define H_OPTION_STRUCT_
30 * Types of some options.
33 typedef enum timer_type
{
39 typedef enum jump_location
{
46 /* We're looping through this enum (toggling) - 0 markes the first value. */
47 typedef enum logging_method
{
52 #define LAST_LOGGING_METHOD LOG_USING_ONE_FIND
72 enum option_type type
;
77 STRING
const def_value
;
78 int (*validate
)(const struct option_s
*option
,
80 void (*post_validate
)(const struct option_s
*option
);
85 int (*validate
)(const struct option_s
*option
,
87 void (*post_validate
)(const struct option_s
*option
);
91 NUMBER
const def_value
;
92 NUMBER
const min_value
;
93 NUMBER
const max_value
;
94 int (*validate
)(const struct option_s
*option
,
96 void (*post_validate
)(const struct option_s
*option
);
101 #ifndef STRING_OPTION
102 #define STRING_OPTION(opt_name, opt_def_value, opt_other...) \
103 extern STRING * const opt_##opt_name
104 #endif /* STRING_OPTION */
107 #define BOOL_OPTION(opt_name, opt_def_value, opt_other...) \
108 extern BOOL * const opt_##opt_name
109 #endif /* BOOL_OPTION */
111 #ifndef NUMBER_OPTION
112 #define NUMBER_OPTION(opt_name, opt_def_value, opt_other...) \
113 extern NUMBER * const opt_##opt_name
114 #endif /* NUMBER_OPTION */
116 void set_string_option(STRING
* const var
, const STRING value
);
117 void append_string_option(STRING
* const var
, const STRING value
);
118 void set_options_to_defaults(void);
119 void post_validate_options(void);
121 char *alloc_real_status_logfile_name(void);
122 char *alloc_real_packages_directory_name(void);
123 char *alloc_real_stamp_directory_name(void);
126 * Setting option from RC file parser.
129 typedef enum set_opt_e
{
135 set_opt_e
set_yet_unknown_option(const char *opt
, const char *val
);
138 #endif /* H_OPTION_STRUCT_ */