summaryrefslogtreecommitdiffstats
path: root/CVSROOT
diff options
context:
space:
mode:
Diffstat (limited to 'CVSROOT')
-rwxr-xr-xCVSROOT/logcheck20
1 files changed, 11 insertions, 9 deletions
diff --git a/CVSROOT/logcheck b/CVSROOT/logcheck
index 1f03cb2..a583aab 100755
--- a/CVSROOT/logcheck
+++ b/CVSROOT/logcheck
@@ -8,14 +8,16 @@
# Note: this uses an enhancement to cvs's verifymsg functionality.
# Normally, the check is advisory only, the FreeBSD version reads
# back the file after the verifymsg file so that this script can
-# can make changes.
+# make changes.
#
-if (!@ARGV) {
+use strict;
+
+my $filename = shift;
+unless ($filename) {
die "Usage: logcheck filename\n";
}
-$filename = $ARGV[0];
-$tmpfile = $filename . "tmp";
+my $tmpfile = $filename . "tmp";
open(IN, "< $filename") ||
die "logcheck: Cannot open for reading: $filename: $!\n";
@@ -24,16 +26,16 @@ open(OUT, "> $tmpfile") ||
die "logcheck: Cannot open for writing: $tmpfile: $!\n";
# In-place edit the result of the user's edit on the file.
-$blank = 0; # true if the last line was blank
-$first = 0; # true if we have seen the first real text
-while(<IN>) {
+my $blank = 0; # true if the last line was blank
+my $first = 0; # true if we have seen the first real text
+while(<IN>) {
# Dont let CVS: lines upset things, strip them out.
if (/^CVS:/) {
next;
}
- chop; # strip trailing newline
+ chomp; # strip trailing newline
s/[\s]+$//; # strip trailing whitespace
# collapse multiple blank lines, and trailing blank lines.
@@ -61,7 +63,7 @@ while(<IN>) {
exit 1;
}
}
-
+
if ($blank && $first) {
# Previous line(s) was blank, this isn't. Close the
# collapsed section.
OpenPOWER on IntegriCloud