diff -ur mutt-1.0.original/Muttrc.in mutt-1.0/Muttrc.in --- mutt-1.0.original/Muttrc.in Thu Sep 30 21:52:21 1999 +++ mutt-1.0/Muttrc.in Wed Dec 22 23:58:56 1999 @@ -38,7 +38,7 @@ # set abort_nosubject=ask-yes # set abort_unmodified=yes -# set alias_file="~/.muttrc" +# set alias_file="~/etc/mail_aliases" # set alias_format=""%2n %t %-10a %r" # set allow_8bit # set alternates="" @@ -141,7 +141,7 @@ # set sendmail_wait=0 # set shell="" # set sig_dashes -# set signature="~/.signature" +# set signature="~/etc/signature" # set simple_search="~f %s | ~s %s" # set smart_wrap # set smileys="(>From )|(:[-^]?[][)(><}{|/DP])" diff -ur mutt-1.0.original/contrib/sample.muttrc mutt-1.0/contrib/sample.muttrc --- mutt-1.0.original/contrib/sample.muttrc Fri Sep 3 23:42:16 1999 +++ mutt-1.0/contrib/sample.muttrc Wed Dec 22 23:58:56 1999 @@ -15,7 +15,7 @@ #set abort_unmodified=yes # automatically abort replies if I don't # change the message -set alias_file=~/.mail_aliases # where I keep my aliases +set alias_file=~/etc/mutt/mail_aliases # where I keep my aliases #set allow_8bit # never do Q-P encoding on legal 8-bit chars set arrow_cursor # use -> instead of hiliting the whole line #set ascii_chars # use ASCII instead of ACS chars for threads @@ -47,7 +47,7 @@ set include # always include messages when replying #set indent_string="> " # how to quote replied text #set locale="C" # locale to use for printing time -#set mailcap_path="~/.mailcap:/usr/local/share/mailcap" +#set mailcap_path="~/etc/mutt/mailcap:~/etc/mailcap:~/.mailcap:/usr/local/share/mailcap" set nomark_old # i don't care about whether a message is old set mail_check=10 # how often to poll for new mail set mbox=+mbox # where to store read messages @@ -80,7 +80,7 @@ #set save_name # save outgoing messages by recipient, if the #set sendmail="/usr/lib/sendmail -oi -oem" # how to deliver mail #set shell="/bin/zsh" # program to use for shell escapes -#set signature="~/.signature" # file which contains my signature +#set signature="~/etc/signature" # file which contains my signature # I subscribe to a lot of mailing lists, so this is _very_ useful. This # groups messages on the same subject to make it easier to follow a @@ -228,7 +228,7 @@ # # is executed when sending mail to an address matching -#send-hook mutt- 'set signature=~/.sigmutt; my_hdr From: Mutt User ' +#send-hook mutt- 'set signature=~/etc/signatures/sigmutt; my_hdr From: Mutt User ' # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # @@ -303,7 +303,7 @@ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # -# Automatically use entries from ~/.mailcap to view these MIME types +# Automatically use entries from ~/etc/mailcap to view these MIME types # # auto_view [ ... ] @@ -331,6 +331,6 @@ # machines. # -source ~/.muttrc-local # config commands local to this site +source ~/etc/mutt/muttrc-local # config commands local to this site # EOF diff -ur mutt-1.0.original/doc/PGP-Notes.txt mutt-1.0/doc/PGP-Notes.txt --- mutt-1.0.original/doc/PGP-Notes.txt Wed Jul 28 21:27:12 1999 +++ mutt-1.0/doc/PGP-Notes.txt Wed Dec 22 23:58:56 1999 @@ -96,7 +96,7 @@ Q: "How do it get PGP 5 support working?" It should work out of the box - just put the following -into your ~/.muttrc: +into your ~/.muttrc (~/etc/mutt/muttrc): set pgp_default_version=pgp5 @@ -104,8 +104,8 @@ Q: "People are sending PGP messages which mutt doesn't recognize. What can I do?" -Add the following lines to your ~/.procmailrc (you are -using procmail, aren't you?): +Add the following lines to your ~/.procmailrc (or to ~/etc/procmailrc if your +procmail supports ~/etc/) [you are using procmail, aren't you?]: ------------------------------ @@ -143,7 +143,7 @@ No. Application/pgp is not really suited to a world with MIME, non-textual body parts and similar things. Anyway, if you really want to generate these old-style -attachments, include the following macro in your ~/.muttrc +attachments, include the following macro in your ~/etc/mutt/muttrc (line breaks for readability, this is actually one line): macro compose S "Fpgp +verbose=0 -fast diff -ur mutt-1.0.original/doc/manual.sgml.in mutt-1.0/doc/manual.sgml.in --- mutt-1.0.original/doc/manual.sgml.in Thu Sep 30 21:39:23 1999 +++ mutt-1.0/doc/manual.sgml.in Wed Dec 22 23:58:56 1999 @@ -697,8 +697,8 @@ source /usr/local/share/Mutt.aliases -source ~/.mail_aliases -set alias_file=~/.mail_aliases +source ~/etc/mail_aliases +set alias_file=~/etc/mail_aliases To use aliases, you merely use the alias at any place in mutt where mutt diff -ur mutt-1.0.original/doc/manual.txt mutt-1.0/doc/manual.txt --- mutt-1.0.original/doc/manual.txt Fri Oct 22 09:42:22 1999 +++ mutt-1.0/doc/manual.txt Wed Dec 22 23:58:56 1999 @@ -802,8 +802,8 @@ source /usr/local/share/Mutt.aliases - source ~/.mail_aliases - set alias_file=~/.mail_aliases + source ~/etc/mail_aliases + set alias_file=~/etc/mail_aliases diff -ur mutt-1.0.original/doc/mutt.man.in mutt-1.0/doc/mutt.man.in --- mutt-1.0.original/doc/mutt.man.in Wed Jul 28 21:09:02 1999 +++ mutt-1.0/doc/mutt.man.in Wed Dec 22 23:58:56 1999 @@ -54,7 +54,7 @@ .IP "-f \fImailbox\fP" Specify which mailbox to load. .IP "-F \fImuttrc\fP" -Specify an initialization file to read instead of ~/.muttrc +Specify an initialization file to read instead of ~/etc/mutt/muttrc .IP "-h" Display help. .IP "-H \fIdraft\fP" @@ -108,12 +108,18 @@ .SH FILES .PP .IP "~/.muttrc" +or +.IP "~/etc/muttrc" +or +.IP "~/etc/mutt/muttrc" User configuration file. .IP "@sysconfdir@/Muttrc" System-wide configuration file. .IP "/tmp/muttXXXXXX" Temporary files created by Mutt. .IP "~/.mailcap" +or +.IP "~/etc/mailcap" User definition for handling non-text MIME types. .IP "@sysconfdir@/mailcap" System definition for handing non-text MIME types. diff -ur mutt-1.0.original/init.c mutt-1.0/init.c --- mutt-1.0.original/init.c Sun Sep 5 10:27:11 1999 +++ mutt-1.0/init.c Thu Dec 23 01:02:03 1999 @@ -42,6 +42,7 @@ #include #include #include +#include #define toggle_quadoption(opt) QuadOptions ^= (1 << (2 * opt)) @@ -1536,7 +1537,8 @@ { struct passwd *pw; struct utsname utsname; - char *p, buffer[STRING], error[STRING]; + struct stat st; + char *p, *conf_dir, buffer[STRING], error[STRING], rcpath[STRING]; int i, default_rc = 0, need_pause = 0; BUFFER err; @@ -1546,6 +1548,7 @@ /* on one of the systems I use, getcwd() does not return the same prefix as is listed in the passwd file */ + if ((p = getenv ("HOME"))) Homedir = safe_strdup (p); @@ -1580,6 +1583,39 @@ Shell = safe_strdup ((p = getenv ("SHELL")) ? p : "/bin/sh"); } + /* Check if user would like to use ~/$CONFIG_DIR/[mutt/] for all config files*/ + /* instead of ~ */ + + useconfdir = 0; + conf_dir = getenv ("CONFIG_DIR"); + if (conf_dir != NULL && *conf_dir != '\0') + { + if (*conf_dir == '/') + snprintf (config_dir, sizeof(config_dir), "%s", conf_dir); + else + snprintf (config_dir, sizeof(config_dir), "%s/%s", NONULL(Homedir), conf_dir); + + if ((p = strrchr(config_dir, '/')) && *(p+1) == '\0') p = '\0'; + + snprintf (buffer, sizeof(buffer), "%s/mutt", config_dir); + if (stat(buffer,&st) != -1 && S_ISDIR(st.st_mode)) + useconfdir = 1; + else + { + snprintf (buffer, sizeof(buffer), "%s/muttrc", config_dir); + + if (stat(buffer,&st) != -1 && (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode))) + useconfdir = 1; + else + { + snprintf (buffer, sizeof(buffer), "%s/muttrc-%s", config_dir, MUTT_VERSION); + + if (stat(buffer,&st) != -1 && (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode))) + useconfdir = 1; + } + } + } + #ifdef DEBUG /* Start up debugging mode if requested */ if (debuglevel > 0) @@ -1628,15 +1664,37 @@ MailcapPath = safe_strdup (p); else { - /* Default search path from RFC1524 */ - MailcapPath = safe_strdup ("~/.mailcap:" SHAREDIR "/mailcap:" SYSCONFDIR "/mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap"); + /* Default search path from RFC1524 - expanded to support $CONFIG_DIR directory */ + p = safe_strdup ("~/.mailcap:" SHAREDIR "/mailcap:" SYSCONFDIR "/mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap"); + if (useconfdir) + { + MailcapPath = safe_malloc (mutt_strlen (p) + (2 * mutt_strlen (config_dir)) + 20); + snprintf (MailcapPath, sizeof (MailcapPath), "%s/mailcap:%s/mutt/mailcap:%s", config_dir, config_dir, p); + safe_free ((void **) &p); + } + else + { + MailcapPath = p; + p = NULL; + } } Tempdir = safe_strdup ((p = getenv ("TMPDIR")) ? p : "/tmp"); - - #ifdef _PGPPATH + + usepgpconfdir = 0; + if (useconfdir) + { + snprintf (rcpath, sizeof(rcpath), "%s/pgp", config_dir); + + if (stat(rcpath,&st) != -1 && S_ISDIR(st.st_mode)) + usepgpconfdir = 1; + else + snprintf (rcpath, sizeof(rcpath), "%s/.pgp", NONULL(Homedir)); + } + else snprintf (rcpath, sizeof(rcpath), "%s/.pgp", NONULL(Homedir)); + #ifdef _PGPV2PATH PgpV2 = safe_strdup (_PGPV2PATH); if ((p = getenv("PGPPATH")) != NULL) @@ -1648,9 +1706,9 @@ } else { - snprintf (buffer, sizeof (buffer), "%s/.pgp/pubring.pgp", NONULL(Homedir)); + snprintf (buffer, sizeof (buffer), "%s/pubring.pgp", rcpath); PgpV2Pubring = safe_strdup (buffer); - snprintf (buffer, sizeof (buffer), "%s/.pgp/secring.pgp", NONULL(Homedir)); + snprintf (buffer, sizeof (buffer), "%s/secring.pgp", rcpath); PgpV2Secring = safe_strdup (buffer); } #endif @@ -1666,9 +1724,9 @@ } else { - snprintf (buffer, sizeof (buffer), "%s/.pgp/pubring.pkr", NONULL(Homedir)); + snprintf (buffer, sizeof (buffer), "%s/pubring.pkr", rcpath); PgpV3Pubring = safe_strdup (buffer); - snprintf (buffer, sizeof (buffer), "%s/.pgp/secring.skr", NONULL(Homedir)); + snprintf (buffer, sizeof (buffer), "%s/secring.skr", rcpath); PgpV3Secring = safe_strdup (buffer); } #endif @@ -1684,9 +1742,9 @@ } else { - snprintf (buffer, sizeof (buffer), "%s/.pgp/pubring.pkr", NONULL(Homedir)); + snprintf (buffer, sizeof (buffer), "%s/pubring.pkr", rcpath); PgpV6Pubring = safe_strdup (buffer); - snprintf (buffer, sizeof (buffer), "%s/.pgp/secring.skr", NONULL(Homedir)); + snprintf (buffer, sizeof (buffer), "%s/secring.skr", rcpath); PgpV6Secring = safe_strdup (buffer); } #endif @@ -1739,13 +1797,20 @@ if (!Muttrc) { - snprintf (buffer, sizeof(buffer), "%s/.muttrc-%s", NONULL(Homedir), MUTT_VERSION); + if (useconfdir) + snprintf (rcpath, sizeof(rcpath), "%s/", config_dir); + else + snprintf (rcpath, sizeof(rcpath), "%s/.", NONULL(Homedir)); + + snprintf (buffer, sizeof(buffer), "%smuttrc-%s", rcpath, MUTT_VERSION); + if (access(buffer, F_OK) == -1) + snprintf (buffer, sizeof(buffer), "%smuttrc-%s", rcpath, MUTT_VERSION); if (access(buffer, F_OK) == -1) - snprintf (buffer, sizeof(buffer), "%s/.muttrc", NONULL(Homedir)); + snprintf (buffer, sizeof(buffer), "%smuttrc", rcpath); if (access(buffer, F_OK) == -1) - snprintf (buffer, sizeof (buffer), "%s/.mutt/muttrc-%s", NONULL(Homedir), MUTT_VERSION); + snprintf (buffer, sizeof (buffer), "%smutt/muttrc-%s", rcpath, MUTT_VERSION); if (access(buffer, F_OK) == -1) - snprintf (buffer, sizeof (buffer), "%s/.mutt/muttrc", NONULL(Homedir)); + snprintf (buffer, sizeof (buffer), "%smutt/muttrc", rcpath); default_rc = 1; Muttrc = safe_strdup (buffer); diff -ur mutt-1.0.original/init.h mutt-1.0/init.h --- mutt-1.0.original/init.h Thu Sep 30 21:38:51 1999 +++ mutt-1.0/init.h Thu Dec 23 00:06:23 1999 @@ -51,6 +51,10 @@ #define R_BOTH (R_INDEX | R_PAGER) #define R_RESORT_BOTH (R_RESORT | R_RESORT_SUB) +char config_dir[STRING]; +int useconfdir; /* do we have $CONFIG_DIR ? */ +int usepgpconfdir; /* do we have $CONFIG_DIR/pgp/ ? - not used, for future */ + struct option_t { char *option; @@ -69,7 +73,7 @@ struct option_t MuttVars[] = { { "abort_nosubject", DT_QUAD, R_NONE, OPT_SUBJECT, M_ASKYES }, { "abort_unmodified", DT_QUAD, R_NONE, OPT_ABORT, M_YES }, - { "alias_file", DT_PATH, R_NONE, UL &AliasFile, UL "~/.muttrc" }, + { "alias_file", DT_PATH, R_NONE, UL &AliasFile, UL "~/etc/mutt/mail_aliases" }, { "alias_format", DT_STR, R_NONE, UL &AliasFmt, UL "%2n %t %-10a %r" }, { "allow_8bit", DT_BOOL, R_NONE, OPTALLOW8BIT, 1 }, { "alternates", DT_RX, R_BOTH, UL &Alternates, 0 }, @@ -258,7 +262,7 @@ { "sendmail_wait", DT_NUM, R_NONE, UL &SendmailWait, 0 }, { "shell", DT_PATH, R_NONE, UL &Shell, 0 }, { "sig_dashes", DT_BOOL, R_NONE, OPTSIGDASHES, 1 }, - { "signature", DT_PATH, R_NONE, UL &Signature, UL "~/.signature" }, + { "signature", DT_PATH, R_NONE, UL &Signature, UL "~/etc/signature" }, { "simple_search", DT_STR, R_NONE, UL &SimpleSearch, UL "~f %s | ~s %s" }, { "smart_wrap", DT_BOOL, R_PAGER, OPTWRAP, 1 }, { "smileys", DT_RX, R_PAGER, UL &Smileys, UL "(>From )|(:[-^]?[][)(><}{|/DP])" }, diff -ur mutt-1.0.original/mutt.h mutt-1.0/mutt.h --- mutt-1.0.original/mutt.h Tue Oct 5 08:49:24 1999 +++ mutt-1.0/mutt.h Thu Dec 23 00:06:47 1999 @@ -107,6 +107,10 @@ #define M_TOKEN_COMMENT (1<<5) /* don't reap comments */ #define M_TOKEN_SEMICOLON (1<<6) /* don't treat ; as special */ +extern char config_dir[STRING]; +extern int useconfdir; /* do we have $CONFIG_DIR ? */ +extern int usepgpconfdir; /* do we have $CONFIG_DIR/pgp/ ? - not used, for future */ + typedef struct { char *data; /* pointer to data */ diff -ur mutt-1.0.original/sendlib.c mutt-1.0/sendlib.c --- mutt-1.0.original/sendlib.c Tue Sep 28 18:44:30 1999 +++ mutt-1.0/sendlib.c Thu Dec 23 00:05:09 1999 @@ -685,7 +685,7 @@ cur_sze = 0; szf = mutt_strlen (s); - for (count = 0 ; count < 3 ; count++) + for (count = 0 ; count < 4 ; count++) { /* * can't use strtok() because we use it in an inner loop below, so use @@ -694,12 +694,17 @@ switch (count) { case 0: + if (useconfdir) + snprintf (buf, sizeof (buf), "%s/mime.types", config_dir); + else snprintf (buf, sizeof (buf), "/nonexistentfilename"); + break; + case 1: snprintf (buf, sizeof (buf), "%s/.mime.types", NONULL(Homedir)); break; - case 1: + case 2: strfcpy (buf, SYSCONFDIR"/mime.types", sizeof(buf)); break; - case 2: + case 3: strfcpy (buf, SHAREDIR"/mime.types", sizeof (buf)); break; default: