diff options
author | joe <joe@FreeBSD.org> | 2001-05-13 21:47:54 +0800 |
---|---|---|
committer | joe <joe@FreeBSD.org> | 2001-05-13 21:47:54 +0800 |
commit | f619dbf3bbae593c5b337489fcc30c98699564f7 (patch) | |
tree | ef87cbd442a728392283ca84fd676ebfa1b687b8 /CVSROOT | |
parent | ec13f67dda5b14c4bdedda9be6b607878c215482 (diff) | |
download | freebsd-ports-gnome-f619dbf3bbae593c5b337489fcc30c98699564f7.tar.gz freebsd-ports-gnome-f619dbf3bbae593c5b337489fcc30c98699564f7.tar.zst freebsd-ports-gnome-f619dbf3bbae593c5b337489fcc30c98699564f7.zip |
Clean up a new nits and run this using 'strict'.
Diffstat (limited to 'CVSROOT')
-rwxr-xr-x | CVSROOT/logcheck | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/CVSROOT/logcheck b/CVSROOT/logcheck index 1f03cb27b952..a583aab3f9bb 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. |