#!/usr/bin/perl
# @(#) news2mail Version 1.0
# Incorporate News Messages into a mail forlder
#
# Copyright (c) 1996 Gaspar Sinai <gsinai@gol.com>
#
# I dont want to make the compilation long: please read the separate
# file called COPYING
#
# usage: news2mail articlefile1 [articlefile2 ...]
# Mail folder is printed to stdout

@day = ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri','Sat');

@month = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');

$FILLED=0;
while (<>)
{
	local($msgnum) = @_;
	local($themsg) = "";
	($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time);


	s/\r$//o;
	if (/^Path: /)
	{
		printf "\n" if ($FILLED);
		# blabla Wed Jan  29 19:50:34 GMT 1993
		printf ("From news2mail %s %s %2d %02d:%02d:%02d GMT 19%02d\n", 
			$day[$wday],$month[$mon],$mday,$hour,$min,$sec,$year);
	}
	print ($_);
	$FILLED=1;
}
printf "\n" if ($FILLED);
