mirror of
https://github.com/tmate-io/tmate.git
synced 2025-06-07 18:26:49 +02:00
parent
0d182e707e
commit
ed4020b589
6
server.c
6
server.c
@ -186,6 +186,12 @@ server_start(int lockfd, char *lockfile)
|
|||||||
ARRAY_ADD(&cfg_causes, cause);
|
ARRAY_ADD(&cfg_causes, cause);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (tmate_cfg_file != NULL) {
|
||||||
|
if (load_cfg(tmate_cfg_file, cfg_cmd_q, &cause) == -1) {
|
||||||
|
xasprintf(&cause, "%s: %s", tmate_cfg_file, cause);
|
||||||
|
ARRAY_ADD(&cfg_causes, cause);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tmate_session_init();
|
tmate_session_init();
|
||||||
cmdq_continue(cfg_cmd_q);
|
cmdq_continue(cfg_cmd_q);
|
||||||
|
21
tmux.c
21
tmux.c
@ -40,7 +40,7 @@ struct environ global_environ;
|
|||||||
|
|
||||||
struct event_base *ev_base;
|
struct event_base *ev_base;
|
||||||
|
|
||||||
char *cfg_file;
|
char *cfg_file, *tmate_cfg_file;
|
||||||
char *shell_cmd;
|
char *shell_cmd;
|
||||||
int debug_level;
|
int debug_level;
|
||||||
time_t start_time;
|
time_t start_time;
|
||||||
@ -367,13 +367,14 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Locate the configuration file. */
|
/* Locate the configuration file. */
|
||||||
|
home = getenv("HOME");
|
||||||
|
if (home == NULL || *home == '\0') {
|
||||||
|
pw = getpwuid(getuid());
|
||||||
|
if (pw != NULL)
|
||||||
|
home = pw->pw_dir;
|
||||||
|
}
|
||||||
|
|
||||||
if (cfg_file == NULL) {
|
if (cfg_file == NULL) {
|
||||||
home = getenv("HOME");
|
|
||||||
if (home == NULL || *home == '\0') {
|
|
||||||
pw = getpwuid(getuid());
|
|
||||||
if (pw != NULL)
|
|
||||||
home = pw->pw_dir;
|
|
||||||
}
|
|
||||||
xasprintf(&cfg_file, "%s/%s", home, DEFAULT_CFG);
|
xasprintf(&cfg_file, "%s/%s", home, DEFAULT_CFG);
|
||||||
if (access(cfg_file, R_OK) != 0 && errno == ENOENT) {
|
if (access(cfg_file, R_OK) != 0 && errno == ENOENT) {
|
||||||
free(cfg_file);
|
free(cfg_file);
|
||||||
@ -381,6 +382,12 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xasprintf(&tmate_cfg_file, "%s/%s", home, DEFAULT_TMATE_CFG);
|
||||||
|
if (access(tmate_cfg_file, R_OK) != 0 && errno == ENOENT) {
|
||||||
|
free(tmate_cfg_file);
|
||||||
|
tmate_cfg_file = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Figure out the socket path. If specified on the command-line with -S
|
* Figure out the socket path. If specified on the command-line with -S
|
||||||
* or -L, use it, otherwise try $TMUX or assume -L default.
|
* or -L, use it, otherwise try $TMUX or assume -L default.
|
||||||
|
3
tmux.h
3
tmux.h
@ -43,6 +43,7 @@ extern char **environ;
|
|||||||
|
|
||||||
/* Default configuration files. */
|
/* Default configuration files. */
|
||||||
#define DEFAULT_CFG ".tmux.conf"
|
#define DEFAULT_CFG ".tmux.conf"
|
||||||
|
#define DEFAULT_TMATE_CFG ".tmate.conf"
|
||||||
#define SYSTEM_CFG "/etc/tmux.conf"
|
#define SYSTEM_CFG "/etc/tmux.conf"
|
||||||
|
|
||||||
/* Default prompt history length. */
|
/* Default prompt history length. */
|
||||||
@ -1513,7 +1514,7 @@ extern struct options global_s_options;
|
|||||||
extern struct options global_w_options;
|
extern struct options global_w_options;
|
||||||
extern struct environ global_environ;
|
extern struct environ global_environ;
|
||||||
extern struct event_base *ev_base;
|
extern struct event_base *ev_base;
|
||||||
extern char *cfg_file;
|
extern char *cfg_file, *tmate_cfg_file;
|
||||||
extern char *shell_cmd;
|
extern char *shell_cmd;
|
||||||
extern int debug_level;
|
extern int debug_level;
|
||||||
extern time_t start_time;
|
extern time_t start_time;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user