提交 c2a19358 authored 作者: Moises Silva's avatar Moises Silva

skip initial space in switch console and API execution - resolve issue #778

上级 1c09adb3
...@@ -346,7 +346,7 @@ SWITCH_DECLARE(switch_status_t) switch_console_execute(char *xcmd, int rec, swit ...@@ -346,7 +346,7 @@ SWITCH_DECLARE(switch_status_t) switch_console_execute(char *xcmd, int rec, swit
int argc; int argc;
char *argv[128]; char *argv[128];
int x; int x;
char *dup = strdup(xcmd); char *dup = NULL;
char *cmd; char *cmd;
switch_status_t status = SWITCH_STATUS_FALSE; switch_status_t status = SWITCH_STATUS_FALSE;
...@@ -357,6 +357,12 @@ SWITCH_DECLARE(switch_status_t) switch_console_execute(char *xcmd, int rec, swit ...@@ -357,6 +357,12 @@ SWITCH_DECLARE(switch_status_t) switch_console_execute(char *xcmd, int rec, swit
goto end; goto end;
} }
while (xcmd && *xcmd == ' ') {
xcmd++;
}
dup = strdup(xcmd);
if (!strncasecmp(xcmd, "alias", 5)) { if (!strncasecmp(xcmd, "alias", 5)) {
argc = 1; argc = 1;
argv[0] = xcmd; argv[0] = xcmd;
......
...@@ -1789,6 +1789,10 @@ SWITCH_DECLARE(switch_status_t) switch_api_execute(const char *cmd, const char * ...@@ -1789,6 +1789,10 @@ SWITCH_DECLARE(switch_status_t) switch_api_execute(const char *cmd, const char *
switch_assert(stream->data != NULL); switch_assert(stream->data != NULL);
switch_assert(stream->write_function != NULL); switch_assert(stream->write_function != NULL);
while (cmd && *cmd == ' ') {
cmd++;
}
if (strcasecmp(cmd, "console_complete")) { if (strcasecmp(cmd, "console_complete")) {
cmd_used = switch_strip_whitespace(cmd); cmd_used = switch_strip_whitespace(cmd);
arg_used = switch_strip_whitespace(arg); arg_used = switch_strip_whitespace(arg);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论