]> diplodocus.org Git - nmh/blobdiff - sbr/m_maildir.c
mhbuildsbr.c: Flip logic, moving goto to then-block; no need for else.
[nmh] / sbr / m_maildir.c
index c574c1616187884b8ca9b9a5bbc8c4b81021bac4..0f9584b6c38f5352d54a225c9175bb3364d5cff9 100644 (file)
@@ -1,6 +1,4 @@
-
-/*
- * m_maildir.c -- get the path for the mail directory
+/* m_maildir.c -- get the path for the mail directory
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -9,13 +7,12 @@
 
 #include <h/mh.h>
 #include <h/utils.h>
+#include "m_maildir.h"
 
 #define        CWD     "./"
-#define        NCWD    (sizeof(CWD) - 1)
 #define        DOT     "."
 #define        DOTDOT  ".."
 #define        PWD     "../"
-#define        NPWD    (sizeof(PWD) - 1)
 
 static char mailfold[BUFSIZ];
 
@@ -46,10 +43,10 @@ m_mailpath (char *folder)
     char maildir[BUFSIZ];
 
     if (*folder != '/'
-           && !HasPrefix(folder, CWD)
+           && !has_prefix(folder, CWD)
            && strcmp (folder, DOT)
            && strcmp (folder, DOTDOT)
-           && !HasPrefix(folder, PWD)) {
+           && !has_prefix(folder, PWD)) {
        strncpy (maildir, mailfold, sizeof(maildir));   /* preserve... */
        cp = getcpy (m_maildir (folder));
        strncpy (mailfold, maildir, sizeof(mailfold));
@@ -71,10 +68,10 @@ exmaildir (char *folder)
        folder = getfolder(1);
 
     if (!(*folder != '/'
-           && !HasPrefix(folder, CWD)
+           && !has_prefix(folder, CWD)
            && strcmp (folder, DOT)
            && strcmp (folder, DOTDOT)
-           && !HasPrefix(folder, PWD))) {
+           && !has_prefix(folder, PWD))) {
        strncpy (mailfold, folder, sizeof(mailfold));
        return mailfold;
     }
@@ -85,9 +82,9 @@ exmaildir (char *folder)
            snprintf(cp, sizeof mailfold, "%s/", mypath);
            cp += strlen (cp);
        }
-       cp = copy (pp, cp);
+       cp = stpcpy(cp, pp);
     } else {
-       cp = copy (path ("./", TFOLDER), cp);
+       cp = stpcpy(cp, path("./", TFOLDER));
     }
     if (cp[-1] != '/')
        *cp++ = '/';