aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-07-12 16:07:56 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-07-12 16:07:56 +0000
commit22355ce947da7acd8863d7f7a467324ad030faec (patch)
tree4f5a938c5136309ee24c945a133150632bc01942
parentbd098c273b6a8ac6a0d493194cacd2e231bbeefe (diff)
downloadrtmux-22355ce947da7acd8863d7f7a467324ad030faec.tar.gz
rtmux-22355ce947da7acd8863d7f7a467324ad030faec.tar.bz2
rtmux-22355ce947da7acd8863d7f7a467324ad030faec.zip
If it exist, load a system-wide configuration file /etc/tmux.conf before any
user-specified one.
-rw-r--r--server.c11
-rw-r--r--tmux.18
-rw-r--r--tmux.h3
3 files changed, 19 insertions, 3 deletions
diff --git a/server.c b/server.c
index 6ba83d87..e9986a72 100644
--- a/server.c
+++ b/server.c
@@ -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/tmux.1 b/tmux.1
index f0294ce1..588d70e4 100644
--- a/tmux.1
+++ b/tmux.1
@@ -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/tmux.h b/tmux.h
index 02f08ed4..d2409f62 100644
--- a/tmux.h
+++ b/tmux.h
@@ -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