version 1.29, 2019/05/12 18:16:33 |
version 1.30, 2019/05/23 11:13:30 |
|
|
const char *template, const char *name) |
const char *template, const char *name) |
{ |
{ |
struct cmdq_item *new_item; |
struct cmdq_item *new_item; |
struct cmd_list *cmdlist; |
char *command; |
char *command, *cause; |
struct cmd_parse_result *pr; |
|
|
command = cmd_template_replace(template, name, 1); |
command = cmd_template_replace(template, name, 1); |
if (command == NULL || *command == '\0') { |
if (command == NULL || *command == '\0') { |
|
|
return; |
return; |
} |
} |
|
|
cmdlist = cmd_string_parse(command, NULL, 0, &cause); |
pr = cmd_parse_from_string(command, NULL); |
if (cmdlist == NULL) { |
switch (pr->status) { |
if (cause != NULL && c != NULL) { |
case CMD_PARSE_EMPTY: |
*cause = toupper((u_char)*cause); |
break; |
status_message_set(c, "%s", cause); |
case CMD_PARSE_ERROR: |
|
if (c != NULL) { |
|
*pr->error = toupper((u_char)*pr->error); |
|
status_message_set(c, "%s", pr->error); |
} |
} |
free(cause); |
free(pr->error); |
} else { |
break; |
new_item = cmdq_get_command(cmdlist, fs, NULL, 0); |
case CMD_PARSE_SUCCESS: |
|
new_item = cmdq_get_command(pr->cmdlist, fs, NULL, 0); |
cmdq_append(c, new_item); |
cmdq_append(c, new_item); |
cmd_list_free(cmdlist); |
cmd_list_free(pr->cmdlist); |
|
break; |
} |
} |
|
|
free(command); |
free(command); |