ashley_at_pcraft.com ("Ashley M. Kirchner") writes: > Could you regenerate a diff patch based on what's on CVS right now, and I'll >look into applying it later tonight and test it before committing it.
require 5.000;
use Getopt::Std;
-getopts('d:m:');
+getopts('ad:H:m:n:R');
# This is a list of the fields in the comment header of each message.
_at_@ -33,11 +47,24 @@
_at_msgs = sort glob($fpat);
+$to_address = $opt_n || 'bogus';
+
# Open the output file for write.
$mbox_name = $opt_m || 'mbox';
-(open MBOX, ">$mbox_name") || die "can't open $mbox_name";
+if ($opt_H) {
+ $opt_H =~ s/%0A/\n/g;
+ chomp($opt_H);
+ $opt_H .= "\n";
+}
+
+if ($opt_a) {
+ $openflag = ">>";
+} else {
+ $openflag = ">";
+}
+(open MBOX, "$openflag$mbox_name") || die "can't open $mbox_name";
# Loop on the input files.
_at_@ -49,6 +76,10 @@
# Open the message file for read.
+ # reset the header count for each message.
+ # added by Erik Peterson 1/3/00.
+ $header_count=0;
+
$cntr += 1;
(open M, $msg) || die "can't open $msg";
_at_@ -56,6 +87,10 @@
# Loop on lines in the file
$state = 'HeaderComments';
+ foreach $fld (_at_fields)
+ {
+ $$fld = '';
my $line;
_at_@ -63,9 +98,10 @@
# This is a header comment; save the value in a variable with the
# same name.
+ $line =~ s|\r(\n)$|\n| if($opt_R);
if($state eq 'HeaderComments'
- && ($line =~ /^<!-- (\w+)="([^\"]+)" -->$/)) {
+ && ($line =~ /^<!-- (\w+)="(.+)" -->(\s*)$/)) {
$key = $1;
$value = $2;
$value =~ s/&/&/g;
_at_@ -84,6 +120,9 @@
{
$date = $1;
}
+ elsif($received =~ /^(\w{3}), (\d{1,2}) (\w{3}) (\d{4}) (\d{2}:\d{2}:\d{2})/) {
+ $date = sprintf("%s %s %.2d %s %s", $1, $3, $2, $5, $4);
+ }
else {
$date = 'Bogus date';
$boguscntr += 1;
_at_@ -92,9 +131,12 @@
print MBOX "From $email $date\n";
print MBOX "Date: $sent\n";
print MBOX "Message-Id: <$id>\n";
- print MBOX "To: bogus\n";
+ print MBOX "To: $to_address\n";
print MBOX "From: $email ($name)\n";
print MBOX "Subject: $subject\n";
+ if ($opt_H) {
+ print MBOX $opt_H;
+ }
if ($inreplyto) {
print MBOX "In-Reply-To: <$inreplyto>\n";
}
# This is a body line.
-# ... then, the body:
+# ... then, the body: (this doesn't seem to have any function - pcm 2000-10-03)
print MBOX _at_body; Received on Wed 04 Oct 2000 02:19:13 AM GMT
This archive was generated by hypermail 2.2.0 : Thu 22 Feb 2007 07:33:52 PM GMT GMT