diff options
author | Arch Librarian <arch@canonical.com> | 2004-09-20 16:56:35 +0000 |
---|---|---|
committer | Arch Librarian <arch@canonical.com> | 2004-09-20 16:56:35 +0000 |
commit | 0f2fa32291a66b7a154b5926a6dc8f38476bdd94 (patch) | |
tree | bd96d464306fc28064ec83b36de9b912f2285914 /cmdline/apt-cache.cc | |
parent | 997255f04c2c9bbbd3291b210255d1b9212915ae (diff) |
Two small bug fixes
Author: jgg
Date: 2001-02-22 06:26:27 GMT
Two small bug fixes
Diffstat (limited to 'cmdline/apt-cache.cc')
-rw-r--r-- | cmdline/apt-cache.cc | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index e7b8637be..a0239d87f 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) { |