]> diplodocus.org Git - nmh/blobdiff - uip/install-mh.c
sizeof char is always 1, so don't bother to divide by it.
[nmh] / uip / install-mh.c
index ea4e876b752527de0bf6dc59d69cbc1bd545a0b1..9155b0a9b0ecd1ede4b58d8c96c7aad7f4bf235a 100644 (file)
@@ -1,5 +1,4 @@
-/*
- * install-mh.c -- initialize the nmh environment of a new user
+/* 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
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -8,6 +7,8 @@
 
 #include <h/mh.h>                              /* mh internals */
 #include <h/utils.h>
 
 #include <h/mh.h>                              /* mh internals */
 #include <h/utils.h>
+#include "../sbr/m_maildir.h"
+#include "../sbr/makedir.h"
 #include <pwd.h>                               /* structure for getpwuid() results */
 
 #define INSTALLMH_SWITCHES \
 #include <pwd.h>                               /* structure for getpwuid() results */
 
 #define INSTALLMH_SWITCHES \
@@ -80,8 +81,8 @@ main (int argc, char **argv)
      * the home directory field in the password file if that's not found.
      */
 
      * 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')
+    if ((mypath = getenv("HOME")) == NULL) {
+       if ((pw = getpwuid(getuid())) == NULL || *pw->pw_dir == '\0')
            adios(NULL, "cannot determine your home directory");
        else
            mypath = pw->pw_dir;
            adios(NULL, "cannot determine your home directory");
        else
            mypath = pw->pw_dir;
@@ -143,7 +144,7 @@ main (int argc, char **argv)
        }
     } else {
        if (autof)
        }
     } else {
        if (autof)
-           printf ("I'm going to create the standard nmh path for you.\n");
+           puts("I'm going to create the standard nmh path for you.");
        else
            cp = concat ("Do you want the standard nmh path \"",
                    mypath, "/", "Mail\"? ", NULL);
        else
            cp = concat ("Do you want the standard nmh path \"",
                    mypath, "/", "Mail\"? ", NULL);
@@ -174,7 +175,7 @@ query:
            if (makedir (pathname) == 0)
                adios (NULL, "unable to create %s", pathname);
     } else {
            if (makedir (pathname) == 0)
                adios (NULL, "unable to create %s", pathname);
     } else {
-       printf ("[Using existing directory]\n");
+       puts("[Using existing directory]");
     }
 
     /*
     }
 
     /*
@@ -183,7 +184,7 @@ query:
     NEW(np);
     m_defs = np;
     np->n_name = mh_xstrdup("Path");
     NEW(np);
     m_defs = np;
     np->n_name = mh_xstrdup("Path");
-    np->n_field = getcpy (pathname);
+    np->n_field = mh_xstrdup(pathname);
     np->n_context = 0;
     np->n_next = NULL;
 
     np->n_context = 0;
     np->n_next = NULL;