- if ((cp = getenv ("MH")) && *cp != '\0') {
- defpath = path (cp, TFILE);
- if ((ib = fopen (defpath, "r")) == NULL)
- adios (defpath, "unable to read");
- if (*cp != '/')
- m_putenv ("MH", defpath);
- } else {
- defpath = concat (mypath, "/", mh_profile, NULL);
-
- if ((ib = fopen (defpath, "r")) == NULL) {
- switch (pid = vfork ()) {
- case -1:
- adios ("fork", "unable to");
-
- case 0:
- setgid (getgid ());
- setuid (getuid ());
-
- execlp (installproc, "install-mh", "-auto", NULL);
- fprintf (stderr, "unable to exec ");
- perror (installproc);
- _exit (-1);
-
- default:
- if (pidwait (pid, 0)
- || (ib = fopen (defpath, "r")) == NULL)
- adios (NULL, "[install-mh aborted]");
- }
- }
+
+ if ((cp = getenv("MH")) && *cp != '\0') {
+ defpath = path(cp, TFILE);
+
+ 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 ((ib = fopen(defpath, "r")) == (FILE *)0)
+ adios((char *)0, "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.");
+
+ cp = mh_profile;