[news.misc] Problem with mbox saves - USER FIX

farrell@batserver.cs.uq.oz (Friendless) (12/08/89)

zjat02@apctrc.trc.amoco.com (Jon A. Tankersley) writes:
>A user noticed recently that files saved with the mail box saver show the
>subject the first time they are entered with Mail, and don't thereafter.
>I hadn't really noticed that until he mentioned it.  It seems that the
>Status:  whatever
>has the extra newline in it.  This prevents Mail from looking for the
>subject line.


  My experience is that mail puts the Status line after the first line whose
first word doesn't end in :. For a saved article, this is the Article line.
Mail seems to then put a blank line after the Status line, thus disconnecting
the rest of the header. The only solution I have found is to write a program
which takes out both Article and Status lines. And here it is:

------------------------------------------------------------------------------
/* throw away status lines from mailboxes, and also the line afterwards if 
 * it is blank caused by an "Article" line. */
#include <stdio.h>

main ()

{ char s[128], s1[128];

  while (fgets(s,128,stdin) != NULL) {
      if (strncmp(s,"Status: ",8) == 0) {
          fgets(s,128,stdin);
          fgets(s1,128,stdin);
          /* if the line after is a newline and the line after is an Article
           * line, throw away all three */
	  if ((strlen(s) == 1) && (strncmp(s1,"Article ",8) == 0)) ;
          /* otherwise replace the ones that aren't the Status line */
              else printf("%s%s",s,s1);
          }
        else printf("%s",s);
      }
}
------------------------------------------------------------------------------

  If there is a problem with this program, fix it and let me know. Also, if
anyone wants to fix mail or various newsreaders so that this problem doesn't
occur, let everyone know! I say do away with Status lines altogether. And
Article lines as well.


Friendless