Article View: comp.mail.mh
Article #1914Refile
From: Brian M. Clapper
Date: Wed, 07 Jun 1989 19:28
Date: Wed, 07 Jun 1989 19:28
117 lines
4264 bytes
4264 bytes
When I first started using MH, I established a catch-all folder for those
messages I couldn't or wouldn't categorize properly. This folder became
the place to throw anything miscellaneous -- in effect, my default folder.
However, I could find no way to tell refile that it was to place messages
in this folder if I didn't explicitly specify one.
When I found the source, I made a quick hack allowing me to specify a single
default folder in an environment variable. One can undoubtedly enhance this
idea, but I stopped there, since this solution was more than sufficient for
my needs.
To my knowledge, no one has added this feature to the latest releases, so I'm
posting the patch for it, as well as appropriate diffs to the manual page.
Use it if you're interested; ignore it if you're not. :^) There may be better
ways to accomplish this; as I said, I'm not intimate with the MH source.
However, I've been using my local refile variant for several months now with
no trouble. The patch should work for 6.5 and 6.6.
Brian Clapper
Software Engineering Institute
Pittsburgh, PA 15213
-------------------------- refile.c patch - CUT HERE --------------------------
*** refile.c.old Thu Oct 29 18:02:41 1987
--- refile.c Wed Jun 7 12:35:33 1989
***************
*** 8,13
/* */
static struct swit switches[] = {
#define DRAFTSW 0
"draft", 0,
--- 8,15 -----
/* */
+ #define DEF_FOLDER_ENV_VAR "REFILE_DEFAULT"
+
static struct swit switches[] = {
#define DRAFTSW 0
"draft", 0,
***************
*** 64,69
i,
msgnum;
char *cp,
*folder = NULL,
buf[100],
**ap,
--- 66,72 -----
i,
msgnum;
char *cp,
+ *s,
*folder = NULL,
buf[100],
**ap,
***************
*** 150,157
if (!m_find ("path"))
free (path ("./", TFOLDER));
! if (foldp == 0)
! adios (NULLCP, "no folder specified");
#ifdef WHATNOW
if (!msgp && !filep && (cp = getenv ("mhdraft")) && *cp)
--- 153,171 -----
if (!m_find ("path"))
free (path ("./", TFOLDER));
! if (foldp == 0) {
! /* Check the environment for a default folder specification. */
! if ( ((s = getenv (DEF_FOLDER_ENV_VAR)) == NULL) ||
! (strlen (s) == 0) )
! adios (NULLCP, "no folder specified");
! else {
! folders[foldp].f_name =
! path (s + 1, *s == '+' ? TFOLDER : TSUBCWF);
! (void) printf ("Assuming default target folder of \"%s\"\n",
! folders[foldp].f_name);
! foldp++;
! }
! }
#ifdef WHATNOW
if (!msgp && !filep && (cp = getenv ("mhdraft")) && *cp)
-------------------------- refile.1 patch - CUT HERE --------------------------
*** refile.1 Thu Apr 21 10:19:54 1988
--- /usr/users/bmc/man/man1/refile.1 Fri Feb 24 16:37:16 1989
***************
*** 49,54
If a destination folder doesn't exist, \fIrefile\fR will ask if you
want to create it.
A negative response will abort the file operation.
The option `\-link' preserves the source folder copy of the message
(i.e., it does a \fIln\fR(1) rather than a \fImv\fR(1)), whereas,
--- 49,58 -----
If a destination folder doesn't exist, \fIrefile\fR will ask if you
want to create it.
A negative response will abort the file operation.
+ If you don't specify a destination folder, \fIrefile\fR will examine
+ environment variable \fBREFILE_DEFAULT\fR to see if one is specified there.
+ \fBREFILE_DEFAULT\fR may contain only one folder name; this name should
+ be specified in the same way as it would be on the command line.
The option `\-link' preserves the source folder copy of the message
(i.e., it does a \fIln\fR(1) rather than a \fImv\fR(1)), whereas,
Technical Details
Message-ID:
<3462@dx.sei.cmu.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!rochester!pt.cs.cmu.edu!sei!bmcShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!rochester!pt.cs.cmu.edu!sei!bmc From: bmc@sei.cmu.edu (Brian M. Clapper) Newsgroups: comp.mail.mh Subject: Refile Message-ID: <3462@dx.sei.cmu.edu> Date: 7 Jun 89 19:28:47 GMT Reply-To: bmc@sei.cmu.edu (Brian M. Clapper) Followup-To: comp.mail.mh Distribution: na Organization: Software Engineering Institute, Pittsburgh, PA Lines: 117