From b496b1fe11b99614e407d02edb1a21905f384929 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 27 Oct 2014 22:23:47 +0000 Subject: Move cfg_causes local into cfg.c and remove struct causelist. --- cmd-source-file.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'cmd-source-file.c') diff --git a/cmd-source-file.c b/cmd-source-file.c index 8610d807..e5710a0c 100644 --- a/cmd-source-file.c +++ b/cmd-source-file.c @@ -28,7 +28,6 @@ enum cmd_retval cmd_source_file_exec(struct cmd *, struct cmd_q *); -void cmd_source_file_show(struct cmd_q *); void cmd_source_file_done(struct cmd_q *); const struct cmd_entry cmd_source_file_entry = { @@ -59,11 +58,12 @@ cmd_source_file_exec(struct cmd *self, struct cmd_q *cmdq) free(cause); return (CMD_RETURN_ERROR); } - ARRAY_ADD(&cfg_causes, cause); + cfg_add_cause("%s", cause); + free(cause); /* FALLTHROUGH */ case 0: if (cfg_references == 0) - cmd_source_file_show(cmdq); + cfg_print_causes(cmdq); cmdq_free(cmdq1); return (CMD_RETURN_NORMAL); } @@ -75,20 +75,6 @@ cmd_source_file_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_WAIT); } -void -cmd_source_file_show(struct cmd_q *cmdq) -{ - u_int i; - char *cause; - - for (i = 0; i < ARRAY_LENGTH(&cfg_causes); i++) { - cause = ARRAY_ITEM(&cfg_causes, i); - cmdq_print(cmdq, "%s", cause); - free(cause); - } - ARRAY_FREE(&cfg_causes); -} - void cmd_source_file_done(struct cmd_q *cmdq1) { @@ -105,6 +91,6 @@ cmd_source_file_done(struct cmd_q *cmdq1) return; if (cfg_references == 0) - cmd_source_file_show(cmdq); + cfg_print_causes(cmdq); cmdq_continue(cmdq); } -- cgit