~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to include/my_getopt.h

  • Committer: Brian Aker
  • Date: 2008-06-30 18:52:15 UTC
  • Revision ID: brian@tangent.org-20080630185215-n0fr4k0gk5hk785c
Remove dead position (should be in config/)

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
#ifndef _my_getopt_h
17
17
#define _my_getopt_h
18
18
 
 
19
C_MODE_START
 
20
 
19
21
#define GET_NO_ARG     1
20
22
#define GET_BOOL       2
21
23
#define GET_INT        3
34
36
#define GET_ASK_ADDR     128
35
37
#define GET_TYPE_MASK    127
36
38
 
37
 
#ifdef __cplusplus
38
 
extern "C" {
39
 
#endif
40
 
 
41
 
#include <mysys/my_sys.h>
42
 
 
43
39
enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG };
44
40
 
45
41
struct st_typelib;
49
45
  const char *name;                     /* Name of the option */
50
46
  int        id;                        /* unique id or short option */
51
47
  const char *comment;                  /* option comment, for autom. --help */
52
 
  char      **value;                   /* The variable value */
53
 
  char      **u_max_value;             /* The user def. max variable value */
 
48
  uchar      **value;                   /* The variable value */
 
49
  uchar      **u_max_value;             /* The user def. max variable value */
54
50
  struct st_typelib *typelib;           /* Pointer to possible values */
55
 
  uint32_t     var_type;
 
51
  ulong     var_type;
56
52
  enum get_opt_arg_type arg_type;
57
 
  int64_t   def_value;                 /* Default value */
58
 
  int64_t   min_value;                 /* Min allowed value */
59
 
  int64_t   max_value;                 /* Max allowed value */
60
 
  int64_t   sub_size;                  /* Subtract this from given value */
 
53
  longlong   def_value;                 /* Default value */
 
54
  longlong   min_value;                 /* Min allowed value */
 
55
  longlong   max_value;                 /* Max allowed value */
 
56
  longlong   sub_size;                  /* Subtract this from given value */
61
57
  long       block_size;                /* Value should be a mult. of this */
62
58
  void       *app_type;                 /* To be used by an application */
63
59
};
64
60
 
65
 
typedef bool (* my_get_one_option) (int, const struct my_option *, char * );
 
61
typedef my_bool (* my_get_one_option) (int, const struct my_option *, char * );
66
62
typedef void (* my_error_reporter) (enum loglevel level, const char *format, ... );
67
63
 
68
64
extern char *disabled_my_option;
69
 
extern bool my_getopt_print_errors;
70
 
extern bool my_getopt_skip_unknown;
 
65
extern my_bool my_getopt_print_errors;
 
66
extern my_bool my_getopt_skip_unknown;
71
67
extern my_error_reporter my_getopt_error_reporter;
72
68
 
73
69
extern int handle_options (int *argc, char ***argv, 
75
71
extern void my_cleanup_options(const struct my_option *options);
76
72
extern void my_print_help(const struct my_option *options);
77
73
extern void my_print_variables(const struct my_option *options);
78
 
extern void my_getopt_register_get_addr(char ** (*func_addr)(const char *, uint,
79
 
                                                             const struct my_option *));
80
 
 
81
 
uint64_t getopt_ull_limit_value(uint64_t num, const struct my_option *optp,
82
 
                                 bool *fix);
83
 
int64_t getopt_ll_limit_value(int64_t, const struct my_option *,
84
 
                               bool *fix);
85
 
bool getopt_compare_strings(const char *s, const char *t, uint32_t length);
86
 
 
87
 
#ifdef __cplusplus
88
 
}
89
 
#endif
 
74
extern void my_getopt_register_get_addr(uchar ** (*func_addr)(const char *, uint,
 
75
                                                           const struct my_option *));
 
76
 
 
77
ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp,
 
78
                                 my_bool *fix);
 
79
longlong getopt_ll_limit_value(longlong, const struct my_option *,
 
80
                               my_bool *fix);
 
81
my_bool getopt_compare_strings(const char *s, const char *t, uint length);
 
82
 
 
83
C_MODE_END
90
84
 
91
85
#endif /* _my_getopt_h */
92
86