CVS update: CVSROOT

From: Date: Sat, 17 Jul 1999 22:45:10 +0000
Subject: CVS update: CVSROOT
Groups: php.dev 
Request: Send a blank email to php-dev+get-8668@lists.php.net to get a copy of this message
Date: Saturday July 17, 1999 @ 18:45 Author: sas Update of /repository/CVSROOT In directory php:/tmp/cvs-serv19381 Modified Files: loginfo.pl Log Message: merge in changes Index: CVSROOT/loginfo.pl diff -u CVSROOT/loginfo.pl:1.3 CVSROOT/loginfo.pl:1.4 --- CVSROOT/loginfo.pl:1.3 Fri Jul 2 19:48:02 1999 +++ CVSROOT/loginfo.pl Sat Jul 17 18:45:10 1999 @@ -21,7 +21,7 @@ $mailfrom = shift; $mailto = $mailfrom; -$cvsuser = shift; #|| getlogin() || getpwuid($<) || "cvsuser"; +$cvsuser = shift; @args = split(" ", $ARGV[0]); $directory = $args[0]; @@ -58,13 +58,12 @@ chop; ($file, $first, $last) = split(","); - $msg = " $file\n"; if($first eq "NONE") { - $added_files .= $msg; + push @added_files, $file; } elsif($last eq "NONE") { - $removed_files .= $msg; + push @removed_files, $file; } else { - $modified_files .= $msg; + push @modified_files, $file; $cmdline .= " $file"; } } @@ -85,33 +84,114 @@ # build our email +sub build_list { + my(@arr) = @_; + my($curdir, $msg); + + $msg = ""; + $curdir = ""; + foreach (@arr) { + /^(.*)\/([^\/]+)$/; + $dir = $1; + $file = $2; + if($dir ne $curdir) { + $curdir = $dir; + $msg .= "\n /$curdir\t"; + $curlen = length($curdir) + 5; + } + if(($curlen + length($file)) > 70) { + $msg .= "\n ".sprintf("%-".length($curdir)."s", "")."\t"; + $curlen = length($curdir) + 5; + } + $msg .= $file." "; + $curlen += length($file) + 1; + } + + $msg .= "\n"; + + return $msg; +} + +sub myindent { + my($msg,$nr) = @_; + my $s = sprintf("%-$nr"."s", ""); + $msg =~ s/\n/\n$s/g; + $msg = "$s$msg"; + return $msg; +} + $msg = ""; -if($added_files ne "") { - $msg .= "\nAdded files:\n$added_files\n"; +if($#added_files ne -1) { + $msg .= "\n Added files:"; + $list = build_list(@added_files); + $msg .= $list; + $subj .= $list; +} +if($#removed_files ne -1) { + $msg .= "\n Removed files:"; + $list = build_list(@removed_files); + $msg .= $list; + $subj .= $list; } -if($removed_files ne "") { - $msg .= "\nRemoved files:\n$removed_files\n"; +if($#modified_files ne -1) { + $msg .= "\n Modified files:"; + $list = build_list(@modified_files); + $msg .= $list; + $subj .= $list; } -if($modified_files ne "") { - $msg .= "\nModified files:\n$modified_files\n"; + + +sub trim { + my($x) = @_; + $x =~ s/^\s+//; + $x =~ s/\s+$//; + return $x; } +$msgid = "Message-ID: <cvs$cvsuser".time()."\@cvsserver>\n"; + +$cvsusers = "/repository/CVSROOT/cvsusers"; + +open(FD, $cvsusers); + +while(<FD>) { + chop; + /^([a-z]{2,}?)\s(.*)\s+([a-z0-9-\.]+@[a-z0-9-\.]+).*$/i; + $handles{$1} = [trim($2), trim($3)] if($1 ne ""); +} + +close(FD); + +if(defined($handles{$cvsuser})) { + $from = $handles{$cvsuser}[0]." <".$handles{$cvsuser}[1].">"; +} else { + $from = "$cvsuser <$mailfrom>"; +} + +$subj =~ s/\s/ /g; +1 while $subj =~ s/\s{2,}?/ /g; + +# "Reply-to: $mailto\n". + $email = "". -"From: $cvsuser <$mailfrom>\n". +"From: $from\n". "To: $mailto\n". -"Subject: cvs commit\n". -"\n". -"From: $cvsuser\n". +$msgid. "Date: ".localtime()."\n". +"Subject: cvs:$subj\n". +"\n". +"$cvsuser\t\t".localtime()." EDT\n". "$msg". -"Log message:\n". -"$logmsg\n". +" Log:\n". +myindent($logmsg,2)."\n". "$diffmsg\n"; $email =~ s/\r//g; $email =~ s/\n/\r\n/g; # send our email + +#print $email; $paddr = sockaddr_in($smtpport, inet_aton($smtpserver)); socket(SOCK, PF_INET, SOCK_STREAM, 0) || die "socket failed";

« previous php.dev (#8668) next »