]> diplodocus.org Git - nmh/blobdiff - sbr/ruserpass.c
mhlsbr.c: Don't strchr(3) non-string NUL-less buffer.
[nmh] / sbr / ruserpass.c
index 43784d528d02158c3050a90e88dfb836d613162d..5c47aa114a733872bf013af3b38d9b5087918db9 100644 (file)
@@ -1,4 +1,5 @@
-/*
+/* ruserpass.c -- parse .netrc-format file.
+ *
  * Portions of this code are
  * Copyright (c) 1985 Regents of the University of California.
  * All rights reserved.
@@ -80,7 +81,7 @@ ruserpass(const char *host, char **aname, char **apass, int flags)
            switch(t) {
            case DEFAULT:
                usedefault = 1;
-               /* FALL THROUGH */
+               /* FALLTHRU */
 
            case MACH:
                if (!usedefault) {
@@ -107,7 +108,7 @@ ruserpass(const char *host, char **aname, char **apass, int flags)
                            (stb.st_mode & 077) != 0) {
                            /* We make this a fatal error to force the
                               user to correct it. */
-                            advise(NULL, "group or other permissions, %#o, "
+                            inform("group or other permissions, %#o, "
                                 "forbidden: %s", stb.st_mode, credentials_file);
                            adios(NULL, "Remove password or correct file "
                                  "permissions.");
@@ -147,10 +148,10 @@ ruserpass(const char *host, char **aname, char **apass, int flags)
        }
        printf("Name (%s:%s): ", host, myname);
 
-       if (fgets(tmp, sizeof(tmp) - 1, stdin) == NULL) {
+       if (fgets(tmp, sizeof tmp, stdin) == NULL) {
            advise ("tmp", "fgets");
        }
-        TrimSuffixC(tmp, '\n');
+        trim_suffix_c(tmp, '\n');
        if (*tmp != '\0' || myname == NULL) {
            myname = tmp;
        }
@@ -217,7 +218,7 @@ token(char *tokval)
 
     for (t = toktabs; t->tokstr; t++)
        if (!strcmp(t->tokstr, tokval))
-           return (t->tval);
+           return t->tval;
 
-    return (ID);
+    return ID;
 }