MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
my_getopt.h
1 /*
2  Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; version 2 of the License.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
16 
17 #ifndef _my_getopt_h
18 #define _my_getopt_h
19 
20 #include "my_sys.h" /* loglevel */
21 
22 C_MODE_START
23 
24 #define GET_NO_ARG 1
25 #define GET_BOOL 2
26 #define GET_INT 3
27 #define GET_UINT 4
28 #define GET_LONG 5
29 #define GET_ULONG 6
30 #define GET_LL 7
31 #define GET_ULL 8
32 #define GET_STR 9
33 #define GET_STR_ALLOC 10
34 #define GET_DISABLED 11
35 #define GET_ENUM 12
36 #define GET_SET 13
37 #define GET_DOUBLE 14
38 #define GET_FLAGSET 15
39 #define GET_PASSWORD 16
40 
41 #define GET_ASK_ADDR 128
42 #define GET_TYPE_MASK 127
43 
51 enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG };
52 
53 struct st_typelib;
54 
55 struct my_option
56 {
57  const char *name;
61  int id;
76  const char *comment;
80  void *value;
81  void *u_max_value;
82  struct st_typelib *typelib;
83  ulong var_type;
84  enum get_opt_arg_type arg_type;
85  longlong def_value;
86  longlong min_value;
87  ulonglong max_value;
88  longlong sub_size;
89  long block_size;
90  void *app_type;
91 };
92 
93 
94 typedef my_bool (*my_get_one_option)(int, const struct my_option *, char *);
101 typedef void *(*my_getopt_value)(const char *, uint, const struct my_option *,
102  int *);
103 
104 
105 extern char *disabled_my_option;
106 extern my_bool my_getopt_print_errors;
107 extern my_bool my_getopt_skip_unknown;
108 extern my_error_reporter my_getopt_error_reporter;
109 
110 extern int handle_options (int *argc, char ***argv,
111  const struct my_option *longopts, my_get_one_option);
112 extern int my_handle_options (int *argc, char ***argv,
113  const struct my_option *longopts,
114  my_get_one_option,
115  const char **command_list);
116 extern void my_cleanup_options(const struct my_option *options);
117 extern void my_cleanup_options(const struct my_option *options);
118 extern void my_print_help(const struct my_option *options);
119 extern void my_print_variables(const struct my_option *options);
120 extern void my_getopt_register_get_addr(my_getopt_value);
121 
122 ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp,
123  my_bool *fix);
124 longlong getopt_ll_limit_value(longlong, const struct my_option *,
125  my_bool *fix);
126 double getopt_double_limit_value(double num, const struct my_option *optp,
127  my_bool *fix);
128 my_bool getopt_compare_strings(const char *s, const char *t, uint length);
129 ulonglong max_of_int_range(int var_type);
130 
131 ulonglong getopt_double2ulonglong(double);
132 double getopt_ulonglong2double(ulonglong);
133 
134 C_MODE_END
135 
136 #endif /* _my_getopt_h */
137