Hi

I think this might be better than generating tmux.h, although I haven't
tested it. You get the idea though :-).


diff --git a/Makefile.am b/Makefile.am
index c131940..d5bad20 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,7 +15,7 @@ dist-hook:
        find $(distdir) -name .svn -type d|xargs rm -Rf
 
 # Preprocessor flags.
-CPPFLAGS += @XOPEN_DEFINES@
+CPPFLAGS += @XOPEN_DEFINES@ -DTMUX_CONF="\"$(sysconfdir)/tmux.conf\""
 
 # glibc as usual does things ass-backwards and hides useful things by default,
 # so everyone has to add this.
diff --git a/server.c b/server.c
index 4bfa918..bd28d51 100644
--- a/server.c
+++ b/server.c
@@ -170,13 +170,13 @@ server_start(int lockfd, char *lockfile)
        cfg_references = 1;
        ARRAY_INIT(&cfg_causes);
 
-       if (access(SYSTEM_CFG, R_OK) == 0) {
-               if (load_cfg(SYSTEM_CFG, cfg_cmd_q, &cause) == -1) {
-                       xasprintf(&cause, "%s: %s", SYSTEM_CFG, cause);
+       if (access(TMUX_CONF, R_OK) == 0) {
+               if (load_cfg(TMUX_CONF, cfg_cmd_q, &cause) == -1) {
+                       xasprintf(&cause, "%s: %s", TMUX_CONF, cause);
                        ARRAY_ADD(&cfg_causes, cause);
                }
        } else if (errno != ENOENT) {
-               xasprintf(&cause, "%s: %s", SYSTEM_CFG, strerror(errno));
+               xasprintf(&cause, "%s: %s", TMUX_CONF, strerror(errno));
                ARRAY_ADD(&cfg_causes, cause);
        }
        if (cfg_file != NULL) {
diff --git a/tmux.c b/tmux.c
index 2916bbb..606c574 100644
--- a/tmux.c
+++ b/tmux.c
@@ -363,7 +363,7 @@ main(int argc, char **argv)
                        if (pw != NULL)
                                home = pw->pw_dir;
                }
-               xasprintf(&cfg_file, "%s/%s", home, DEFAULT_CFG);
+               xasprintf(&cfg_file, "%s/.tmux.conf", home);
                if (access(cfg_file, R_OK) != 0 && errno == ENOENT) {
                        free(cfg_file);
                        cfg_file = NULL;
diff --git a/tmux.h b/tmux.h
index f0b9edf..fc5561b 100644
--- a/tmux.h
+++ b/tmux.h
@@ -39,10 +39,6 @@
 extern char    *__progname;
 extern char   **environ;
 
-/* Default configuration files. */
-#define DEFAULT_CFG ".tmux.conf"
-#define SYSTEM_CFG "/etc/tmux.conf"
-
 /* Default prompt history length. */
 #define PROMPT_HISTORY 100
 



On Mon, Apr 22, 2013 at 02:56:17PM +0200, Dagobert Michelsen wrote:
> Hi,
> 
> I noticed that the location of tmux.conf is not relative to sysconfdir, but 
> hardcoded
> to /etc. This patch makes the location configurable:
>   
> https://sourceforge.net/u/dmichelsen/tmux/ci/5547c378f07ecb7b64e2c0f8a0fec345c75873c4/
> The patch can also be downloaded here:
>   
> https://sourceforge.net/apps/trac/gar/browser/csw/mgar/pkg/tmux/trunk/files/0001-Make-location-of-tmux.conf-relative-to-sysconfdir.patch?rev=20839
> 
> It would be nice if it could be applied to HEAD.
> 
> 
> Best regards
> 
>   -- Dago
> 
> -- 
> "You don't become great by trying to be great, you become great by wanting to 
> do something,
> and then doing it so hard that you become great in the process." - xkcd #896
> 
> 
> ------------------------------------------------------------------------------
> Precog is a next-generation analytics platform capable of advanced
> analytics on semi-structured data. The platform includes APIs for building
> apps and a phenomenal toolset for data science. Developers can use
> our toolset for easy data analysis & visualization. Get a free account!
> http://www2.precog.com/precogplatform/slashdotnewsletter
> _______________________________________________
> tmux-users mailing list
> tmux-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tmux-users

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to