aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-03-27 02:22:02 -0400
committerIan Moffett <ian@osmora.org>2025-03-27 02:26:55 -0400
commitb18c474be6a941937bc385fc8a1ddc28ae56be0f (patch)
tree7080d629b8dc606bf0d7da32dfaf3a20cd8b86c9
parentb45c038a7899e2f396b0d248c22db037d58f3158 (diff)
tools: checknl: Improve error handling
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--tools/checknl.pl12
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/checknl.pl b/tools/checknl.pl
index dab81ba..5064d6e 100644
--- a/tools/checknl.pl
+++ b/tools/checknl.pl
@@ -58,7 +58,7 @@ my $tmp = get_line($fhand);
# Is there a newline at the start of the file?
if ($tmp =~ /^\n/) {
- print "Found redundant newline at start of file\n";
+ print STDERR "Found redundant newline at start of file\n";
$clean = 0;
}
@@ -66,7 +66,7 @@ while (!eof($fhand)) {
my $cur = get_line($fhand);
if ($cur =~ /^\n$/ && $tmp =~ /^\n$/) {
- print "Found redundant newline @ $lineno\n";
+ print STDERR "Found redundant newline @ $lineno\n";
$clean = 0;
}
@@ -76,10 +76,12 @@ while (!eof($fhand)) {
# What about at the end?
if ($tmp =~ /^\n/) {
- print "Found redundant newline at end of file\n";
+ print STDERR "Found redundant newline at end of file\n";
$clean = 0;
}
-if ($clean) {
- print "File is clean\n"
+if (!$clean) {
+ exit(1);
}
+
+print STDOUT "File is clean\n"