]> diplodocus.org Git - nmh/blobdiff - uip/rcvdist.c
Support iCalendar event request files that don't end with a newline.
[nmh] / uip / rcvdist.c
index 29b341cadca3835d6222e87ec2e48ceb646c5c8e..4c1716a015c4150f1949b8f1b3e7b4002f34ea0d 100644 (file)
@@ -1,6 +1,4 @@
-
-/*
- * rcvdist.c -- asynchronously redistribute messages
+/* rcvdist.c -- asynchronously redistribute messages
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -89,7 +87,7 @@ main (int argc, char **argv)
                    continue;
            }
        }
-       addrs = addrs ? add (cp, add (", ", addrs)) : getcpy (cp);
+       addrs = addrs ? add (cp, add (", ", addrs)) : mh_xstrdup(cp);
     }
 
     if (addrs == NULL)
@@ -129,7 +127,8 @@ main (int argc, char **argv)
        sleep (5);
     switch (child_id) {
        case NOTOK: 
-           admonish (NULL, "unable to fork");/* fall */
+           inform("unable to fork, continuing...");
+           /* FALLTHRU */
        case OK: 
            execvp (program, vec);
            fprintf (stderr, "unable to exec ");
@@ -145,8 +144,6 @@ main (int argc, char **argv)
 
 /* very similar to routine in replsbr.c */
 
-#define        SBUFSIZ 256
-
 static int outputlinelen = OUTPUTLINELEN;
 
 static struct format *fmt;
@@ -173,11 +170,11 @@ static char *addrcomps[] = {
 static void
 rcvdistout (FILE *inb, char *form, char *addrs)
 {
-    register int char_read = 0, format_len, i, state;
-    register char **ap;
-    char *cp, name[NAMESZ], tmpbuf[SBUFSIZ];
+    int char_read = 0, format_len, i, state;
+    char **ap;
+    char *cp, name[NAMESZ], tmpbuf[NMH_BUFSIZ];
     charstring_t scanl;
-    register struct comp *cptr;
+    struct comp *cptr;
     FILE *out;
     m_getfld_state_t gstate = 0;
 
@@ -200,7 +197,7 @@ rcvdistout (FILE *inb, char *form, char *addrs)
        cptr->c_text = addrs;
 
     for (;;) {
-       int msg_count = SBUFSIZ;
+       int msg_count = sizeof tmpbuf;
        switch (state = m_getfld (&gstate, name, tmpbuf, &msg_count, inb)) {
            case FLD: 
            case FLDPLUS: 
@@ -208,7 +205,7 @@ rcvdistout (FILE *inb, char *form, char *addrs)
                if (i != -1) {
                    char_read += msg_count;
                    while (state == FLDPLUS) {
-                       msg_count = SBUFSIZ;
+                       msg_count = sizeof tmpbuf;
                        state = m_getfld (&gstate, name, tmpbuf, &msg_count, inb);
                        fmt_appendcomp(i, name, tmpbuf);
                        char_read += msg_count;
@@ -216,7 +213,7 @@ rcvdistout (FILE *inb, char *form, char *addrs)
                }
 
                while (state == FLDPLUS) {
-                   msg_count = SBUFSIZ;
+                   msg_count = sizeof tmpbuf;
                    state = m_getfld (&gstate, name, tmpbuf, &msg_count, inb);
                }
                break;