]> git.pld-linux.org Git - packages/mutt.git/blob - mutt-home_etc.patch
- vvv.initials patch from mutt.org.ua
[packages/mutt.git] / mutt-home_etc.patch
1 diff -Nur mutt-1.5.11.orig/configure.ac mutt-1.5.11/configure.ac
2 --- mutt-1.5.11.orig/configure.ac       2006-05-11 23:23:13.000000000 +0200
3 +++ mutt-1.5.11/configure.ac    2006-05-12 00:58:13.000000000 +0200
4 @@ -816,6 +816,32 @@
5  fi])
6  dnl -- end cache --
7  
8 +dnl -- home-etc --
9 +AC_ARG_WITH(home-etc, [  --with-home-etc[=PFX]          Use HOME-ETC library to allow user keeping it's configuration files in a non-standard place ],
10 +        [
11 +        if test "$with_home_etc" != "no"
12 +        then
13 +          if test "$with_home_etc" != "yes"
14 +          then
15 +            LDFLAGS="$LDFLAGS -L$with_home_etc/lib"
16 +          fi
17 +
18 +          saved_LIBS="$LIBS"
19 +
20 +          AC_CHECK_LIB(home_etc, get_home_etc_static,,
21 +            AC_MSG_ERROR([could not find libhome_etc]),)
22 +           
23 +         AC_CHECK_HEADERS(home_etc.h)
24 +
25 +          MUTTLIBS="$MUTTLIBS -lhome_etc"
26 +          LIBS="$saved_LIBS"
27 +          AC_DEFINE(USE_HOME_ETC,1,
28 +                  [ Define if want to use the HOME-ETC library. ])
29 +          need_home_etc=yes
30 +        fi
31 +        ])
32 +AM_CONDITIONAL(USE_HOME_ETC, test x$need_home_etc = xyes)
33 +
34  if test "$need_md5" = "yes"
35  then
36          MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS md5c.o"
37 diff -Nur mutt-1.5.11.orig/doc/mutt.man mutt-1.5.11/doc/mutt.man
38 --- mutt-1.5.11.orig/doc/mutt.man       2005-08-18 21:38:54.000000000 +0200
39 +++ mutt-1.5.11/doc/mutt.man    2006-05-12 00:58:13.000000000 +0200
40 @@ -122,6 +122,8 @@
41  .IP "MAILDIR"
42  Full path of the user's spool mailbox if MAIL is unset.  Commonly used when the spool
43  mailbox is a
44 +.IP "HOME_ETC"
45 +Path to alternative configuration directory.
46  .B maildir (5)
47  folder.
48  .IP "MAILCAPS"
49 @@ -138,17 +140,17 @@
50  Specifies the editor to use when composing messages.
51  .SH FILES
52  .PP
53 -.IP "~/.muttrc or ~/.mutt/muttrc"
54 +.IP "$HOME_ETC/.muttrc" or "$HOME_ETC/.mutt/muttrc" or "~/.muttrc" or "~/.mutt/muttrc"
55  User configuration file.
56  .IP "@sysconfdir@/Muttrc"
57  System-wide configuration file.
58  .IP "/tmp/muttXXXXXX"
59  Temporary files created by Mutt.
60 -.IP "~/.mailcap"
61 +.IP "~/.mailcap or $HOME_ETC/.mailcap"
62  User definition for handling non-text MIME types.
63  .IP "@sysconfdir@/mailcap"
64  System definition for handling non-text MIME types.
65 -.IP "~/.mime.types"
66 +.IP "~/.mime.types or $HOME_ETC/.mime.types"
67  User's personal mapping between MIME types and file extensions.
68  .IP "@sysconfdir@/mime.types"
69  System mapping between MIME types and file extensions.
70 diff -Nur mutt-1.5.11.orig/init.c mutt-1.5.11/init.c
71 --- mutt-1.5.11.orig/init.c     2006-05-11 23:23:13.000000000 +0200
72 +++ mutt-1.5.11/init.c  2006-05-12 00:58:40.000000000 +0200
73 @@ -35,7 +35,12 @@
74  #include "mutt_ssl.h"
75  #endif
76  
77 -
78 +#ifdef HAVE_HOME_ETC_H
79 +# include <home_etc.h>
80 +# define H_CFDIR _HEdir
81 +#else
82 +# define H_CFDIR Homedir
83 +#endif
84  
85  #include "mx.h"
86  #include "init.h"
87 @@ -2334,7 +2339,21 @@
88    else
89    {
90      /* Default search path from RFC1524 */
91 -    MailcapPath = safe_strdup ("~/.mailcap:" PKGDATADIR "/mailcap:" SYSCONFDIR "/mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap");
92 +
93 +#define MAILCAPPATHS "~/.mailcap:" PKGDATADIR "/mailcap:" SYSCONFDIR "/mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap"
94 +#ifdef HAVE_HOME_ETC_H
95 +
96 +    MailcapPath = safe_malloc (mutt_strlen (MAILCAPPATHS) + mutt_strlen (_HEdir) + 2);
97 +    if (_HEdir != NULL && (mutt_strlen (_HEdir)) > 0)
98 +      sprintf (MailcapPath, "%s:%s", _HEdir, MAILCAPPATHS);    /* __SPRINTF_CHECKED__ */
99 +    else
100 +      strcpy (MailcapPath, MAILCAPPATHS);                      /* __SPRCPY_CHECKED__ */
101 +
102 +#else
103 +
104 +    MailcapPath = safe_strdup (MAILCAPPATHS);
105 +
106 +#endif
107    }
108  
109    Tempdir = safe_strdup ((p = getenv ("TMPDIR")) ? p : "/tmp");
110 @@ -2981,15 +2981,15 @@
111    
112    if (!Muttrc)
113    {
114 -    snprintf (buffer, sizeof(buffer), "%s/.muttrc-%s", NONULL(Homedir), MUTT_VERSION);
115 +    snprintf (buffer, sizeof(buffer), "%s/.muttrc-%s", NONULL(H_CFDIR), MUTT_VERSION);
116      if (access(buffer, F_OK) == -1)
117 -      snprintf (buffer, sizeof(buffer), "%s/.muttrc", NONULL(Homedir));
118 +      snprintf (buffer, sizeof(buffer), "%s/.muttrc", NONULL(H_CFDIR));
119      if (access(buffer, F_OK) == -1)
120 -      snprintf (buffer, sizeof (buffer), "%s/.mutt/muttrc-%s", NONULL(Homedir), MUTT_VERSION);
121 +      snprintf (buffer, sizeof (buffer), "%s/.mutt/muttrc-%s", NONULL(H_CFDIR), MUTT_VERSION);
122      if (access(buffer, F_OK) == -1)
123 -      snprintf (buffer, sizeof (buffer), "%s/.mutt/muttrc", NONULL(Homedir));
124 +      snprintf (buffer, sizeof (buffer), "%s/.mutt/muttrc", NONULL(H_CFDIR));
125      if (access(buffer, F_OK) == -1) /* default to .muttrc for alias_file */
126 -      snprintf (buffer, sizeof(buffer), "%s/.muttrc", NONULL(Homedir));
127 +      snprintf (buffer, sizeof(buffer), "%s/.muttrc", NONULL(H_CFDIR));
128  
129      default_rc = 1;
130      Muttrc = safe_strdup (buffer);
131 @@ -2526,10 +2545,10 @@
132    }
133  
134    uname (&u);
135 -  pathlen = strlen (Homedir) + sizeof("/.slrnfaces/")
136 +  pathlen = strlen (H_CFDIR) + sizeof("/.slrnfaces/")
137              + strlen (u.nodename) + 30;
138    fifo = safe_malloc (pathlen);
139 -  sprintf (fifo, "%s/.slrnfaces", Homedir);
140 +  sprintf (fifo, "%s/.slrnfaces", H_CFDIR);
141    if (mkdir (fifo, 0700))
142    {
143      if (errno != EEXIST)
144 @@ -2544,7 +2563,7 @@
145      FILE *fp;
146  
147      /* We'll abuse fifo filename memory here. It's long enough. */
148 -    sprintf (fifo, "%s/.slrnfaces/README", Homedir);
149 +    sprintf (fifo, "%s/.slrnfaces/README", H_CFDIR);
150      if ((fp = fopen (fifo, "w")) != NULL)
151      {
152        fputs (_(
153 @@ -2560,7 +2579,7 @@
154      }
155    }
156  
157 -  status = snprintf (fifo, pathlen, "%s/.slrnfaces/%s.%ld", Homedir,
158 +  status = snprintf (fifo, pathlen, "%s/.slrnfaces/%s.%ld", H_CFDIR,
159                      u.nodename, (long)getpid());
160    if (status < 0)
161      goto clean_face;
162 diff -Nur mutt-1.5.11.orig/mutt_ssl.c mutt-1.5.11/mutt_ssl.c
163 --- mutt-1.5.11.orig/mutt_ssl.c 2005-08-03 11:17:46.000000000 +0200
164 +++ mutt-1.5.11/mutt_ssl.c      2006-05-12 00:58:13.000000000 +0200
165 @@ -58,6 +58,13 @@
166  #define HAVE_ENTROPY() (!access(DEVRANDOM, R_OK) || entropy_byte_count >= 16)
167  #endif
168  
169 +#ifdef HAVE_HOME_ETC_H
170 +# include <home_etc.h>
171 +# define H_CFDIR _HEdir
172 +#else
173 +# define H_CFDIR Homedir
174 +#endif
175 +
176  /* keep a handle on accepted certificates in case we want to
177   * open up another connection to the same server in this session */
178  static STACK_OF(X509) *SslSessionCerts = NULL;
179 @@ -162,7 +169,7 @@
180      /* load entropy from egd sockets */
181  #ifdef HAVE_RAND_EGD
182      add_entropy (getenv ("EGDSOCKET"));
183 -    snprintf (path, sizeof(path), "%s/.entropy", NONULL(Homedir));
184 +    snprintf (path, sizeof(path), "%s/.entropy", NONULL(H_CFDIR));
185      add_entropy (path);
186      add_entropy ("/tmp/entropy");
187  #endif
188 diff -Nur mutt-1.5.11.orig/sendlib.c mutt-1.5.11/sendlib.c
189 --- mutt-1.5.11.orig/sendlib.c  2006-05-11 23:23:13.000000000 +0200
190 +++ mutt-1.5.11/sendlib.c       2006-05-12 00:58:13.000000000 +0200
191 @@ -45,6 +45,13 @@
192  #include <sys/wait.h>
193  #include <fcntl.h>
194  
195 +#ifdef HAVE_HOME_ETC_H
196 +# include <home_etc.h>
197 +# define H_CFDIR _HEdir
198 +#else
199 +# define H_CFDIR Homedir
200 +#endif
201 +
202  #ifdef HAVE_SYSEXITS_H
203  #include <sysexits.h>
204  #else /* Make sure EX_OK is defined <philiph@pobox.com> */
205 @@ -908,9 +915,9 @@
206  
207  /* Given a file with path ``s'', see if there is a registered MIME type.
208   * returns the major MIME type, and copies the subtype to ``d''.  First look
209 - * for ~/.mime.types, then look in a system mime.types if we can find one.
210 - * The longest match is used so that we can match `ps.gz' when `gz' also
211 - * exists.
212 + * for either $HOME_ETC/.mime.types or ~/.mime.types, then look in a system
213 + * mime.types if we can find one. The longest match is used so that we can
214 + * match `ps.gz' when `gz' also exists.
215   */
216  
217  int mutt_lookup_mime_type (BODY *att, const char *path)
218 @@ -939,7 +946,7 @@
219      switch (count)
220      {
221        case 0:
222 -       snprintf (buf, sizeof (buf), "%s/.mime.types", NONULL(Homedir));
223 +       snprintf (buf, sizeof (buf), "%s/.mime.types", NONULL(H_CFDIR));
224         break;
225        case 1:
226         strfcpy (buf, SYSCONFDIR"/mime.types", sizeof(buf));
This page took 0.044315 seconds and 3 git commands to generate.