diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-08-23 17:29:51 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-08-23 17:29:51 +0000 |
commit | c7394ac4e0f7e6e034fbb4b050de6f713bb9f6e0 (patch) | |
tree | 5922399cc29cc65877260b5bfc36ba0b1cfafbc4 /cfg.c | |
parent | 43cd40e87a41d9504dcac99419c96e3cdbb81029 (diff) |
When using source-file, run the commands in the context of the source-file
command rather than with no context. This makes things like attach work from a
file.
Diffstat (limited to 'cfg.c')
-rw-r--r-- | cfg.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -51,7 +51,7 @@ cfg_error(unused struct cmd_ctx *ctx, const char *fmt, ...) } int -load_cfg(const char *path, char **cause) +load_cfg(const char *path, struct cmd_ctx *ctxin, char **cause) { FILE *f; u_int n; @@ -87,15 +87,20 @@ load_cfg(const char *path, char **cause) continue; cfg_cause = NULL; - ctx.msgdata = NULL; - ctx.curclient = NULL; + if (ctxin == NULL) { + ctx.msgdata = NULL; + ctx.curclient = NULL; + ctx.cmdclient = NULL; + } else { + ctx.msgdata = ctxin->msgdata; + ctx.curclient = ctxin->curclient; + ctx.cmdclient = ctxin->cmdclient; + } ctx.error = cfg_error; ctx.print = cfg_print; ctx.info = cfg_print; - ctx.cmdclient = NULL; - cfg_cause = NULL; cmd_list_exec(cmdlist, &ctx); cmd_list_free(cmdlist); |