21 #include <ndb_global.h>
24 #include <my_getopt.h>
31 #define OPT_EXTERN(T,V,I) T V I
33 #define OPT_EXTERN(T,V,I) extern T V
37 OPT_EXTERN(
int,opt_ndb_nodeid,NONE);
38 OPT_EXTERN(my_bool,opt_ndb_endinfo,=0);
39 OPT_EXTERN(my_bool,opt_core,NONE);
40 OPT_EXTERN(my_bool,opt_ndb_optimized_node_selection,NONE);
41 OPT_EXTERN(
const char *,opt_ndb_connectstring,=0);
44 OPT_EXTERN(
const char *,opt_debug,= 0);
48 #define OPT_WANT_CORE_DEFAULT 1
50 #define OPT_WANT_CORE_DEFAULT 0
53 #define NDB_STD_OPTS_COMMON \
54 { "usage", '?', "Display this help and exit.", \
55 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \
56 { "help", '?', "Display this help and exit.", \
57 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \
58 { "version", 'V', "Output version information and exit.", 0, 0, 0, \
59 GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \
60 { "ndb-connectstring", OPT_NDB_CONNECTSTRING, \
61 "Set connect string for connecting to ndb_mgmd. " \
62 "Syntax: \"[nodeid=<id>;][host=]<hostname>[:<port>]\". " \
63 "Overrides specifying entries in NDB_CONNECTSTRING and my.cnf", \
64 (uchar**) &opt_ndb_connectstring, (uchar**) &opt_ndb_connectstring, \
65 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
66 { "ndb-mgmd-host", NDB_OPT_NOSHORT, \
67 "same as --ndb-connectstring", \
68 (uchar**) &opt_ndb_connectstring, (uchar**) &opt_ndb_connectstring, 0, \
69 GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
70 { "ndb-nodeid", NDB_OPT_NOSHORT, \
71 "Set node id for this node. Overrides node id specified " \
72 "in --ndb-connectstring.", \
73 (uchar**) &opt_ndb_nodeid, (uchar**) &opt_ndb_nodeid, 0, \
74 GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
75 {"ndb-optimized-node-selection", NDB_OPT_NOSHORT,\
76 "Select nodes for transactions in a more optimal way",\
77 (uchar**) &opt_ndb_optimized_node_selection,\
78 (uchar**) &opt_ndb_optimized_node_selection, 0,\
79 GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},\
80 { "connect-string", OPT_NDB_CONNECTSTRING, "same as --ndb-connectstring",\
81 (uchar**) &opt_ndb_connectstring, (uchar**) &opt_ndb_connectstring, \
82 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
83 { "core-file", NDB_OPT_NOSHORT, "Write core on errors.",\
84 (uchar**) &opt_core, (uchar**) &opt_core, 0,\
85 GET_BOOL, NO_ARG, OPT_WANT_CORE_DEFAULT, 0, 0, 0, 0, 0},\
86 {"character-sets-dir", NDB_OPT_NOSHORT,\
87 "Directory where character sets are.", (uchar**) &charsets_dir,\
88 (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}\
91 #define NDB_STD_OPTS(prog_name) \
92 { "debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", \
93 (uchar**) &opt_debug, (uchar**) &opt_debug, \
94 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0 }, \
97 #define NDB_STD_OPTS(prog_name) NDB_STD_OPTS_COMMON
100 void ndb_std_print_version();
102 enum ndb_std_options {
106 OPT_NDB_CONNECTSTRING =
'c',
112 NDB_OPT_NOSHORT = 256,
122 void ndb_opt_set_usage_funcs(
void (*short_usage)(
void),
123 void (*usage)(
void));
125 ndb_std_get_one_option(
int optid,
126 const struct my_option *opt __attribute__((unused)),
129 void ndb_usage(
void (*usagefunc)(
void),
const char *load_default_groups[],
131 void ndb_short_usage_sub(
const char*
extra);
133 my_bool ndb_is_load_default_arg_separator(
const char* arg);