Remove tests/inc/test-eom-align
[mmh] / sbr / context_read.c
index 5886c5e..cfdcff2 100644 (file)
@@ -25,6 +25,7 @@
 */
 
 #include <h/mh.h>    /* mh internals */
+#include <h/utils.h>
 #include <errno.h>   /* system call errors */
 #include <pwd.h>     /* structure for getpwuid() results */
 #include <unistd.h>
@@ -38,8 +39,8 @@ context_read(void)
        char *cp;                    /* miscellaneous pointer            */
        char *nd;                    /* nmh directory pointer            */
        struct stat st;              /* stat() results                   */
-       register struct passwd *pw;  /* getpwuid() results               */
-       register FILE *ib;           /* profile and context file pointer */
+       struct passwd *pw;           /* getpwuid() results               */
+       FILE *ib;                    /* profile and context file pointer */
 
        /*
        ** If this routine _is_ called again (despite the wanings in the
@@ -64,7 +65,7 @@ context_read(void)
        ** set mmhpath
        */
        if ((cp = getenv("MMH")) && *cp) {
-               mmhpath = getcpy(expanddir(cp));  /* rel to cwd */
+               mmhpath = mh_xstrdup(expanddir(cp));  /* rel to cwd */
                if (stat(mmhpath, &st) != -1 && (st.st_mode & S_IFDIR) == 0) {
                        adios(EX_CONFIG, NULL, "`%s' specified by your MMH environment variable is not a directory", cp);
                }
@@ -82,7 +83,7 @@ context_read(void)
        */
        if ((cp = getenv("MMHP")) && *cp) {
                if (*cp == '/') {
-                       defpath = getcpy(cp);
+                       defpath = mh_xstrdup(cp);
                } else {
                        defpath = concat(mmhpath, "/", cp, NULL);
                }
@@ -126,7 +127,7 @@ context_read(void)
                if (!getanswer(cp)) {
                        adios(EX_NOPERM, NULL, "Unable to access the mail storage directory `%s'", nd);
                }
-               free(cp);
+               mh_free0(&cp);
                if (!makedir(nd)) {
                        adios(EX_CANTCREAT, nd, "unable to create");
                }
@@ -168,7 +169,7 @@ context_read(void)
        }
 
        if (*cp == '/') {
-               ctxpath = getcpy(cp);
+               ctxpath = mh_xstrdup(cp);
        } else {
                ctxpath = concat(mmhpath, "/", cp, NULL);
        }