]> diplodocus.org Git - nmh/blobdiff - uip/distsbr.c
Removed a local variable from m_Eom().
[nmh] / uip / distsbr.c
index c0e45fe0830efdd95aca8c6e51e278971d3562b6..c9f6656b6842ca38bc62e5f80cd48e4f3fc0a563 100644 (file)
@@ -1,5 +1,4 @@
-/*
- * distsbr.c -- routines to do additional "dist-style" processing
+/* distsbr.c -- routines to do additional "dist-style" processing
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -9,6 +8,7 @@
 #include <h/mh.h>
 #include <fcntl.h>
 #include <h/utils.h>
+#include "../sbr/m_mktemp.h"
 
 static int  hdrfd = NOTOK;
 static int  txtfd = NOTOK;
@@ -28,7 +28,7 @@ distout (char *drft, char *msgnam, char *backup)
 {
     int state;
     char *dp, *resent;
-    char name[NAMESZ], buffer[BUFSIZ];
+    char name[NAMESZ], buffer[NMH_BUFSIZ];
     FILE *ifp, *ofp;
     m_getfld_state_t gstate = 0;
 
@@ -42,7 +42,7 @@ distout (char *drft, char *msgnam, char *backup)
     chmod (drft, m_gmprot ());
 
     ready_msg (msgnam);
-    lseek (hdrfd, (off_t) 0, SEEK_SET); /* msgnam not accurate */
+    lseek(hdrfd, 0, SEEK_SET); /* msgnam not accurate */
     cpydata (hdrfd, fileno (ofp), msgnam, drft);
 
     for (resent = NULL;;) {
@@ -111,7 +111,7 @@ process: ;
     free (resent);
 
     if (txtfd != NOTOK) {
-       lseek (txtfd, (off_t) 0, SEEK_SET); /* msgnam not accurate */
+       lseek(txtfd, 0, SEEK_SET); /* msgnam not accurate */
        cpydata (txtfd, fileno (ofp), msgnam, drft);
     }
 
@@ -125,15 +125,19 @@ static void
 ready_msg (char *msgnam)
 {
     int state, out;
-    char name[NAMESZ], buffer[BUFSIZ], tmpfil[BUFSIZ];
+    char name[NAMESZ], buffer[NMH_BUFSIZ], tmpfil[BUFSIZ];
     FILE *ifp, *ofp;
     char *cp = NULL;
     m_getfld_state_t gstate = 0;
 
-    if (hdrfd != NOTOK)
-       close (hdrfd), hdrfd = NOTOK;
-    if (txtfd != NOTOK)
-       close (txtfd), txtfd = NOTOK;
+    if (hdrfd != NOTOK) {
+        close (hdrfd);
+        hdrfd = NOTOK;
+    }
+    if (txtfd != NOTOK) {
+        close (txtfd);
+        txtfd = NOTOK;
+    }
 
     if ((ifp = fopen (msgnam, "r")) == NULL)
        adios (msgnam, "unable to open message");