]> diplodocus.org Git - nmh/blobdiff - config/config.c
context_foil.c: Move interface to own file.
[nmh] / config / config.c
index 28436d93a8ab0fa64be6d362ab5e60393803dfd4..55d862e71c19f6e17a4f857debfc37d3e401c0e0 100644 (file)
@@ -1,19 +1,18 @@
-
-/*
- * config.c -- master nmh configuration file
+/* config.c -- master nmh configuration file
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
  * complete copyright information.
  */
 
-#include <h/mh.h>
+#include "h/mh.h"
+#include "sbr/context_read.h"
+#include "sbr/m_maildir.h"
 #include <pwd.h>
 
 #define nmhbindir(file) NMHBINDIR#file
 #define nmhlibexecdir(file) NMHLIBEXECDIR#file
 #define nmhetcdir(file) NMHETCDIR#file
-#define nmhdocdir(file) NMHDOCDIR#file
 
 
 /*
@@ -25,6 +24,7 @@
  * 3) Next, check in nmh Mail directory.
  * 4) Next, check in nmh `etc' directory.
  *
+ * Does not return NULL.
  */
 
 char *
@@ -58,28 +58,28 @@ etcpath (char *file)
                }
            }
 
-           snprintf (epath, sizeof(epath), "%s/%s", pp, cp ? cp : "");
+           snprintf (epath, sizeof(epath), "%s/%s", pp, FENDNULL(cp));
            if (cp)
                *--cp = '/';
 
            if (access (epath, R_OK) != NOTOK)
-               return epath;   /* else fall */
-try_it:
+               return epath;
 
+            /* FALLTHRU */
+try_it:
        default: 
            /* Check nmh Mail directory */
            if (access ((cp = m_mailpath (file)), R_OK) != NOTOK) {
                /* Will leak because caller doesn't know cp was
                   dynamically allocated. */
                return cp;
-           } else {
-               free (cp);
            }
+            free (cp);
     }
 
     /* Check nmh `etc' directory */
     snprintf (epath, sizeof(epath), nmhetcdir(/%s), file);
-    return (access (epath, R_OK) != NOTOK ? epath : file);
+    return access(epath, R_OK) != NOTOK ? epath : file;
 }
 
 
@@ -106,6 +106,9 @@ char *mh_profile = ".mh_profile";
 /* name of credentials file, defaults to .netrc in either Path or $HOME. */
 char *credentials_file;
 
+/* if set to 1, do not check permissions on credentials file */
+int credentials_no_perm_check = 0;
+
 /* name of current message "sequence" */
 char *current = "cur";
 
@@ -330,4 +333,3 @@ char *foldprot = "700";
  */
 
 char *msgprot = "600";
-