🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nn
2 messages
2 total messages Started by jun shih Sun, 13 Mar 1994 04:52
mail-format (converting)
#5568
Author: jun shih
Date: Sun, 13 Mar 1994 04:52
8 lines
856 bytes
Is there a way to convert saved nn file (non mail format) to a mail-format
file?

Thanks in advance.
-- 

---
Jun Shih:  umshih02@cc.umanitoba.ca
Re: mail-format (converting)
#5600
Author: Ofer Inbar
Date: Sat, 19 Mar 1994 18:44
46 lines
2558 bytes
umshih02@cc.umanitoba.ca (jun shih) writes:
>Is there a way to convert saved nn file (non mail format) to a mail-format

The key difference is the absence of From_ lines at the beginning of
each set of headers.  You could manually add the From_ line for each
message, if it's a short file.  The format of a From_ line is:

From <user> <date>

The <user> field cannot contain any comments (i.e. the real name), and
the <date> should be in the same format returned by the Unix date command.

If it's a long folder, you can try to use this perl script I wrote
back when I had to convert a whole bunch of files to mail-format.  I
won't guarantee that it'll work - it takes the date from the Date:
header to put in the From_ line, and some mailers (notably elm 2.4)
can get really picky about what date formats they'll recognize.
Anyway, you could always modify the script if it doesn't work for you.

------------------------------------------------------------
#!/usr/bin/perl

while (<>)
{ if (/^Path: .*\w!\w/i || /^Xref: *\w+[\w.,]+/i
                        || /^Newsgroups: *\w+[\w.,]+/i)
  { &processheaders; } else { print; }
}
        
sub processheaders
{ local ($lnum);
  $headers[$lnum++] = $_ if /^Newsgroups:/i;
  header: while (<>)
  { $headers[$lnum++] = $_ unless (/^Path:/i || /^Xref:/i);
    last header if /^$/;
    $from = $1 if /^From: *(\w+[@%!.][\w@%!:.]+)/i;
    $date = $1 if /^Date: *(.*)/i;
  }
  warn "EOF inside a header block\n" unless /^$/;
  print "From $from $date\n";
  foreach (@headers) { print; }
}

  --  Cos (Ofer Inbar)  --  cos@cs.brandeis.edu
  --  WBRS (BRiS)  --  WBRS@binah.cc.brandeis.edu  WBRS@brandeis.bitnet
 Brandeis University Computer Science Department         (617) 736-2700
 415 South Street, Waltham MA, 02254-9110        System Admin: 736-2717
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads