MaxAdmin defaults to Emacs-mode and other small changes
1. MaxAdmin now defaults to Emacs-mode. To activate Vim-mode, give the option 'i' when starting. 2. "history" and "source"-commands are parsed correctly. 3. Added a check to DoSource() so that empty commands are not sent. MaxScale doesn't respond to empty commands which would cause MaxAdmin to wait forever.
This commit is contained in:
@ -101,6 +101,7 @@ static struct option long_options[] =
|
|||||||
{"version", no_argument, 0, 'v'},
|
{"version", no_argument, 0, 'v'},
|
||||||
{"help", no_argument, 0, '?'},
|
{"help", no_argument, 0, '?'},
|
||||||
{"emacs", no_argument, 0, 'e'},
|
{"emacs", no_argument, 0, 'e'},
|
||||||
|
{"vim", no_argument, 0, 'i'},
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -132,7 +133,7 @@ main(int argc, char **argv)
|
|||||||
char *user = NULL;
|
char *user = NULL;
|
||||||
char *passwd = NULL;
|
char *passwd = NULL;
|
||||||
char *socket_path = NULL;
|
char *socket_path = NULL;
|
||||||
int use_emacs = 0;
|
int use_emacs = 1;
|
||||||
|
|
||||||
read_inifile(&socket_path, &hostname, &port, &user, &passwd, &use_emacs);
|
read_inifile(&socket_path, &hostname, &port, &user, &passwd, &use_emacs);
|
||||||
|
|
||||||
@ -141,7 +142,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
char c;
|
char c;
|
||||||
while ((c = getopt_long(argc, argv, "h:p::P:u:S:v?e",
|
while ((c = getopt_long(argc, argv, "h:p::P:u:S:v?ei",
|
||||||
long_options, &option_index)) >= 0)
|
long_options, &option_index)) >= 0)
|
||||||
{
|
{
|
||||||
switch (c)
|
switch (c)
|
||||||
@ -184,6 +185,10 @@ main(int argc, char **argv)
|
|||||||
use_emacs = 1;
|
use_emacs = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'i':
|
||||||
|
use_emacs = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
case '?':
|
case '?':
|
||||||
DoUsage(argv[0]);
|
DoUsage(argv[0]);
|
||||||
exit(optopt ? EXIT_FAILURE : EXIT_SUCCESS);
|
exit(optopt ? EXIT_FAILURE : EXIT_SUCCESS);
|
||||||
@ -358,7 +363,6 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HISTORY
|
#ifdef HISTORY
|
||||||
el_line(el);
|
|
||||||
history(hist, &ev, H_ENTER, buf);
|
history(hist, &ev, H_ENTER, buf);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -767,7 +771,7 @@ DoSource(int so, char *file)
|
|||||||
pe--;
|
pe--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*ptr != '#') /* Comment */
|
if (*ptr != '#' && *ptr != '\0') /* Comment or empty */
|
||||||
{
|
{
|
||||||
if (!sendCommand(so, ptr))
|
if (!sendCommand(so, ptr))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user