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 | |
21 | C_MODE_START |
22 | |
23 | extern const char *; |
24 | extern const char *my_defaults_group_suffix; |
25 | extern const char *my_defaults_file; |
26 | extern my_bool my_getopt_use_args_separator; |
27 | extern 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 */ |
30 | typedef int (*Process_option_func)(void *ctx, const char *group_name, |
31 | const char *option); |
32 | |
33 | extern int get_defaults_options(int argc, char **argv, |
34 | char **defaults, char **, |
35 | char **group_suffix); |
36 | extern int my_load_defaults(const char *conf_file, const char **groups, |
37 | int *argc, char ***argv, const char ***); |
38 | extern int load_defaults(const char *conf_file, const char **groups, |
39 | int *argc, char ***argv); |
40 | extern 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); |
44 | extern void free_defaults(char **argv); |
45 | extern void my_print_default_files(const char *conf_file); |
46 | extern 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 | |
55 | C_MODE_END |
56 | |
57 | #endif /* MY_DEFAULT_INCLUDED */ |
58 | |