nmh-workers
[Top] [All Lists]

[Nmh-workers] patch for burst-ing mailman digests

2004-01-14 17:30:05

<http://www.nongnu.org/nmh/> points to <http://www.nongnu.org/nmh/nmh-bugs.html>
which points to nmh-bugs(_at_)mhost(_dot_)com which doesn't seem to exist.

     #      <nmh-bugs(_at_)mhost(_dot_)com>                              #
     #        (reason: 550 5.1.1 <nmh-bugs(_at_)mhost(_dot_)com>... User 
unknown)


------- Forwarded Message

Date:    Wed, 14 Jan 2004 02:32:32 -0800
From:    Mark Wagner 
<markwag(_at_)gandalf(_dot_)radonc(_dot_)washington(_dot_)edu>
To:      mailto: ;
Subject: burst-ing mailman digests

The nmh-cvs from 2004-01-09 still can't burst mailman
digests. I could only find this message about it:
<http://mail.python.org/pipermail/mailman-users/1999-August/001932.html>.

Most of Savannah had fallen off the earth when I was looking
but I see pieces of it are back now. In particular

<http://savannah.nongnu.org/bugs/?func=detailitem&item_id=1466>

mentions the problem.

Apparently RFC934 lets anything that starts with "-" but not with "- "
serve as a separator. That's great. The following patch, developed
before Savannah re-emerged, doesn't do anything fancy like splitting a
digest on "^-[^ ]?" (which would certainly match all sig delimiters "-- ":
WTF?). Rather, it makes delim3 into an array of possible delimiters,
adding mailman's.

The one part I'm not sure of is changing "return (msgp - 1)"
to "return (msgp - 2)." It works for mailman. It probably
chops off the last message for non-mailman digests.

--- uip/burst.c.dist    2004-01-13 19:42:34.000000000 -0800
+++ uip/burst.c 2004-01-14 02:11:58.000000000 -0800
@@ -31,7 +31,9 @@
     { NULL, 0 }
 };
 
-static char delim3[] = "-------";
+static char *delims[] = { "--__--__--",
+                         "-------",
+                         NULL };
 
 struct smsg {
     long s_start;
@@ -207,8 +209,9 @@
     int cc;
     char buffer[BUFSIZ];
     FILE *in;
+    int founddlm, delim3, pos_delim;
 
-    ld3 = strlen (delim3);
+    /* ld3 = strlen (delims[0]); */
 
     if ((in = fopen (msgnam = m_name (msgnum), "r")) == NULL)
        adios (msgnam, "unable to read message");
@@ -222,15 +225,24 @@
        smsgs[msgp].s_start = pos;
 
        for (c = 0; fgets (buffer, sizeof(buffer), in); c = buffer[0]) {
-           if (strncmp (buffer, delim3, ld3) == 0
-                   && (msgp == 1 || c == '\n')
-                   && ((cc = peekc (in)) == '\n' || cc == EOF))
-               break;
-           else
-               pos += (long) strlen (buffer);
+               founddlm = 0;
+               for (delim3 = 0; delims[delim3] != NULL; delim3++) {
+                       pos_delim = pos;
+                       ld3 = strlen (delims[delim3]);
+                       if (strncmp (buffer, delims[delim3], ld3) == 0
+                           && (msgp == 1 || c == '\n')
+                           && ((cc = peekc (in)) == '\n' || cc == EOF)) {
+                               founddlm = 1;
+                               break;
+                       }
+                       else
+                               pos_delim += (long) strlen (buffer);
+               }
+               if (founddlm) break;
+               pos = pos_delim;
        }
 
-       wasdlm = strncmp (buffer, delim3, ld3) == 0;
+       wasdlm = founddlm && strncmp (buffer, delims[delim3], ld3) == 0;
        if (smsgs[msgp].s_start != pos)
            smsgs[msgp++].s_stop = (c == '\n' && wasdlm) ? pos - 1 : pos;
        if (feof (in)) {
@@ -246,7 +258,7 @@
     }
 
     fclose (in);
-    return (msgp - 1);         /* toss "End of XXX Digest" */
+    return (msgp - 2);         /* toss "End of XXX Digest" */
 }

-- 
Mark Wagner markwag(_at_)u(_dot_)washington(_dot_)edu 206-598-0302
Unix System Administrator, Radiation Oncology and Radiology

------- End of Forwarded Message



_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
http://mail.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>
  • [Nmh-workers] patch for burst-ing mailman digests, markwag+nmh <=