version 1.49, 2016/10/16 17:55:14 |
version 1.50, 2016/10/16 19:04:05 |
|
|
struct client *cfg_client; |
struct client *cfg_client; |
|
|
static enum cmd_retval |
static enum cmd_retval |
cfg_done(__unused struct cmd_q *cmdq, __unused void *data) |
cfg_done(__unused struct cmdq_item *item, __unused void *data) |
{ |
{ |
if (cfg_finished) |
if (cfg_finished) |
return (CMD_RETURN_NORMAL); |
return (CMD_RETURN_NORMAL); |
|
|
} |
} |
|
|
int |
int |
load_cfg(const char *path, struct client *c, struct cmd_q *cmdq, int quiet) |
load_cfg(const char *path, struct client *c, struct cmdq_item *item, int quiet) |
{ |
{ |
FILE *f; |
FILE *f; |
char delim[3] = { '\\', '\\', '\0' }; |
char delim[3] = { '\\', '\\', '\0' }; |
u_int found; |
u_int found; |
size_t line = 0; |
size_t line = 0; |
char *buf, *cause1, *p; |
char *buf, *cause1, *p; |
struct cmd_list *cmdlist; |
struct cmd_list *cmdlist; |
struct cmd_q *new_cmdq; |
struct cmdq_item *new_item; |
|
|
log_debug("loading %s", path); |
log_debug("loading %s", path); |
if ((f = fopen(path, "rb")) == NULL) { |
if ((f = fopen(path, "rb")) == NULL) { |
|
|
|
|
if (cmdlist == NULL) |
if (cmdlist == NULL) |
continue; |
continue; |
new_cmdq = cmdq_get_command(cmdlist, NULL, NULL, 0); |
new_item = cmdq_get_command(cmdlist, NULL, NULL, 0); |
if (cmdq != NULL) |
if (item != NULL) |
cmdq_insert_after(cmdq, new_cmdq); |
cmdq_insert_after(item, new_item); |
else |
else |
cmdq_append(c, new_cmdq); |
cmdq_append(c, new_item); |
cmd_list_free(cmdlist); |
cmd_list_free(cmdlist); |
|
|
found++; |
found++; |
|
|
} |
} |
|
|
void |
void |
cfg_print_causes(struct cmd_q *cmdq) |
cfg_print_causes(struct cmdq_item *item) |
{ |
{ |
u_int i; |
u_int i; |
|
|
for (i = 0; i < cfg_ncauses; i++) { |
for (i = 0; i < cfg_ncauses; i++) { |
cmdq_print(cmdq, "%s", cfg_causes[i]); |
cmdq_print(item, "%s", cfg_causes[i]); |
free(cfg_causes[i]); |
free(cfg_causes[i]); |
} |
} |
|
|