386BSD 0.1 development
authorWilliam F. Jolitz <wjolitz@soda.berkeley.edu>
Mon, 2 Mar 1992 01:22:41 +0000 (17:22 -0800)
committerWilliam F. Jolitz <wjolitz@soda.berkeley.edu>
Mon, 2 Mar 1992 01:22:41 +0000 (17:22 -0800)
Work on file usr/othersrc/public/cvs-1.3/contrib/mfpipe.pl

Co-Authored-By: Lynne Greer Jolitz <ljolitz@cardio.ucsf.edu>
Synthesized-from: 386BSD-0.1

usr/othersrc/public/cvs-1.3/contrib/mfpipe.pl [new file with mode: 0755]

diff --git a/usr/othersrc/public/cvs-1.3/contrib/mfpipe.pl b/usr/othersrc/public/cvs-1.3/contrib/mfpipe.pl
new file mode 100755 (executable)
index 0000000..74cc5e1
--- /dev/null
@@ -0,0 +1,87 @@
+#!/usr/bin/perl
+#
+# From: clyne@niwot.scd.ucar.EDU (John Clyne)
+# Date: Fri, 28 Feb 92 09:54:21 MST
+# 
+# BTW, i wrote a perl script that is similar to 'nfpipe' except that in
+# addition to logging to a file it provides a command line option for mailing
+# change notices to a group of users. Obviously you probably wouldn't want
+# to mail every change. But there may be certain directories that are commonly
+# accessed by a group of users who would benefit from an email notice. 
+# Especially if they regularly beat on the same directory. Anyway if you 
+# think anyone would be interested here it is. 
+#
+#      mfpipe.pl,v 1.1 1992/03/02 01:22:41 berliner Exp
+#
+#
+#      File:           mfpipe
+#
+#      Author:         John Clyne
+#                      National Center for Atmospheric Research
+#                      PO 3000, Boulder, Colorado
+#
+#      Date:           Wed Feb 26 18:34:53 MST 1992
+#
+#      Description:    Tee standard input to mail a list of users and to
+#                      a file. Used by CVS logging.
+#
+#      Usage:          mfpipe [-f file] [user@host...]
+#
+#      Environment:    CVSROOT 
+#                              Path to CVS root.
+#
+#      Files:
+#
+#
+#      Options:        -f file 
+#                              Capture output to 'file'
+#                      
+
+$header = "Log Message:\n";
+
+$mailcmd = "| mail -s  'CVS update notice'";
+$whoami = `whoami`;
+chop $whoami;
+$date = `date`;
+chop $date;
+
+$cvsroot = $ENV{'CVSROOT'};
+
+while (@ARGV) {
+        $arg = shift @ARGV;
+
+       if ($arg eq '-f') {
+                $file = shift @ARGV;
+       }
+       else {
+               $users = "$users $arg";
+       }
+}
+
+if ($users) {
+       $mailcmd = "$mailcmd $users";
+       open(MAIL, $mailcmd) || die "Execing $mail: $!\n";
+}
+if ($file) {
+       $logfile = "$cvsroot/LOG/$file";
+       open(FILE, ">> $logfile") || die "Opening $logfile: $!\n";
+}
+
+print FILE "$whoami $date--------BEGIN LOG ENTRY-------------\n" if ($logfile);
+
+while (<>) {
+       print FILE $log if ($log && $logfile);
+
+       print FILE $_ if ($logfile);
+       print MAIL $_ if ($users);
+
+       $log = "log: " if ($_ eq $header);
+}
+
+close FILE;
+die "Write failed" if $?;
+close MAIL;
+die "Mail failed" if $?;
+
+exit 0;