summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2009-12-27 00:22:45 +0000
committerMarc Espie <espie@cvs.openbsd.org>2009-12-27 00:22:45 +0000
commit20bbc578d8aeac5a56391d786b49de377bd2017e (patch)
tree3720e06ba4c801380e0af20b75c19cc5d48a9e8b
parent3caddfed9eea1c170e8e7bd76768502e2ec99891 (diff)
fix partial stems, as noticed by numerous people
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Search.pm16
1 files changed, 12 insertions, 4 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Search.pm b/usr.sbin/pkg_add/OpenBSD/Search.pm
index 120427a212e..ea1ff2f208e 100644
--- a/usr.sbin/pkg_add/OpenBSD/Search.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Search.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Search.pm,v 1.18 2009/12/05 10:53:04 espie Exp $
+# $OpenBSD: Search.pm,v 1.19 2009/12/27 00:22:44 espie Exp $
#
# Copyright (c) 2007 Marc Espie <espie@openbsd.org>
#
@@ -138,14 +138,22 @@ our @ISA=(qw(OpenBSD::Search::Stem));
sub match
{
my ($self, $o) = @_;
- return $o->stemlist->find_partial($self->{stem});
+ my @r = ();
+ for my $k (keys %$self) {
+ push(@r, $o->stemlist->find_partial($k));
+ }
+ return @r;
}
sub _keep
{
my ($self, $stem) = @_;
- my $partial = $self->{stem};
- return $stem =~ /\Q$partial\E/;
+ for my $partial (keys %$self) {
+ if ($stem =~ /\Q$partial\E/) {
+ return 1;
+ }
+ }
+ return 0;
}
package OpenBSD::Search::FilterLocation;