aboutsummaryrefslogtreecommitdiff
path: root/cfg.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-08-24 16:27:03 +0000
committerTiago Cunha <tcunha@gmx.com>2009-08-24 16:27:03 +0000
commit35b926c4459df017cd9b08611a1b8e11e0eb425f (patch)
tree01a77a07d12b41c47bfb7082a54d4d9279c9f27a /cfg.c
parent2e2e762743417ae7a0c32a4b40909ecdf3bb3560 (diff)
downloadrtmux-35b926c4459df017cd9b08611a1b8e11e0eb425f.tar.gz
rtmux-35b926c4459df017cd9b08611a1b8e11e0eb425f.tar.bz2
rtmux-35b926c4459df017cd9b08611a1b8e11e0eb425f.zip
Sync OpenBSD patchset 290:
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.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/cfg.c b/cfg.c
index be3579ad..16179ac8 100644
--- a/cfg.c
+++ b/cfg.c
@@ -1,4 +1,4 @@
-/* $Id: cfg.c,v 1.21 2009-08-24 16:24:18 tcunha Exp $ */
+/* $Id: cfg.c,v 1.22 2009-08-24 16:27:03 tcunha Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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);