summaryrefslogtreecommitdiff
path: root/ndb/src/mgmclient
diff options
context:
space:
mode:
authorunknown <joreland@mysql.com>2004-11-16 07:22:30 +0100
committerunknown <joreland@mysql.com>2004-11-16 07:22:30 +0100
commiteb05d78dcb8074a5dfceedf8c86681531fc3bfbe (patch)
tree39dc847742b930a3c542d1b3020b1463a0392371 /ndb/src/mgmclient
parent1f947d4ba8fb3870d9f5b2334a69c9ea5116ba69 (diff)
parent546e2d3192ed0b5745bf22cbc61f9aec44b426a8 (diff)
downloadmariadb-git-eb05d78dcb8074a5dfceedf8c86681531fc3bfbe.tar.gz
merge
configure.in: Auto merged ndb/src/Makefile.am: Auto merged ndb/src/common/mgmcommon/Makefile.am: Auto merged ndb/src/common/portlib/Makefile.am: Auto merged ndb/src/common/portlib/NdbConfig.c: Auto merged ndb/src/common/transporter/TransporterRegistry.cpp: Auto merged ndb/src/kernel/blocks/backup/Makefile.am: Auto merged ndb/src/mgmapi/Makefile.am: Auto merged ndb/src/mgmclient/Makefile.am: Auto merged ndb/tools/Makefile.am: Auto merged
Diffstat (limited to 'ndb/src/mgmclient')
-rw-r--r--ndb/src/mgmclient/CommandInterpreter.cpp8
-rw-r--r--ndb/src/mgmclient/Makefile.am11
-rw-r--r--ndb/src/mgmclient/main.cpp30
3 files changed, 23 insertions, 26 deletions
diff --git a/ndb/src/mgmclient/CommandInterpreter.cpp b/ndb/src/mgmclient/CommandInterpreter.cpp
index fde4e5a2e91..d940f6e165a 100644
--- a/ndb/src/mgmclient/CommandInterpreter.cpp
+++ b/ndb/src/mgmclient/CommandInterpreter.cpp
@@ -384,8 +384,10 @@ CommandInterpreter::CommandInterpreter(const char *_host)
connected = false;
try_reconnect = 0;
-
- host = my_strdup(_host,MYF(MY_WME));
+ if (_host)
+ host= my_strdup(_host,MYF(MY_WME));
+ else
+ host= 0;
#ifdef HAVE_GLOBAL_REPLICATION
rep_host = NULL;
m_repserver = NULL;
@@ -400,7 +402,7 @@ CommandInterpreter::~CommandInterpreter()
{
connected = false;
ndb_mgm_destroy_handle(&m_mgmsrv);
- my_free((char *)host,MYF(0));
+ my_free((char *)host,MYF(MY_ALLOW_ZERO_PTR));
host = NULL;
}
diff --git a/ndb/src/mgmclient/Makefile.am b/ndb/src/mgmclient/Makefile.am
index e4242b4cd80..c63e8d1bff8 100644
--- a/ndb/src/mgmclient/Makefile.am
+++ b/ndb/src/mgmclient/Makefile.am
@@ -3,17 +3,24 @@ noinst_LTLIBRARIES = libndbmgmclient.la
ndbtools_PROGRAMS = ndb_mgm
libndbmgmclient_la_SOURCES = CommandInterpreter.cpp
+libndbmgmclient_la_LIBADD = ../mgmapi/libmgmapi.la \
+ ../common/logger/liblogger.la \
+ ../common/portlib/libportlib.la \
+ ../common/util/libgeneral.la \
+ ../common/portlib/libportlib.la
+
ndb_mgm_SOURCES = main.cpp
include $(top_srcdir)/ndb/config/common.mk.am
include $(top_srcdir)/ndb/config/type_ndbapi.mk.am
-INCLUDES += -I$(top_srcdir)/ndb/include/mgmapi -I$(top_srcdir)/ndb/src/common/mgmcommon
+INCLUDES += -I$(top_srcdir)/ndb/include/mgmapi \
+ -I$(top_srcdir)/ndb/src/common/mgmcommon
LDADD_LOC = $(noinst_LTLIBRARIES) \
+ ../common/portlib/libportlib.la \
@readline_link@ \
- $(top_builddir)/ndb/src/libndbclient.la \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a \
diff --git a/ndb/src/mgmclient/main.cpp b/ndb/src/mgmclient/main.cpp
index 8f5d9e6656c..401a9198f30 100644
--- a/ndb/src/mgmclient/main.cpp
+++ b/ndb/src/mgmclient/main.cpp
@@ -145,33 +145,21 @@ int main(int argc, char** argv){
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)))
exit(ho_error);
- LocalConfig cfg;
-
- if(argc >= 1) {
- _host = argv[0];
- if(argc >= 2) {
- _port = atoi(argv[1]);
- }
- } else {
- if(cfg.init(opt_connect_str, 0) && cfg.ids.size() > 0 && cfg.ids[0].type == MgmId_TCP){
- _host = cfg.ids[0].name.c_str();
- _port = cfg.ids[0].port;
- } else {
- cfg.printError();
- cfg.printUsage();
- return 1;
- }
- }
-
char buf[MAXHOSTNAMELEN+10];
- BaseString::snprintf(buf, sizeof(buf), "%s:%d", _host, _port);
+ if(argc == 1) {
+ BaseString::snprintf(buf, sizeof(buf), "%s", argv[0]);
+ opt_connect_str= buf;
+ } else if (argc >= 2) {
+ BaseString::snprintf(buf, sizeof(buf), "%s:%s", argv[0], argv[1]);
+ opt_connect_str= buf;
+ }
ndbout << "-- NDB Cluster -- Management Client --" << endl;
- printf("Connecting to Management Server: %s\n", buf);
+ printf("Connecting to Management Server: %s\n", opt_connect_str ? opt_connect_str : "default");
signal(SIGPIPE, handler);
- com = new Ndb_mgmclient(buf);
+ com = new Ndb_mgmclient(opt_connect_str);
while(read_and_execute(_try_reconnect));
delete com;