<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl
#
# cvsform.pl by Morikawa Yasuhiro, 2004
#   original is cvsdiff.pl by TOYODA Eizi, 2001

$mailto0 = 'foo@gfd-dennou.org';
$project = 'hoge0';
$charcode = 'iso-2022-jp';

# umask 0;
# open(LOG, "&gt;/tmp/cvsform.tmp");

$mailto = $ARGV[0] || $mailto0;
$loginfo = $ARGV[1];
$user = $ENV{'USER'} || $ENV{'LOGNAME'} || $&lt;;

# GMT Time
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time);
$date = sprintf("%04d-%02d-%02dT%02d:%02d-00:00",
		$year + 1900, $mon + 1, $mday, $hour, $min);

# # Local Time (Assume Japan Time)
# ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
# $localdate = sprintf("%04d-%02d-%02dT%02d:%02d+09:00",
# 		     $year + 1900, $mon + 1, $mday, $hour, $min);

open(MAIL, "|nkf|/usr/lib/sendmail $mailto"); # convert to JIS
select(MAIL);
print &lt;&lt;EOF;
From: $user\@gfd-dennou.org
To: $mailto
Subject: ${project}-cvs-commit $date
Mime-Version: 1.0
Content-Type: Text/Plain; charset=$charcode
Content-Transfer-Encoding: 8bit

EOF

@loginfo = split(/\s/, $loginfo);
$path = shift @loginfo;
$number = scalar(@loginfo);

if ($loginfo[0] eq '-') {
    @loginfo = ('.,NONE,NONE');
}

$s = 's' if $number != 1;

print &lt;&lt;EOF;
At $date, user $user commited following $number file$s.

EOF
foreach $hunc (@loginfo) {
    ($fnam, $old, $new) = split(/,/, $hunc);
    print &lt;&lt;EOF;
$path/$fnam: $old to $new
EOF
}

print &lt;&lt;EOF;

EOF

while (&lt;STDIN&gt;) {
    s/\x0D\x0A|\x0D|\x0A/\n/g;  # convert each OS linefeed code to "\n"
    print;
}

close(MAIL);
</pre></body></html>