]> diplodocus.org Git - nmh/blobdiff - uip/ap.c
lock_file.c: close(2) file descriptor on failure, avoiding leak.
[nmh] / uip / ap.c
index 1b1fee3ca4ac8dc7da0a23725323afd4161571f9..8265723e8c981581aa1f9e702a5e0b28e81a9dec 100644 (file)
--- a/uip/ap.c
+++ b/uip/ap.c
@@ -1,6 +1,4 @@
-
-/*
- * ap.c -- parse addresses 822-style
+/* ap.c -- parse addresses 822-style
  *
  * 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
@@ -12,6 +10,7 @@
 #include <h/fmt_scan.h>
 #include <h/mts.h>
 #include <h/utils.h>
 #include <h/fmt_scan.h>
 #include <h/mts.h>
 #include <h/utils.h>
+#include "sbr/terminal.h"
 
 #define        NADDRS  100
 
 
 #define        NADDRS  100
 
@@ -97,8 +96,7 @@ main (int argc, char **argv)
        }
        if (addrp == NADDRS)
            adios (NULL, "more than %d addresses", NADDRS);
        }
        if (addrp == NADDRS)
            adios (NULL, "more than %d addresses", NADDRS);
-       else
-           addrs[addrp++] = cp;
+        addrs[addrp++] = cp;
     }
     addrs[addrp] = NULL;
 
     }
     addrs[addrp] = NULL;
 
@@ -130,7 +128,7 @@ main (int argc, char **argv)
        status += process (addrs[addrp], width);
 
     fmt_free (fmt, 1);
        status += process (addrs[addrp], width);
 
     fmt_free (fmt, 1);
-    done (status);
+    done(!!status);
     return 1;
 }
 
     return 1;
 }
 
@@ -173,13 +171,13 @@ process (char *arg, int length)
 
        cptr = fmt_findcomp ("text");
        if (cptr) {
 
        cptr = fmt_findcomp ("text");
        if (cptr) {
-            mh_xfree(cptr->c_text);
+            free(cptr->c_text);
            cptr->c_text = p->pq_text;
            p->pq_text = NULL;
        }
        cptr = fmt_findcomp ("error");
        if (cptr) {
            cptr->c_text = p->pq_text;
            p->pq_text = NULL;
        }
        cptr = fmt_findcomp ("error");
        if (cptr) {
-            mh_xfree(cptr->c_text);
+            free(cptr->c_text);
            cptr->c_text = p->pq_error;
            p->pq_error = NULL;
        }
            cptr->c_text = p->pq_error;
            p->pq_error = NULL;
        }
@@ -188,8 +186,8 @@ process (char *arg, int length)
        fputs (charstring_buffer (scanl), stdout);
        charstring_free (scanl);
 
        fputs (charstring_buffer (scanl), stdout);
        charstring_free (scanl);
 
-        mh_xfree(p->pq_text);
-        mh_xfree(p->pq_error);
+        free(p->pq_text);
+        free(p->pq_error);
        q = p->pq_next;
        free(p);
     }
        q = p->pq_next;
        free(p);
     }