Skip to content

Commit af9fca1

Browse files
stewart@flamingspork.comstewartsmith
stewart@flamingspork.com
authored andcommitted
[patch 16/64] WL4012 WL1744 (ndb on win32): part 1 ndb_opts---
storage/ndb/include/util/ndb_opts.h | 104 +++++++++++------------------------- 1 file changed, 34 insertions(+), 70 deletions(-) Index: storage/ndb/include/util/ndb_opts.h ===================================================================
1 parent 10b74a6 commit af9fca1

File tree

1 file changed

+33
-69
lines changed

1 file changed

+33
-69
lines changed

storage/ndb/include/util/ndb_opts.h

+33-69
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,36 @@
1616
#ifndef _NDB_OPTS_H
1717
#define _NDB_OPTS_H
1818

19+
#ifdef __cplusplus
20+
extern "C" {
21+
#endif
1922
#include <ndb_global.h>
2023
#include <my_sys.h>
2124
#include <my_getopt.h>
2225
#include <mysql_version.h>
2326
#include <ndb_version.h>
24-
#include <ndb_opt_defaults.h>
27+
#include <ndbapi/ndb_opt_defaults.h>
2528

26-
#define NDB_STD_OPTS_VARS \
27-
my_bool opt_ndb_optimized_node_selection
29+
#ifdef OPTEXPORT
30+
#define OPT_EXTERN(T,V,I) T V I
31+
#else
32+
#define OPT_EXTERN(T,V,I) extern T V
33+
#endif
2834

29-
int opt_ndb_nodeid;
30-
bool opt_endinfo= 0;
31-
my_bool opt_ndb_shm;
32-
my_bool opt_core;
33-
const char *opt_ndb_connectstring= 0;
34-
const char *opt_connect_str= 0;
35-
const char *opt_ndb_mgmd= 0;
36-
char opt_ndb_constrbuf[1024];
37-
unsigned opt_ndb_constrbuf_len= 0;
35+
#define NONE
36+
OPT_EXTERN(int,opt_ndb_nodeid,NONE);
37+
OPT_EXTERN(my_bool,opt_endinfo,=0);
38+
OPT_EXTERN(my_bool,opt_ndb_shm,NONE);
39+
OPT_EXTERN(my_bool,opt_core,NONE);
40+
OPT_EXTERN(my_bool,opt_ndb_optimized_node_selection,NONE);
41+
OPT_EXTERN(char *,opt_ndb_connectstring,=0);
42+
OPT_EXTERN(const char *,opt_connect_str,=0);
43+
OPT_EXTERN(const char *,opt_ndb_mgmd,=0);
44+
OPT_EXTERN(char,opt_ndb_constrbuf[1024],NONE);
45+
OPT_EXTERN(unsigned,opt_ndb_constrbuf_len,=0);
3846

3947
#ifndef DBUG_OFF
40-
const char *opt_debug= 0;
48+
OPT_EXTERN(const char *,opt_debug,= 0);
4149
#endif
4250

4351
#define OPT_NDB_CONNECTSTRING 'c'
@@ -98,11 +106,7 @@ const char *opt_debug= 0;
98106
#define NDB_STD_OPTS(prog_name) NDB_STD_OPTS_COMMON
99107
#endif
100108

101-
static void ndb_std_print_version()
102-
{
103-
printf("MySQL distrib %s, for %s (%s)\n",
104-
NDB_VERSION_STRING,SYSTEM_TYPE,MACHINE_TYPE);
105-
}
109+
void ndb_std_print_version();
106110

107111
static void usage();
108112

@@ -117,59 +121,19 @@ enum ndb_std_options {
117121
NDB_STD_OPTIONS_LAST /* should always be last in this enum */
118122
};
119123

120-
static my_bool
124+
my_bool
121125
ndb_std_get_one_option(int optid,
122126
const struct my_option *opt __attribute__((unused)),
123-
char *argument)
124-
{
125-
switch (optid) {
126-
#ifndef DBUG_OFF
127-
case '#':
128-
DBUG_SET_INITIAL(opt_debug ? opt_debug : "d:t");
129-
opt_endinfo= 1;
130-
break;
131-
#endif
132-
case 'V':
133-
ndb_std_print_version();
134-
exit(0);
135-
case '?':
136-
usage();
137-
exit(0);
138-
case OPT_NDB_SHM:
139-
if (opt_ndb_shm)
140-
{
141-
#ifndef NDB_SHM_TRANSPORTER
142-
printf("Warning: binary not compiled with shared memory support,\n"
143-
"Tcp connections will now be used instead\n");
144-
opt_ndb_shm= 0;
127+
char *argument);
128+
129+
void ndb_usage();
130+
void ndb_short_usage_sub();
131+
#ifdef PROVIDE_USAGE
132+
inline void usage(){ndb_usage();}
133+
inline void short_usage_sub(){ndb_short_usage_sub();}
145134
#endif
146-
}
147-
break;
148-
case OPT_NDB_MGMD:
149-
case OPT_NDB_NODEID:
150-
{
151-
int len= my_snprintf(opt_ndb_constrbuf+opt_ndb_constrbuf_len,
152-
sizeof(opt_ndb_constrbuf)-opt_ndb_constrbuf_len,
153-
"%s%s%s",opt_ndb_constrbuf_len > 0 ? ",":"",
154-
optid == OPT_NDB_NODEID ? "nodeid=" : "",
155-
argument);
156-
opt_ndb_constrbuf_len+= len;
157-
}
158-
/* fall through to add the connectstring to the end
159-
* and set opt_ndbcluster_connectstring
160-
*/
161-
case OPT_NDB_CONNECTSTRING:
162-
if (opt_ndb_connectstring && opt_ndb_connectstring[0])
163-
my_snprintf(opt_ndb_constrbuf+opt_ndb_constrbuf_len,
164-
sizeof(opt_ndb_constrbuf)-opt_ndb_constrbuf_len,
165-
"%s%s", opt_ndb_constrbuf_len > 0 ? ",":"",
166-
opt_ndb_connectstring);
167-
else
168-
opt_ndb_constrbuf[opt_ndb_constrbuf_len]= 0;
169-
opt_connect_str= opt_ndb_constrbuf;
170-
break;
171-
}
172-
return 0;
173-
}
174135

136+
#ifdef __cplusplus
137+
}
138+
#endif
175139
#endif /*_NDB_OPTS_H */

0 commit comments

Comments
 (0)