From 0f2fa32291a66b7a154b5926a6dc8f38476bdd94 Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:56:35 +0000 Subject: Two small bug fixes Author: jgg Date: 2001-02-22 06:26:27 GMT Two small bug fixes --- cmdline/apt-cache.cc | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'cmdline') diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index e7b8637b..a0239d87 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: apt-cache.cc,v 1.44 2001/02/20 07:03:17 jgg Exp $ +// $Id: apt-cache.cc,v 1.45 2001/02/22 06:26:27 jgg Exp $ /* ###################################################################### apt-cache - Manages the cache files @@ -935,13 +935,13 @@ bool Search(CommandLine &CmdL) // Map versions that we want to write out onto the VerList array. for (pkgCache::PkgIterator P = Cache.PkgBegin(); P.end() == false; P++) { + VFList[P->ID].NameMatch = NumPatterns != 0; for (unsigned I = 0; I != NumPatterns; I++) { if (regexec(&Patterns[I],P.Name(),0,0,0) == 0) - { - VFList[P->ID].NameMatch = true; - break; - } + VFList[P->ID].NameMatch &= true; + else + VFList[P->ID].NameMatch = false; } // Doing names only, drop any that dont match.. @@ -961,12 +961,20 @@ bool Search(CommandLine &CmdL) for (ExVerFile *J = VFList; J->Vf != 0; J++) { pkgRecords::Parser &P = Recs.Lookup(pkgCache::VerFileIterator(Cache,J->Vf)); - - bool Match = J->NameMatch; - string LongDesc = P.LongDesc(); - for (unsigned I = 0; I != NumPatterns && Match == false; I++) - if (regexec(&Patterns[I],LongDesc.c_str(),0,0,0) == 0) - Match = true; + + bool Match = true; + if (J->NameMatch == false) + { + string LongDesc = P.LongDesc(); + Match = NumPatterns != 0; + for (unsigned I = 0; I != NumPatterns; I++) + { + if (regexec(&Patterns[I],LongDesc.c_str(),0,0,0) == 0) + Match &= true; + else + Match = false; + } + } if (Match == true) { -- cgit v1.2.3