]> diplodocus.org Git - nmh/blobdiff - uip/install-mh.c
Always initialize those two variables made static in commit
[nmh] / uip / install-mh.c
index 0fc97c45353f3f63d1a7ed039dc8ee8c7994e068..ce8e2940c112e94dfc35fc29d1348617944cb8cb 100644 (file)
@@ -42,8 +42,8 @@ main (int argc, char **argv)
     FILE *in, *out;
     int                check;
 
     FILE *in, *out;
     int                check;
 
-    setlocale(LC_ALL, "");
-    invo_name = r1bindex (argv[0], '/');
+    if (nmh_init(argv[0], 0 /* use context_foil() */ )) { return 1; }
+
     arguments = getarguments (invo_name, argc, argv, 0);
     argp = arguments;
 
     arguments = getarguments (invo_name, argc, argv, 0);
     argp = arguments;
 
@@ -166,7 +166,9 @@ query:
        }
     }
 
        }
     }
 
-    chdir (mypath);
+    if (chdir (mypath) < 0) {
+       advise (mypath, "chdir");
+    }
     if (chdir (pathname) == NOTOK) {
        cp = concat ("\"", pathname, "\" doesn't exist; Create it? ", NULL);
        if (autof || gans (cp, anoyes))
     if (chdir (pathname) == NOTOK) {
        cp = concat ("\"", pathname, "\" doesn't exist; Create it? ", NULL);
        if (autof || gans (cp, anoyes))
@@ -206,6 +208,13 @@ query:
      */
     if ((out = fopen (defpath, "w")) == NULL)
        adios (defpath, "unable to write");
      */
     if ((out = fopen (defpath, "w")) == NULL)
        adios (defpath, "unable to write");
+    /*
+     * The main purpose of this first line is to fool file(1).
+     * Without it, if the first line of the profile is Path:,
+     * file 5.19 reports its type as message/news.  With it,
+     * it reports the type as text/plain.
+     */
+    fprintf (out, "MH-Profile-Version: 1.0\n");
     for (np = m_defs; np; np = np->n_next) {
        if (!np->n_context)
            fprintf (out, "%s: %s\n", np->n_name, np->n_field);
     for (np = m_defs; np; np = np->n_next) {
        if (!np->n_context)
            fprintf (out, "%s: %s\n", np->n_name, np->n_field);