#!/usr/bin/perl

=head1 NAME

al2wl-addr - al2wl convert address book from AL-Mail32 to Wanderlust.

=head1 SYNOPSIS

$ al2wl-addr
STDIN:	Address book data of AL-Mail32.
STDOUT:	Address book data of Wanderlust.

=head1 DESCRIPTION

At first, you must copy a file of AL-Mail32 address data to Linux.

(ex)c:\Program Files\Almail32\Mailbox\Address

If you copy to home direcotry, you must type following on terminal.

$ iconv -f sjis -t iso-2022-jp ~/Address | al2wl-addr >> ~/.addresses

or

$ nkf --jis ~/Address | al2wl-addr >> ~/.addresses

=head1 AUTHOR

Yasumichi Akahoshi <yasumichi@users.sourceforge.jp>

=head1 SEE ALSO

al2mh

=cut

# convert each line.

foreach $line (<STDIN>) {
	$line =~ s/\r\n/\n/;
	if($line =~ /(.*): ([\w\.-]+@.*)/) {
		$name = $1;
		@addrs = split(/,/, $2);	# split name and address.
		foreach $addr (@addrs) {
			print "$addr\t\"\"\t\"$name\"\n";
		}
	}
}
