pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files - The diagnostics are filtered ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/6768ea8f1703
branches:  trunk
changeset: 507711:6768ea8f1703
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Tue Feb 07 09:49:09 2006 +0000

description:
- 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:

 pkgtools/pkglint/files/pkglint.pl |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (33 lines):

diff -r 7894538d4f6e -r 6768ea8f1703 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Tue Feb 07 09:21:38 2006 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Tue Feb 07 09:49:09 2006 +0000
@@ -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 $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 @@
                $sep = " ";
        }
        if (defined($message)) {
-               $text .= "${sep}${message}";
+               $text .= $sep . strxvis($message);
                $sep = "";
 
                if ($level == LL_ERROR || $level == LL_WARNING) {



Home | Main Index | Thread Index | Old Index