diff options
Diffstat (limited to 'ndb/src/mgmclient/main.cpp')
-rw-r--r-- | ndb/src/mgmclient/main.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/ndb/src/mgmclient/main.cpp b/ndb/src/mgmclient/main.cpp index f32cc683296..08d5d60cfab 100644 --- a/ndb/src/mgmclient/main.cpp +++ b/ndb/src/mgmclient/main.cpp @@ -56,17 +56,18 @@ handler(int sig){ } } - +static const char default_prompt[]= "ndb_mgm> "; static unsigned _try_reconnect; static char *opt_connect_str= 0; +static const char *prompt= default_prompt; static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_mgm"), { "try-reconnect", 't', - "Specify number of retries for connecting to ndb_mgmd, default infinite", + "Specify number of tries for connecting to ndb_mgmd (0 = infinite)", (gptr*) &_try_reconnect, (gptr*) &_try_reconnect, 0, - GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, + GET_UINT, REQUIRED_ARG, 3, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; static void short_usage_sub(void) @@ -116,13 +117,13 @@ read_and_execute(int _try_reconnect) } #ifdef HAVE_READLINE /* Get a line from the user. */ - line_read = readline ("ndb_mgm> "); + line_read = readline (prompt); /* If the line has any text in it, save it on the history. */ if (line_read && *line_read) add_history (line_read); #else static char linebuffer[254]; - fputs("ndb_mgm> ", stdout); + fputs(prompt, stdout); linebuffer[sizeof(linebuffer)-1]=0; line_read = fgets(linebuffer, sizeof(linebuffer)-1, stdin); if (line_read == linebuffer) { @@ -155,12 +156,16 @@ int main(int argc, char** argv){ opt_connect_str= buf; } + if (!isatty(0)) + { + prompt= 0; + } + ndbout << "-- NDB Cluster -- Management Client --" << endl; - printf("Connecting to Management Server: %s\n", opt_connect_str ? opt_connect_str : "default"); signal(SIGPIPE, handler); - com = new Ndb_mgmclient(opt_connect_str); + com = new Ndb_mgmclient(opt_connect_str,1); while(read_and_execute(_try_reconnect)); delete com; |