summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2006-02-07 09:49:09 +0000
committerrillig <rillig@pkgsrc.org>2006-02-07 09:49:09 +0000
commit886c0440a66fd7dc7dd0659eb0c346a5a3a706c1 (patch)
tree3d42844e201760e6f19513bc455e0d7df7b29397 /pkgtools
parent8db6b2e9a0a1f9b630df4a8477ee4278846e2f6e (diff)
downloadpkgsrc-886c0440a66fd7dc7dd0659eb0c346a5a3a706c1.tar.gz
- The diagnostics are filtered through strxvis(), so that pkglint is able
to check and report warnings even in files of random contents without emitting any terminal control sequences.
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/pkglint/files/pkglint.pl11
1 files changed, 9 insertions, 2 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl
index 66a590ac43f..75f51c35f76 100644
--- a/pkgtools/pkglint/files/pkglint.pl
+++ b/pkgtools/pkglint/files/pkglint.pl
@@ -1,5 +1,5 @@
#! @PERL@
-# $NetBSD: pkglint.pl,v 1.502 2006/02/07 09:20:17 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.503 2006/02/07 09:49:09 rillig Exp $
#
# pkglint - static analyzer and checker for pkgsrc packages
@@ -163,6 +163,13 @@ my $explain_flag = false;
my $show_source_flag = false;
my $frequency = {}; # Frequencies of the messages.
+sub strxvis($) {
+ my ($s) = @_;
+
+ $s =~ s/([^\x09\x20-\x7e])/"\\x" . unpack("H*", $1)/eg;
+ return $s;
+}
+
sub log_message($$$$) {
my ($level, $fname, $lineno, $message) = @_;
my ($text, $sep);
@@ -195,7 +202,7 @@ sub log_message($$$$) {
$sep = " ";
}
if (defined($message)) {
- $text .= "${sep}${message}";
+ $text .= $sep . strxvis($message);
$sep = "";
if ($level == LL_ERROR || $level == LL_WARNING) {