=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/cfg.c,v retrieving revision 1.40 retrieving revision 1.41 diff -c -r1.40 -r1.41 *** src/usr.bin/tmux/cfg.c 2015/09/01 10:01:56 1.40 --- src/usr.bin/tmux/cfg.c 2015/09/01 10:10:59 1.41 *************** *** 1,4 **** ! /* $OpenBSD: cfg.c,v 1.40 2015/09/01 10:01:56 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: cfg.c,v 1.41 2015/09/01 10:10:59 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott *************** *** 28,33 **** --- 28,34 ---- #include "tmux.h" + char *cfg_file; struct cmd_q *cfg_cmd_q; int cfg_finished; int cfg_references; *************** *** 38,46 **** void cfg_default_done(struct cmd_q *); void start_cfg(void) { ! char *cause = NULL; cfg_cmd_q = cmdq_new(NULL); cfg_cmd_q->emptyfn = cfg_default_done; --- 39,55 ---- void cfg_default_done(struct cmd_q *); void + set_cfg_file(const char *path) + { + free(cfg_file); + cfg_file = xstrdup(path); + } + + void start_cfg(void) { ! char *cause = NULL; ! const char *home; cfg_cmd_q = cmdq_new(NULL); cfg_cmd_q->emptyfn = cfg_default_done; *************** *** 58,63 **** --- 67,79 ---- } else if (errno != ENOENT) cfg_add_cause("%s: %s", TMUX_CONF, strerror(errno)); + if (cfg_file == NULL && (home = find_home()) != NULL) { + xasprintf(&cfg_file, "%s/.tmux.conf", home); + if (access(cfg_file, R_OK) != 0 && errno == ENOENT) { + free(cfg_file); + cfg_file = NULL; + } + } if (cfg_file != NULL && load_cfg(cfg_file, cfg_cmd_q, &cause) == -1) cfg_add_cause("%s: %s", cfg_file, cause); free(cause);