]> diplodocus.org Git - nmh/blobdiff - sbr/path.c
build_nmh: Use `gzip -d' rather than assume tar has -z.
[nmh] / sbr / path.c
index 7ef83eabd39d1ff8cac24ef7f4089041bac27c3b..fca85229a2d8feea371b364d09635471501fd03b 100644 (file)
@@ -2,14 +2,13 @@
 /*
  * path.c -- return a pathname
  *
 /*
  * 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>
  * 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)
 
 #define        CWD     "./"
 #define        NCWD    (sizeof(CWD) - 1)
@@ -35,7 +34,7 @@ pluspath(char *name)
 char *
 path(char *name, int flag)
 {
 char *
 path(char *name, int flag)
 {
-    register char *cp, *ep;
+    char *cp, *ep;
 
     if ((cp = expath (name, flag))
            && (ep = cp + strlen (cp) - 1) > cp
 
     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)
 {
 static char *
 expath (char *name, int flag)
 {
-    register char *cp, *ep;
+    char *cp, *ep;
     char buffer[BUFSIZ];
 
     if (flag == TSUBCWF) {
     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;
        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;
            free (cp);
        }
        flag = TFOLDER;
@@ -71,13 +70,13 @@ expath (char *name, int flag)
                    && strcmp (name, DOT)
                    && strcmp (name, DOTDOT)
                    && strncmp (name, PWD, NPWD))))
                    && strcmp (name, DOT)
                    && strcmp (name, DOTDOT)
                    && strncmp (name, PWD, NPWD))))
-       return getcpy (name);
+       return mh_xstrdup(name);
 
     if (pwds == NULL)
        pwds = pwd ();
 
     if (strcmp (name, DOT) == 0 || strcmp (name, CWD) == 0)
 
     if (pwds == NULL)
        pwds = pwd ();
 
     if (strcmp (name, DOT) == 0 || strcmp (name, CWD) == 0)
-       return getcpy (pwds);
+       return mh_xstrdup(pwds);
 
     ep = pwds + strlen (pwds);
     if ((cp = strrchr(pwds, '/')) == NULL)
 
     ep = pwds + strlen (pwds);
     if ((cp = strrchr(pwds, '/')) == NULL)
@@ -91,7 +90,7 @@ expath (char *name, int flag)
 
     if (strcmp (name, DOTDOT) == 0 || strcmp (name, PWD) == 0) {
        snprintf (buffer, sizeof(buffer), "%.*s", (int)(cp - pwds), pwds);
 
     if (strcmp (name, DOTDOT) == 0 || strcmp (name, PWD) == 0) {
        snprintf (buffer, sizeof(buffer), "%.*s", (int)(cp - pwds), pwds);
-       return getcpy (buffer);
+       return mh_xstrdup(buffer);
     }
 
     if (strncmp (name, PWD, NPWD) == 0)
     }
 
     if (strncmp (name, PWD, NPWD) == 0)
@@ -100,14 +99,14 @@ expath (char *name, int flag)
        cp = ep;
 
     snprintf (buffer, sizeof(buffer), "%.*s/%s", (int)(cp - pwds), pwds, name);
        cp = ep;
 
     snprintf (buffer, sizeof(buffer), "%.*s/%s", (int)(cp - pwds), pwds, name);
-    return getcpy (buffer);
+    return mh_xstrdup(buffer);
 }
 
 
 static void
 compath (char *f)
 {
 }
 
 
 static void
 compath (char *f)
 {
-    register char *cp, *dp;
+    char *cp, *dp;
 
     if (*f != '/')
        return;
 
     if (*f != '/')
        return;