summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/cvs/contrib/log.pl
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/cvs/contrib/log.pl')
-rw-r--r--gnu/usr.bin/cvs/contrib/log.pl126
1 files changed, 85 insertions, 41 deletions
diff --git a/gnu/usr.bin/cvs/contrib/log.pl b/gnu/usr.bin/cvs/contrib/log.pl
index a6c75f6..d68cc82 100644
--- a/gnu/usr.bin/cvs/contrib/log.pl
+++ b/gnu/usr.bin/cvs/contrib/log.pl
@@ -1,5 +1,9 @@
-#!/usr/bin/perl
+#! /local/bin/perl
+# Modified by woods@web.apc.org to add support for mailing 3/29/93
+# use '-m user' for each user to receive cvs log reports
+# and use '-f logfile' for the logfile to append to
+#
# Modified by berliner@Sun.COM to add support for CVS 1.3 2/27/92
#
# Date: Tue, 6 Aug 91 13:27 EDT
@@ -11,94 +15,134 @@
# now the output looks like this:
#
# **************************************
-# date: Tuesday, August 6, 1991 @ 13:17
-# author: samborn
+# Date: Tuesday, August 6, 1991 @ 13:17
+# Author: samborn
+#
# Update of /elmer/cvs/CVSROOT.adm
# In directory astro:/home/samborn/CVSROOT.adm
#
# Modified Files:
# test3
-#
# Added Files:
# test6
-#
# Removed Files:
# test4
-#
# Log Message:
# wow, what a test
#
-# RCS: 1.4 /elmer/cvs/CVSROOT.adm/test3,v
-# RCS: 1.1 /elmer/cvs/CVSROOT.adm/test6,v
-# RCS: 1.1 /elmer/cvs/CVSROOT.adm/Attic/test4,v
+# File: test.3 Status: Up-to-date
+# Version: 1.4 Thu Apr 29 14:47:07 EDT 1993
+# File: test6 Status: Up-to-date
+# Version: 1.1 Thu Apr 29 14:47:33 EDT 1993
+# File: test4 Status: Up-to-date
+# Version: 1.1 Thu Apr 29 14:47:46 EDT 1993
#
-#
+$cvsroot = $ENV{'CVSROOT'};
+
# turn off setgid
#
$) = $(;
-#
# parse command line arguments
#
-@files = split(/ /,$ARGV[0]);
-$logfile = $ARGV[1];
-$cvsroot = $ENV{'CVSROOT'};
+while (@ARGV) {
+ $arg = shift @ARGV;
+
+ if ($arg eq '-m') {
+ $users = "$users " . shift @ARGV;
+ } elsif ($arg eq '-f') {
+ ($logfile) && die "Too many '-f' args";
+ $logfile = shift @ARGV;
+ } else {
+ ($donefiles) && die "Too many arguments!\n";
+ $donefiles = 1;
+ @files = split(/ /, $arg);
+ }
+}
+
+$srepos = shift @files;
+$mailcmd = "| Mail -s 'CVS update: $srepos'";
-#
# Some date and time arrays
#
@mos = (January,February,March,April,May,June,July,August,September,
October,November,December);
@days = (Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday);
+
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime;
-#
# get login name
#
$login = getlogin || (getpwuid($<))[0] || "nobody";
-#
# open log file for appending
#
-if ((open(OUT, ">>" . $logfile)) != 1) {
- die "Could not open logfile " . $logfile . "\n";
+open(OUT, ">>" . $logfile) || die "Could not open(" . $logfile . "): $!\n";
+if ($users) {
+ $mailcmd = "$mailcmd $users";
+ open(MAIL, $mailcmd) || die "Could not Exec($mailcmd): $!\n";
}
-#
-# Header
+# print out the log Header
#
print OUT "\n";
print OUT "**************************************\n";
-print OUT "date: " . $days[$wday] . ", " . $mos[$mon] . " " . $mday . ", 19" . $year .
- " @ " . $hour . ":" . sprintf("%02d", $min) . "\n";
-print OUT "author: " . $login . "\n";
+print OUT "Date:\t$days[$wday] $mos[$mon] $mday, 19$year @ $hour:" . sprintf("%02d", $min) . "\n";
+print OUT "Author:\t$login\n\n";
-#
-#print the stuff on stdin to the logfile
+if (MAIL) {
+ print MAIL "\n";
+ print MAIL "Date:\t$days[$wday] $mos[$mon] $mday, 19$year @ $hour:" . sprintf("%02d", $min) . "\n";
+ print MAIL "Author:\t$login\n\n";
+}
+
+# print the stuff from logmsg that comes in on stdin to the logfile
#
open(IN, "-");
-while(<IN>) {
- print OUT $_;
+while (<IN>) {
+ print OUT $_;
+ if (MAIL) {
+ print MAIL $_;
+ }
}
close(IN);
print OUT "\n";
-#
# after log information, do an 'cvs -Qn status' on each file in the arguments.
#
-for $file (@files[1..$#files]) {
- if ($file eq "-") {
- last;
- }
- open(RCS,"-|") || exec 'cvs', '-Qn', 'status', $file;
- while (<RCS>) {
- if (substr($_, 0, 7) eq " RCS") {
- print OUT;
- }
- }
- close (RCS);
+while (@files) {
+ $file = shift @files;
+ if ($file eq "-") {
+ print OUT "[input file was '-']\n";
+ if (MAIL) {
+ print MAIL "[input file was '-']\n";
+ }
+ last;
+ }
+
+ open(RCS, "-|") || exec 'cvs', '-Qn', 'status', $file;
+
+ while (<RCS>) {
+ if (/^[ \t]*Version/ || /^File:/) {
+ print OUT;
+ if (MAIL) {
+ print MAIL;
+ }
+ }
+ }
+ close(RCS);
}
-close (OUT);
+close(OUT);
+die "Write to $logfile failed" if $?;
+
+close(MAIL);
+die "Pipe to $mailcmd failed" if $?;
+
+exit 0;
+
+### Local Variables:
+### eval: (fundamental-mode)
+### End:
OpenPOWER on IntegriCloud