Merge branch 'release-1.0beta-refresh' into cmake_build

This commit is contained in:
Markus Makela
2014-09-23 10:42:47 +03:00

View File

@ -108,15 +108,10 @@ char *hostname = "localhost";
char *port = "6603";
char *user = "admin";
char *passwd = NULL;
int so, cmdlen;
char *cmd;
int so;
int option_index = 0;
char c;
cmd = malloc(1);
*cmd = 0;
cmdlen = 1;
while ((c = getopt_long(argc, argv, "h:p:P:u:v?",
long_options, &option_index))
>= 0)
@ -180,13 +175,27 @@ char c;
exit(1);
}
if (cmdlen > 1)
{
cmd[cmdlen - 2] = '\0'; /* Remove trailing space */
if (optind < argc) {
int i, len = 0;
char *cmd;
for (i = optind; i < argc; i++) {
len += strlen(argv[i]) + 1;
}
cmd = malloc(len);
strcpy(cmd, argv[optind]);
for (i = optind +1; i < argc; i++) {
strcat(cmd, " ");
strcat(cmd, argv[i]);
}
if (access(cmd, R_OK) == 0)
DoSource(so, cmd);
else
sendCommand(so, cmd);
free(cmd);
exit(0);
}
@ -391,7 +400,7 @@ char buf[20];
* Send a comamnd using the MaxScaled protocol, display the return data
* on standard output.
*
* Input terminates with a lien containing jsut the text OK
* Input terminates with a lien containing just the text OK
*
* @param so The socket connect to MaxScale
* @param cmd The command to send
@ -401,7 +410,7 @@ static int
sendCommand(int so, char *cmd)
{
char buf[80];
int i, j, newline = 0;
int i, j, newline = 1;
write(so, cmd, strlen(cmd));
while (1)