diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-07-12 16:07:57 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-07-12 16:07:57 +0000 |
commit | 39af6e40b829b36363ca048341c7f623110f52d7 (patch) | |
tree | 7e141ecd8a71c7dc03fd99304392922a58ceea04 /usr.bin/tmux | |
parent | f5eb5c6775cc2f953525cc0ddff69e43fc1c43a5 (diff) |
If it exist, load a system-wide configuration file /etc/tmux.conf before any
user-specified one.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/server.c | 13 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.1 | 12 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 5 |
3 files changed, 23 insertions, 7 deletions
diff --git a/usr.bin/tmux/server.c b/usr.bin/tmux/server.c index 8112a9443d0..1c45e64e71b 100644 --- a/usr.bin/tmux/server.c +++ b/usr.bin/tmux/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.6 2009/07/07 19:49:19 nicm Exp $ */ +/* $OpenBSD: server.c,v 1.7 2009/07/12 16:07:56 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -171,6 +171,17 @@ server_start(char *path) start_time = time(NULL); socket_path = path; + if (access(SYSTEM_CFG, R_OK) != 0) { + if (errno != ENOENT) { + log_warn("%s", SYSTEM_CFG); + exit(1); + } + } else { + if (load_cfg(SYSTEM_CFG, &cause) != 0) { + log_warnx("%s", cause); + exit(1); + } + } if (cfg_file != NULL && load_cfg(cfg_file, &cause) != 0) { log_warnx("%s", cause); exit(1); diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index 8a3739030e3..d0824c74bb3 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.25 2009/07/11 20:04:19 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.26 2009/07/12 16:07:56 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: July 11 2009 $ +.Dd $Mdocdate: July 12 2009 $ .Dt TMUX 1 .Os .Sh NAME @@ -70,7 +70,9 @@ to assume the terminal supports default colours. Specify an alternative configuration file. By default, .Nm -will look for a config file at +loads the system configuration file from +.Pa /etc/tmux.conf , +if present, then looks for a user configuration file at .Pa ~/.tmux.conf . The configuration file is a set of .Nm @@ -1549,11 +1551,13 @@ not be linked to no sessions. Move up a pane. .El .Sh FILES -.Bl -tag -width "~/.tmux.confXXX" -compact +.Bl -tag -width "/etc/tmux.confXXX" -compact .It Pa ~/.tmux.conf Default .Nm configuration file. +.It Pa /etc/tmux.conf +System-wide configuration file. .El .Sh SEE ALSO .Xr pty 4 diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index f9d6babc0b1..c1703c8f6fc 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.21 2009/07/11 19:14:56 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.22 2009/07/12 16:07:56 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -40,8 +40,9 @@ extern const char *__progname; -/* Default configuration file. */ +/* Default configuration files. */ #define DEFAULT_CFG ".tmux.conf" +#define SYSTEM_CFG "/etc/tmux.conf" /* Default prompt history length. */ #define PROMPT_HISTORY 100 |