Split nmh dir into mmh dir (~/.mmh) and mail storage (~/Mail).
[mmh] / sbr / path.c
index fd05f34..e5576b8 100644 (file)
@@ -9,8 +9,6 @@
 #include <h/mh.h>
 #include <pwd.h>
 
-extern char *mhetcdir;
-
 
 /*
 ** Find the location of a format or configuration
@@ -18,8 +16,8 @@ extern char *mhetcdir;
 **
 ** 1) If it begins with ~user, then expand it.
 ** 2) Next, if already absolute pathname, then leave unchanged.
-** 3) Next, check in nmh Mail directory.
-** 4) Next, check in nmh `etc' directory.
+** 3) Next, check in mmh directory.
+** 4) Next, check in mmh `etc' directory.
 */
 char *
 etcpath(char *file)
@@ -29,7 +27,7 @@ etcpath(char *file)
        char *pp;
        struct passwd *pw;
 
-       context_read();
+       /* XXX: here was: ``context_read();'' -- why? */
        if (*file == '~') {
                /* Expand `~user' */
                if ((cp = strchr(pp = file + 1, '/')))
@@ -60,14 +58,16 @@ try_it:
                return file;
        }
 
-       /* Check nmh Mail directory */
-       strncpy(epath, toabsdir(file), sizeof epath);
+       /* Check mmh directory */
+       snprintf(epath, sizeof epath, "%s/%s", mmhpath, file);
        if (access(epath, R_OK) != NOTOK)
                return epath;
 
        /* Check nmh `etc' directory */
        snprintf(epath, sizeof epath, "%s/%s", mhetcdir, file);
        return (access(epath, R_OK) != NOTOK ? epath : file);
+
+       /* TODO: What is the ultimate fallback? NULL or file? */
 }