version 1.44, 2019/05/12 18:16:33 |
version 1.45, 2019/05/23 11:13:30 |
|
|
{ |
{ |
struct options_array_item *a; |
struct options_array_item *a; |
char *new; |
char *new; |
struct cmd_list *cmdlist; |
struct cmd_parse_result *pr; |
char *error; |
|
|
|
if (!OPTIONS_IS_ARRAY(o)) { |
if (!OPTIONS_IS_ARRAY(o)) { |
if (cause != NULL) |
if (cause != NULL) |
|
|
} |
} |
|
|
if (OPTIONS_IS_COMMAND(o)) { |
if (OPTIONS_IS_COMMAND(o)) { |
cmdlist = cmd_string_parse(value, NULL, 0, &error); |
pr = cmd_parse_from_string(value, NULL); |
if (cmdlist == NULL && error != NULL) { |
switch (pr->status) { |
|
case CMD_PARSE_EMPTY: |
|
*cause = xstrdup("empty command"); |
|
return (-1); |
|
case CMD_PARSE_ERROR: |
if (cause != NULL) |
if (cause != NULL) |
*cause = error; |
*cause = pr->error; |
else |
else |
free(error); |
free(pr->error); |
return (-1); |
return (-1); |
|
case CMD_PARSE_SUCCESS: |
|
break; |
} |
} |
} |
} |
|
|
|
|
if (OPTIONS_IS_STRING(o)) |
if (OPTIONS_IS_STRING(o)) |
a->value.string = new; |
a->value.string = new; |
else if (OPTIONS_IS_COMMAND(o)) |
else if (OPTIONS_IS_COMMAND(o)) |
a->value.cmdlist = cmdlist; |
a->value.cmdlist = pr->cmdlist; |
return (0); |
return (0); |
} |
} |
|
|