~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/my_getopt.h

pandora-build v0.100 - Fixes several bugs found by cb1kenobi. Add several thoughts from folks at LCA.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
   along with this program; if not, write to the Free Software
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
 
#ifndef _my_getopt_h
17
 
#define _my_getopt_h
 
16
#ifndef DRIZZLED_MY_GETOPT_H
 
17
#define DRIZZLED_MY_GETOPT_H
18
18
 
19
 
C_MODE_START
 
19
#include "drizzled/typelib.h"
20
20
 
21
21
#define GET_NO_ARG     1
22
22
#define GET_BOOL       2
23
23
#define GET_INT        3
24
24
#define GET_UINT       4
25
25
#define GET_LONG       5
26
 
#define GET_ULONG      6
 
26
#define GET_UINT32     6
27
27
#define GET_LL         7
28
28
#define GET_ULL        8
29
29
#define GET_STR        9
32
32
#define GET_ENUM      12
33
33
#define GET_SET       13
34
34
#define GET_DOUBLE    14
 
35
#define GET_SIZE      15
 
36
#define GET_UINT64    16
 
37
#define GET_ULONG_IS_FAIL 17
35
38
 
36
39
#define GET_ASK_ADDR     128
37
40
#define GET_TYPE_MASK    127
38
41
 
39
 
#include <mysys/my_sys.h>
 
42
 
 
43
#ifdef __cplusplus
 
44
extern "C" {
 
45
#endif
 
46
 
 
47
enum loglevel {
 
48
   ERROR_LEVEL,
 
49
   WARNING_LEVEL,
 
50
   INFORMATION_LEVEL
 
51
};
40
52
 
41
53
enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG };
42
54
 
62
74
 
63
75
typedef bool (* my_get_one_option) (int, const struct my_option *, char * );
64
76
typedef void (* my_error_reporter) (enum loglevel level, const char *format, ... );
 
77
typedef char ** (*getopt_get_addr_func)(const char *, uint32_t, const struct my_option *);
65
78
 
66
79
extern char *disabled_my_option;
67
 
extern bool my_getopt_print_errors;
68
80
extern bool my_getopt_skip_unknown;
69
81
extern my_error_reporter my_getopt_error_reporter;
70
82
 
71
 
extern int handle_options (int *argc, char ***argv, 
 
83
extern int handle_options (int *argc, char ***argv,
72
84
                           const struct my_option *longopts, my_get_one_option);
73
85
extern void my_cleanup_options(const struct my_option *options);
74
86
extern void my_print_help(const struct my_option *options);
75
87
extern void my_print_variables(const struct my_option *options);
76
 
extern void my_getopt_register_get_addr(char ** (*func_addr)(const char *, uint,
77
 
                                                             const struct my_option *));
78
88
 
79
89
uint64_t getopt_ull_limit_value(uint64_t num, const struct my_option *optp,
80
90
                                 bool *fix);
81
91
int64_t getopt_ll_limit_value(int64_t, const struct my_option *,
82
92
                               bool *fix);
83
 
bool getopt_compare_strings(const char *s, const char *t, uint length);
84
 
 
85
 
C_MODE_END
86
 
 
87
 
#endif /* _my_getopt_h */
 
93
bool getopt_compare_strings(const char *s, const char *t, uint32_t length);
 
94
 
 
95
#ifdef __cplusplus
 
96
}
 
97
#endif
 
98
 
 
99
#endif /* DRIZZLED_MY_GETOPT_H */
88
100