]> diplodocus.org Git - nmh/blobdiff - uip/install-mh.c
Move the opening brace of a C function to its own line.
[nmh] / uip / install-mh.c
index 3a1fa2a64c940cf152d9c22e237bc39279d573e6..f059296af1c5cffa28a289d3907fa5e0ea195e48 100644 (file)
@@ -31,7 +31,7 @@ DEFINE_SWITCH_ARRAY(INSTALLMH, switches);
 int
 main (int argc, char **argv)
 {
-    int autof = 0;
+    bool autof = false;
     char *cp, buf[BUFSIZ];
     const char *pathname;
     char *dp, **arguments, **argp;
@@ -39,14 +39,14 @@ main (int argc, char **argv)
     struct passwd *pw;
     struct stat st;
     FILE *in, *out;
-    int                check;
+    bool check;
 
-    if (nmh_init(argv[0], 0 /* use context_foil() */ )) { return 1; }
+    if (nmh_init(argv[0], false, false)) { return 1; }
 
     arguments = getarguments (invo_name, argc, argv, 0);
     argp = arguments;
 
-    check = 0;
+    check = false;
 
     while ((dp = *argp++)) {
        if (*dp == '-') {
@@ -55,7 +55,7 @@ main (int argc, char **argv)
                    ambigsw (dp, switches);
                    done (1);
                case UNKWNSW:
-                   adios (NULL, "-%s unknown\n", dp);
+                   die("-%s unknown\n", dp);
 
                case HELPSW:
                    snprintf (buf, sizeof(buf), "%s [switches]", invo_name);
@@ -66,15 +66,15 @@ main (int argc, char **argv)
                    done (0);
 
                case AUTOSW:
-                   autof++;
+                   autof = true;
                    continue;
 
                case CHECKSW:
-                   check = 1;
+                   check = true;
                    continue;
            }
        } else {
-           adios (NULL, "%s is invalid argument", dp);
+           die("%s is invalid argument", dp);
        }
     }
 
@@ -85,7 +85,7 @@ main (int argc, char **argv)
 
     if ((mypath = getenv("HOME")) == NULL) {
        if ((pw = getpwuid(getuid())) == NULL || *pw->pw_dir == '\0')
-           adios(NULL, "cannot determine your home directory");
+           die("cannot determine your home directory");
         mypath = pw->pw_dir;
     }
 
@@ -111,8 +111,8 @@ main (int argc, char **argv)
        if (check)
            done(0);
        if (autof)
-           adios (NULL, "invocation error");
-        adios (NULL, "You already have an nmh profile, use an editor to modify it");
+           die("invocation error");
+        die("You already have an nmh profile, use an editor to modify it");
     }
     if (check)
        done(1);
@@ -168,7 +168,7 @@ query:
        cp = concat ("\"", pathname, "\" doesn't exist; Create it? ", NULL);
        if (autof || read_switch (cp, anoyes))
            if (makedir (pathname) == 0)
-               adios (NULL, "unable to create %s", pathname);
+               die("unable to create %s", pathname);
     } else {
        puts("[Using existing directory]");
     }