Fix spelling errors, including binaries ones
[mmh] / sbr / vfgets.c
index 1a99b76..1ddd99b 100644 (file)
@@ -1,11 +1,12 @@
 /*
- * vfgets.c -- virtual fgets
- *
- * 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.
- */
+** vfgets.c -- virtual fgets
+**
+** 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 <sysexits.h>
 #include <h/mh.h>
 #include <h/utils.h>
 
@@ -13,7 +14,7 @@
 
 
 int
-vfgets (FILE *in, char **bp)
+vfgets(FILE *in, char **bp)
 {
        int toggle;
        char *cp, *dp, *ep, *fp;
@@ -21,21 +22,21 @@ vfgets (FILE *in, char **bp)
        static char *pp = NULL;
 
        if (pp == NULL)
-               pp = mh_xmalloc ((size_t) (len = BUFSIZ));
+               pp = mh_xcalloc(len = BUFSIZ, sizeof(char));
 
        for (ep = (cp = pp) + len - 1;;) {
-               if (fgets (cp, ep - cp + 1, in) == NULL) {
+               if (fgets(cp, ep - cp + 1, in) == NULL) {
                        if (cp != pp) {
                                *bp = pp;
                                return 0;
                        }
-                       return (ferror (in) && !feof (in) ? -1 : 1);
+                       return (ferror(in) && !feof(in) ? -1 : 1);
                }
 
-               if ((dp = cp + strlen (cp) - 2) < cp || *dp != QUOTE) {
+               if ((dp = cp + strlen(cp) - 2) < cp || *dp != QUOTE) {
 wrong_guess:
                        if (cp > ++dp)
-                               adios (NULL, "vfgets() botch -- you lose big");
+                               adios(EX_SOFTWARE, NULL, "vfgets() botch -- you lose big");
                        if (*dp == '\n') {
                                *bp = pp;
                                return 0;
@@ -63,7 +64,7 @@ wrong_guess:
                if (cp >= ep) {
                        int curlen = cp - pp;
 
-                       dp = mh_xrealloc (pp, (size_t) (len += BUFSIZ));
+                       dp = mh_xrealloc(pp, len += BUFSIZ);
                        cp = dp + curlen;
                        ep = (pp = dp) + len - 1;
                }