mirror of
https://github.com/tmux/tmux.git
synced 2025-01-15 05:09:04 +00:00
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.
This commit is contained in:
parent
2e2e762743
commit
35b926c445
17
cfg.c
17
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>
|
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -51,7 +51,7 @@ cfg_error(unused struct cmd_ctx *ctx, const char *fmt, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
load_cfg(const char *path, char **cause)
|
load_cfg(const char *path, struct cmd_ctx *ctxin, char **cause)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
u_int n;
|
u_int n;
|
||||||
@ -87,15 +87,20 @@ load_cfg(const char *path, char **cause)
|
|||||||
continue;
|
continue;
|
||||||
cfg_cause = NULL;
|
cfg_cause = NULL;
|
||||||
|
|
||||||
ctx.msgdata = NULL;
|
if (ctxin == NULL) {
|
||||||
ctx.curclient = 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.error = cfg_error;
|
||||||
ctx.print = cfg_print;
|
ctx.print = cfg_print;
|
||||||
ctx.info = cfg_print;
|
ctx.info = cfg_print;
|
||||||
|
|
||||||
ctx.cmdclient = NULL;
|
|
||||||
|
|
||||||
cfg_cause = NULL;
|
cfg_cause = NULL;
|
||||||
cmd_list_exec(cmdlist, &ctx);
|
cmd_list_exec(cmdlist, &ctx);
|
||||||
cmd_list_free(cmdlist);
|
cmd_list_free(cmdlist);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: cmd-source-file.c,v 1.7 2009-07-28 22:12:16 tcunha Exp $ */
|
/* $Id: cmd-source-file.c,v 1.8 2009-08-24 16:27:03 tcunha Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2008 Tiago Cunha <me@tiagocunha.org>
|
* Copyright (c) 2008 Tiago Cunha <me@tiagocunha.org>
|
||||||
@ -90,7 +90,7 @@ cmd_source_file_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
struct cmd_source_file_data *data = self->data;
|
struct cmd_source_file_data *data = self->data;
|
||||||
char *cause;
|
char *cause;
|
||||||
|
|
||||||
if (load_cfg(data->path, &cause) != 0) {
|
if (load_cfg(data->path, ctx, &cause) != 0) {
|
||||||
ctx->error(ctx, "%s", cause);
|
ctx->error(ctx, "%s", cause);
|
||||||
xfree(cause);
|
xfree(cause);
|
||||||
return (-1);
|
return (-1);
|
||||||
|
6
server.c
6
server.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: server.c,v 1.174 2009-08-20 11:45:37 tcunha Exp $ */
|
/* $Id: server.c,v 1.175 2009-08-24 16:27:03 tcunha Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -191,9 +191,9 @@ server_start(char *path)
|
|||||||
&cause, "%s: %s", strerror(errno), SYSTEM_CFG);
|
&cause, "%s: %s", strerror(errno), SYSTEM_CFG);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
} else if (load_cfg(SYSTEM_CFG, &cause) != 0)
|
} else if (load_cfg(SYSTEM_CFG, NULL, &cause) != 0)
|
||||||
goto error;
|
goto error;
|
||||||
if (cfg_file != NULL && load_cfg(cfg_file, &cause) != 0)
|
if (cfg_file != NULL && load_cfg(cfg_file, NULL, &cause) != 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
exit(server_main(srv_fd));
|
exit(server_main(srv_fd));
|
||||||
|
4
tmux.h
4
tmux.h
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tmux.h,v 1.426 2009-08-24 16:24:18 tcunha Exp $ */
|
/* $Id: tmux.h,v 1.427 2009-08-24 16:27:03 tcunha Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -1107,7 +1107,7 @@ void sigreset(void);
|
|||||||
void sighandler(int);
|
void sighandler(int);
|
||||||
|
|
||||||
/* cfg.c */
|
/* cfg.c */
|
||||||
int load_cfg(const char *, char **x);
|
int load_cfg(const char *, struct cmd_ctx *, char **);
|
||||||
|
|
||||||
/* mode-key.c */
|
/* mode-key.c */
|
||||||
extern const struct mode_key_table mode_key_tables[];
|
extern const struct mode_key_table mode_key_tables[];
|
||||||
|
Loading…
Reference in New Issue
Block a user