From a15f8fc4a66420615d237313c6a01fcf532c52a2 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 18 Jan 2009 14:40:48 +0000 Subject: Support command sequences separated by " ; ". Also clean up command printing. --- cfg.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'cfg.c') diff --git a/cfg.c b/cfg.c index 44f516b7..7e38a0a6 100644 --- a/cfg.c +++ b/cfg.c @@ -1,4 +1,4 @@ -/* $Id: cfg.c,v 1.13 2008-07-25 17:20:40 nicm Exp $ */ +/* $Id: cfg.c,v 1.14 2009-01-18 14:40:48 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -53,12 +53,12 @@ cfg_error(unused struct cmd_ctx *ctx, const char *fmt, ...) int load_cfg(const char *path, char **cause) { - FILE *f; - u_int n; - char *buf, *line, *ptr; - size_t len; - struct cmd *cmd; - struct cmd_ctx ctx; + FILE *f; + u_int n; + char *buf, *line, *ptr; + size_t len; + struct cmd_list *cmdlist; + struct cmd_ctx ctx; if ((f = fopen(path, "rb")) == NULL) { xasprintf(cause, "%s: %s", path, strerror(errno)); @@ -78,12 +78,12 @@ load_cfg(const char *path, char **cause) } n++; - if (cmd_string_parse(buf, &cmd, cause) != 0) { + if (cmd_string_parse(buf, &cmdlist, cause) != 0) { if (*cause == NULL) continue; goto error; } - if (cmd == NULL) + if (cmdlist == NULL) continue; cfg_cause = NULL; @@ -98,8 +98,8 @@ load_cfg(const char *path, char **cause) ctx.cmdclient = NULL; cfg_cause = NULL; - cmd_exec(cmd, &ctx); - cmd_free(cmd); + cmd_list_exec(cmdlist, &ctx); + cmd_list_free(cmdlist); if (cfg_cause != NULL) { *cause = cfg_cause; goto error; -- cgit