+ /*
+ ** Find and read user's profile. Check for the existence of
+ ** a non-empty MMHP environment variable first. Look for the
+ ** profile in the mmh directory otherwise.
+ */
+ if ((cp = getenv("MMHP")) && *cp) {
+ if (*cp == '/') {
+ defpath = mh_xstrdup(cp);
+ } else {
+ defpath = concat(mmhpath, "/", cp, NULL);
+ }
+ if (stat(defpath, &st) != -1 && (st.st_mode & S_IFREG) == 0) {
+ adios(EX_CONFIG, NULL, "Your profile `%s', specified by the MMHP environment variable, is not a normal file", cp);
+ }
+ if ((ib = fopen(defpath, "r")) == (FILE *)0) {
+ adios(EX_IOERR, NULL, "Unable to read your profile `%s', specified by the MMHP environment variable", defpath);
+ }
+ } else {
+ defpath = concat(mmhpath, "/", profile, NULL);
+ if ((ib = fopen(defpath, "r")) == (FILE *)0) {
+ adios(EX_CONFIG, NULL, "No profile found. Please create `%s' first.", defpath);
+ }
+ cp = profile;
+ }