]> diplodocus.org Git - nmh/blobdiff - uip/distsbr.c
showfile.c: Move interface to own file.
[nmh] / uip / distsbr.c
index f29426e24c37a129f90cf0a3de9de88751a82326..4e931ecbcf9dee5223533e73a9db6dcb2f8a796d 100644 (file)
@@ -5,10 +5,14 @@
  * complete copyright information.
  */
 
-#include <h/mh.h>
+#include "h/mh.h"
+#include "sbr/cpydata.h"
+#include "sbr/uprf.h"
+#include "sbr/m_backup.h"
+#include "sbr/error.h"
 #include <fcntl.h>
-#include <h/utils.h>
-#include "../sbr/m_mktemp.h"
+#include "h/utils.h"
+#include "sbr/m_mktemp.h"
 
 static int  hdrfd = NOTOK;
 static int  txtfd = NOTOK;
@@ -93,7 +97,7 @@ distout (char *drft, char *msgnam, char *backup)
                return NOTOK;
 
            default: 
-               adios (NULL, "getfld() returned %d", state);
+               die("getfld() returned %d", state);
        }
     }
 process: ;
@@ -145,12 +149,12 @@ ready_msg (char *msgnam)
 
     cp = m_mktemp2(NULL, "dist", &hdrfd, NULL);
     if (cp == NULL) {
-       adios(NULL, "unable to create temporary file in %s", get_temp_dir());
+       die("unable to create temporary file in %s", get_temp_dir());
     }
     strncpy(tmpfil, cp, sizeof(tmpfil));
     if ((out = dup (hdrfd)) == NOTOK
            || (ofp = fdopen (out, "w")) == NULL)
-       adios (NULL, "no file descriptors -- you lose big");
+       die("no file descriptors -- you lose big");
     (void) m_unlink (tmpfil);
 
     gstate = m_getfld_state_init(ifp);
@@ -174,14 +178,14 @@ ready_msg (char *msgnam)
 
                 cp = m_mktemp2(NULL, "dist", &txtfd, NULL);
                 if (cp == NULL) {
-                   adios(NULL, "unable to create temporary file in %s",
+                   die("unable to create temporary file in %s",
                          get_temp_dir());
                 }
                 fchmod(txtfd, 0600);
                strncpy (tmpfil, cp, sizeof(tmpfil));
                if ((out = dup (txtfd)) == NOTOK
                        || (ofp = fdopen (out, "w")) == NULL)
-                   adios (NULL, "no file descriptors -- you lose big");
+                   die("no file descriptors -- you lose big");
                (void) m_unlink (tmpfil);
                fprintf (ofp, "\n%s", buffer);
                while (state == BODY) {
@@ -194,10 +198,10 @@ ready_msg (char *msgnam)
 
            case LENERR: 
            case FMTERR: 
-               adios (NULL, "format error in message %s", msgnam);
+               die("format error in message %s", msgnam);
 
            default: 
-               adios (NULL, "getfld() returned %d", state);
+               die("getfld() returned %d", state);
        }
     }
 process: ;