1/* Copyright (C) 2013 Monty Program Ab
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; version 2 of the License.
6
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
11
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
15
16/* Definitions for mysys/my_default.c */
17
18#ifndef MY_DEFAULT_INCLUDED
19#define MY_DEFAULT_INCLUDED
20
21C_MODE_START
22
23extern const char *my_defaults_extra_file;
24extern const char *my_defaults_group_suffix;
25extern const char *my_defaults_file;
26extern my_bool my_getopt_use_args_separator;
27extern my_bool my_getopt_is_args_separator(const char* arg);
28
29/* Define the type of function to be passed to process_default_option_files */
30typedef int (*Process_option_func)(void *ctx, const char *group_name,
31 const char *option);
32
33extern int get_defaults_options(int argc, char **argv,
34 char **defaults, char **extra_defaults,
35 char **group_suffix);
36extern int my_load_defaults(const char *conf_file, const char **groups,
37 int *argc, char ***argv, const char ***);
38extern int load_defaults(const char *conf_file, const char **groups,
39 int *argc, char ***argv);
40extern int my_search_option_files(const char *conf_file, int *argc,
41 char ***argv, uint *args_used,
42 Process_option_func func, void *func_ctx,
43 const char **default_directories);
44extern void free_defaults(char **argv);
45extern void my_print_default_files(const char *conf_file);
46extern void print_defaults(const char *conf_file, const char **groups);
47
48
49/** Simplify load_defaults() common use */
50#define load_defaults_or_exit(A, B, C, D) switch (load_defaults(A, B, C, D)) { \
51 case 0: break; \
52 case 4: my_end(0); exit(0); \
53 default: my_end(0); exit(1); }
54
55C_MODE_END
56
57#endif /* MY_DEFAULT_INCLUDED */
58