#!/usr/bin/perl -w
#
# $Revision: 1.2 $ $Date: 2012-07-26 17:11:47-04 $
# $Source: /home/vogelke/bin/RCS/babyl2mbox,v $
# $Host: sys7.com $
# $UUID: 5a30962c-df75-342c-88b8-8d40ae916da7 $
#
#<babyl2mbox: convert BABYL files to mbox format.

use strict;
my $file;
my $from;

foreach $file (@ARGV) {
    open(F, "< $file") || die "$file: $!\n";
    $from = 'From nobody@nowhere.org Fri Aug 26 16:56:36 2005';

    while (<F>) {
        chomp;
        last if /\*\*\* EOOH \*\*\*/;
        if (/^Mail-from: (.*)/) {
            $from = $1;
        }
    }

    print "$from\n";
    print while <F>;
    print "\n";
    close(F);
}

exit(0);
