summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2006-01-26 23:05:49 +0000
committerrillig <rillig@pkgsrc.org>2006-01-26 23:05:49 +0000
commit3a4982c5f2782956d664ad7b65d568abcf3070e5 (patch)
tree554ad20e541bb24ff67e65eec92d9fda26e05118 /pkgtools
parent466aba8f5aee03433026fcaf9431f0a3476db69d (diff)
downloadpkgsrc-3a4982c5f2782956d664ad7b65d568abcf3070e5.tar.gz
- Added the PkgLint::Util::match function that matches a string against a
regular expression and saves the values of the volatile @- and @+ arrays.
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/pkglint/files/pkglint.pl20
1 files changed, 18 insertions, 2 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl
index 5d55ae2529c..2524f55d8f8 100644
--- a/pkgtools/pkglint/files/pkglint.pl
+++ b/pkgtools/pkglint/files/pkglint.pl
@@ -1,5 +1,5 @@
#! @PERL@
-# $NetBSD: pkglint.pl,v 1.485 2006/01/25 00:23:48 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.486 2006/01/26 23:05:49 rillig Exp $
#
# pkglint - static analyzer and checker for pkgsrc packages
@@ -43,7 +43,7 @@ BEGIN {
use Exporter;
use vars qw(@ISA @EXPORT_OK);
@ISA = qw(Exporter);
- @EXPORT_OK = qw(array_to_hash false print_table true);
+ @EXPORT_OK = qw(array_to_hash false match print_table true);
}
use constant false => 0;
@@ -86,6 +86,22 @@ sub array_to_hash(@) {
return $result;
}
+sub match($$) {
+ my ($s, $re) = @_;
+ my ($m);
+
+
+ if ($s !~ $re) {
+ return false;
+ }
+
+ $m = [];
+ foreach my $i (0 .. $#+) {
+ push(@{$m}, [$-[0], $+[0]]);
+ }
+ return $m;
+}
+
#== End of PkgLint::Util ==================================================
package PkgLint::Logging;