]> diplodocus.org Git - nmh/blobdiff - sbr/path.c
Replace getcpy() with mh_xstrdup() where the string isn't NULL.
[nmh] / sbr / path.c
index 7475fa081b01113df129ef65af21979316aa68ab..871ad22d7ccddec2ec61b160b97d0a86fa82cbd2 100644 (file)
@@ -2,14 +2,13 @@
 /*
  * path.c -- return a pathname
  *
- * $Id$
- *
  * 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/utils.h>
 
 #define        CWD     "./"
 #define        NCWD    (sizeof(CWD) - 1)
@@ -35,7 +34,7 @@ pluspath(char *name)
 char *
 path(char *name, int flag)
 {
-    register char *cp, *ep;
+    char *cp, *ep;
 
     if ((cp = expath (name, flag))
            && (ep = cp + strlen (cp) - 1) > cp
@@ -49,7 +48,7 @@ path(char *name, int flag)
 static char *
 expath (char *name, int flag)
 {
-    register char *cp, *ep;
+    char *cp, *ep;
     char buffer[BUFSIZ];
 
     if (flag == TSUBCWF) {
@@ -59,7 +58,7 @@ expath (char *name, int flag)
        snprintf (buffer, sizeof(buffer), "%s/", m_maildir (""));
        if (ssequal (buffer, name)) {
            cp = name;
-           name = getcpy (name + strlen (buffer));
+           name = mh_xstrdup(name + strlen(buffer));
            free (cp);
        }
        flag = TFOLDER;
@@ -90,7 +89,7 @@ expath (char *name, int flag)
        name += NCWD;
 
     if (strcmp (name, DOTDOT) == 0 || strcmp (name, PWD) == 0) {
-       snprintf (buffer, sizeof(buffer), "%.*s", cp - pwds, pwds);
+       snprintf (buffer, sizeof(buffer), "%.*s", (int)(cp - pwds), pwds);
        return getcpy (buffer);
     }
 
@@ -99,7 +98,7 @@ expath (char *name, int flag)
     else
        cp = ep;
 
-    snprintf (buffer, sizeof(buffer), "%.*s/%s", cp - pwds, pwds, name);
+    snprintf (buffer, sizeof(buffer), "%.*s/%s", (int)(cp - pwds), pwds, name);
     return getcpy (buffer);
 }
 
@@ -107,7 +106,7 @@ expath (char *name, int flag)
 static void
 compath (char *f)
 {
-    register char *cp, *dp;
+    char *cp, *dp;
 
     if (*f != '/')
        return;