** Find user's home directory. Try the HOME environment variable first,
** the home directory field in the password file if that's not found.
*/
- if ((mypath = getenv("HOME")) == (char *)0) {
+ if ((mypath = getenv("HOME")) == NULL) {
if ((pw = getpwuid(getuid())) == (struct passwd *)0 ||
*pw->pw_dir == '\0')
adios(NULL, "cannot determine your home directory");
*/
if ((cp = getenv("MH")) && *cp != '\0') {
- defpath = path(cp, TFILE);
+ defpath = getcpy(expanddir(cp));
- if (stat(defpath, &st) != -1 && (st.st_mode & S_IFREG) == 0)
- adios((char *)0, "`%s' specified by your MH environment variable is not a normal file", cp);
+ if (stat(defpath, &st) != -1 && (st.st_mode & S_IFREG) == 0)
+ adios(NULL, "`%s' specified by your MH environment variable is not a normal file", cp);
- if ((ib = fopen(defpath, "r")) == (FILE *)0)
- adios((char *)0, "unable to read the `%s' profile specified by your MH environment variable", defpath);
+ if ((ib = fopen(defpath, "r")) == (FILE *)0)
+ adios(NULL, "unable to read the `%s' profile specified by your MH environment variable", defpath);
} else {
defpath = concat(mypath, "/", mh_profile, NULL);
if ((ib = fopen(defpath, "r")) == (FILE *)0)
- adios((char *)0, "Doesn't look like nmh is installed. Run install-mh to do so.");
+ adios(NULL, "Doesn't look like nmh is installed. Run install-mh to do so.");
cp = mh_profile;
}
** one rooted in the home directory.
*/
- if ((cp = context_find("path")) == (char *)0)
+ if ((cp = context_find("path")) == NULL)
adios(NULL, "Your %s file does not contain a path entry.",
defpath);
adios(NULL, "Your `%s' profile file does not contain a valid path entry.", defpath);
if (*cp != '/')
- (void)snprintf(nd = buf, sizeof(buf), "%s/%s", mypath, cp);
+ snprintf(nd = buf, sizeof(buf), "%s/%s", mypath, cp);
else
nd = cp;
if (!makedir(nd))
adios(NULL, "unable to create %s", nd);
} else if ((st.st_mode & S_IFDIR) == 0)
- adios((char *)0, "`%s' is not a directory", nd);
+ adios(NULL, "`%s' is not a directory", nd);
/*
** Open and read user's context file. The name of the context
** environment variable.
*/
- if ((cp = getenv("MHCONTEXT")) == (char *)0 || *cp == '\0')
+ if ((cp = getenv("MHCONTEXT")) == NULL || *cp == '\0')
cp = context;
/*
return;
}
- ctxpath = getcpy(m_maildir(cp));
+ ctxpath = getcpy(toabsdir(cp));
if ((ib = lkfopen(ctxpath, "r"))) {
readconfig((struct node **) 0, ib, cp, 1);