/*
- * install-mh.c -- initialize the nmh environment of a new user
- *
- * 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.
- */
+** install-mh.c -- initialize the nmh environment of a new user
+**
+** 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> /* mh internals */
#include <h/utils.h>
};
/*
- * static prototypes
- */
+** static prototypes
+*/
static char *geta(void);
}
/*
- * Find user's home directory. Try the HOME environment
- * variable first, the home directory field in the password file
- * if that's not found.
- */
+ ** 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 ((pw = getpwuid(getuid())) == (struct passwd *)0 || *pw->pw_dir == '\0')
}
/*
- * Find the user's profile. Check for the existence of an
- * MH environment variable first with non-empty contents.
- * Convert any relative path name found there to an absolute one.
- * Look for the profile in the user's home directory if the MH
- * environment variable isn't set.
- */
+ ** Find the user's profile. Check for the existence of an
+ ** MH environment variable first with non-empty contents.
+ ** Convert any relative path name found there to an absolute one.
+ ** Look for the profile in the user's home directory if the MH
+ ** environment variable isn't set.
+ */
if ((cp = getenv("MH")) && *cp != '\0')
defpath = path(cp, TFILE);
defpath = concat(mypath, "/", mh_profile, NULL);
/*
- * Check for the existence of the profile file. It's an
- * error if it exists and this isn't an installation check.
- * An installation check fails if it does not exist, succeeds
- * if it does.
- */
+ ** Check for the existence of the profile file. It's an
+ ** error if it exists and this isn't an installation check.
+ ** An installation check fails if it does not exist, succeeds
+ ** if it does.
+ */
if (stat (defpath, &st) != NOTOK) {
if (check)
}
/*
- * Add some initial elements to the profile/context list
- */
+ ** Add some initial elements to the profile/context list
+ */
m_defs = (struct node *) mh_xmalloc (sizeof *np);
np = m_defs;
np->n_name = getcpy ("Path");
np->n_next = NULL;
/*
- * If there is a default profile file in the
- * nmh `etc' directory, then read it also.
- */
+ ** If there is a default profile file in the
+ ** nmh `etc' directory, then read it also.
+ */
if ((in = fopen (mh_defaults, "r"))) {
readconfig (&np->n_next, in, mh_defaults, 0);
fclose (in);
context_save ();
/*
- * Now write out the initial .mh_profile
- */
+ ** Now write out the initial .mh_profile
+ */
if ((out = fopen (defpath, "w")) == NULL)
adios (defpath, "unable to write");
for (np = m_defs; np; np = np->n_next) {