diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-01-18 14:40:48 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-01-18 14:40:48 +0000 |
commit | a15f8fc4a66420615d237313c6a01fcf532c52a2 (patch) | |
tree | 751d858639e20ae413ec907f7cf3215c06e3820d /cfg.c | |
parent | c4d5989a4ef03db0477446ee004ef431be268286 (diff) |
Support command sequences separated by " ; ". Also clean up command printing.
Diffstat (limited to 'cfg.c')
-rw-r--r-- | cfg.c | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -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 <nicm@users.sourceforge.net> @@ -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; |