If it exist, load a system-wide configuration file /etc/tmux.conf before any

user-specified one.
pull/1/head
Nicholas Marriott 2009-07-12 16:07:56 +00:00
parent bd098c273b
commit 22355ce947
3 changed files with 19 additions and 3 deletions

View File

@ -171,6 +171,17 @@ server_start(char *path)
start_time = time(NULL); start_time = time(NULL);
socket_path = path; 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) { if (cfg_file != NULL && load_cfg(cfg_file, &cause) != 0) {
log_warnx("%s", cause); log_warnx("%s", cause);
exit(1); exit(1);

8
tmux.1
View File

@ -70,7 +70,9 @@ to assume the terminal supports default colours.
Specify an alternative configuration file. Specify an alternative configuration file.
By default, By default,
.Nm .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 . .Pa ~/.tmux.conf .
The configuration file is a set of The configuration file is a set of
.Nm .Nm
@ -1549,11 +1551,13 @@ not be linked to no sessions.
Move up a pane. Move up a pane.
.El .El
.Sh FILES .Sh FILES
.Bl -tag -width "~/.tmux.confXXX" -compact .Bl -tag -width "/etc/tmux.confXXX" -compact
.It Pa ~/.tmux.conf .It Pa ~/.tmux.conf
Default Default
.Nm .Nm
configuration file. configuration file.
.It Pa /etc/tmux.conf
System-wide configuration file.
.El .El
.Sh SEE ALSO .Sh SEE ALSO
.Xr pty 4 .Xr pty 4

3
tmux.h
View File

@ -40,8 +40,9 @@
extern const char *__progname; extern const char *__progname;
/* Default configuration file. */ /* Default configuration files. */
#define DEFAULT_CFG ".tmux.conf" #define DEFAULT_CFG ".tmux.conf"
#define SYSTEM_CFG "/etc/tmux.conf"
/* Default prompt history length. */ /* Default prompt history length. */
#define PROMPT_HISTORY 100 #define PROMPT_HISTORY 100