Hi Nicholas,

Am 23.04.2013 um 00:40 schrieb Nicholas Marriott <nicholas.marri...@gmail.com>:
> Ok makes sense, please try this. It is important that the default
> (without --prefix or --sysconfdir) stays as /etc not /usr/local/etc so I
> had to add a hack to configure.ac to do that, --sysconfdir will still
> override.

Looks good, thanks!

Is there an ETA for the 1.9 release with all those nice patches included?


Best regards

  -- Dago

> 
> 
> diff --git a/Makefile.am b/Makefile.am
> index c131940..726582a 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.
> @@ -240,9 +240,10 @@ endif
> # Build tmux.1 in the right format.
> tmux.1: tmux.1.in
>       if test x@MANFORMAT@ = xmdoc; then \
> -             cp tmux.1.in tmux.1; \
> +             sed -e "s|@SYSCONFDIR@|$(sysconfdir)|g" tmux.1.in >tmux.1; \
>       else \
> -             $(AWK) -fmdoc2man.awk <tmux.1.in >tmux.1; \
> +             sed -e "s|@SYSCONFDIR@|$(sysconfdir)|g" tmux.1.in| \
> +             $(AWK) -fmdoc2man.awk >tmux.1; \
>       fi
> 
> # Update SF web site.
> diff --git a/configure.ac b/configure.ac
> index 80cf126..590b9db 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -18,6 +18,9 @@ AC_PROG_CC
> AM_PROG_CC_C_O
> AC_PROG_INSTALL
> 
> +# Default tmux.conf goes in /etc not ${prefix}/etc.
> +test "$sysconfdir" = '${prefix}/etc' && sysconfdir=/etc
> +
> # Check for various headers. Alternatives included from compat.h.
> AC_CHECK_HEADERS(
>       [ \
> 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.1.in b/tmux.1.in
> index 98bf957..7f783b8 100644
> --- a/tmux.1.in
> +++ b/tmux.1.in
> @@ -122,7 +122,7 @@ Specify an alternative configuration file.
> By default,
> .Nm
> loads the system configuration file from
> -.Pa /etc/tmux.conf ,
> +.Pa @SYSCONFDIR@/tmux.conf ,
> if present, then looks for a user configuration file at
> .Pa ~/.tmux.conf .
> .Pp
> @@ -3705,12 +3705,12 @@ was renamed to
> .Ar name .
> .El
> .Sh FILES
> -.Bl -tag -width "/etc/tmux.confXXX" -compact
> +.Bl -tag -width "@SYSCONFDIR@/tmux.confXXX" -compact
> .It Pa ~/.tmux.conf
> Default
> .Nm
> configuration file.
> -.It Pa /etc/tmux.conf
> +.It Pa @SYSCONFDIR@/tmux.conf
> System-wide configuration file.
> .El
> .Sh EXAMPLES
> 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 03:18:38PM +0200, Dagobert Michelsen wrote:
>> Hi Nicholas,
>> 
>> Am 22.04.2013 um 15:09 schrieb Nicholas Marriott 
>> <nicholas.marri...@gmail.com>:
>>> I think this might be better than generating tmux.h, although I haven't
>>> tested it. You get the idea though :-).
>> 
>> Thanks for the quick turnaround, this looks good, but does not change the 
>> manpage
>> which I would consider a good idea.
>> 
>> 
>> 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
>> 

-- 
"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


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to