]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-cache.cc
methods/gzip.cc: With FileFd now being able to read gzipped files, there
[apt.git] / cmdline / apt-cache.cc
index c30e22b7691242d697344a579577ec6e9a3f2b96..2b47184f9b54a26c76f40011a7fd654fe55531c7 100644 (file)
@@ -626,7 +626,7 @@ bool Depends(CommandLine &CmdL)
    
    return true;
 }
-
+                                                                       /*}}}*/
 // RDepends - Print out a reverse dependency tree - mbc                        /*{{{*/
 // ---------------------------------------------------------------------
 /* */
@@ -714,10 +714,7 @@ bool RDepends(CommandLine &CmdL)
    
    return true;
 }
-
                                                                        /*}}}*/
-
-
 // xvcg - Generate a graph for xvcg                                    /*{{{*/
 // ---------------------------------------------------------------------
 // Code contributed from Junichi Uekawa <dancer@debian.org> on 20 June 2002.
@@ -932,13 +929,15 @@ bool XVcg(CommandLine &CmdL)
                Shapes[ShapeMap[Pkg->ID]]);
       
    }
-   
+
+   delete[] Show;
+   delete[] Flags;
+   delete[] ShapeMap;
+
    printf("}\n");
    return true;
 }
                                                                        /*}}}*/
-
-
 // Dotty - Generate a graph for Dotty                                  /*{{{*/
 // ---------------------------------------------------------------------
 /* Dotty is the graphvis program for generating graphs. It is a fairly
@@ -1221,7 +1220,7 @@ bool DisplayRecord(pkgCache::VerIterator V)
    if (I.IsOk() == false)
       return _error->Error(_("Package file %s is out of sync."),I.FileName());
    
-   FileFd PkgF(I.FileName(),FileFd::ReadOnly);
+   FileFd PkgF(I.FileName(),FileFd::ReadOnlyGzip);
    if (_error->PendingError() == true)
       return false;
    
@@ -1274,15 +1273,16 @@ bool DisplayRecord(pkgCache::VerIterator V)
    return true;
 }
                                                                        /*}}}*/
-// Search - Perform a search                                           /*{{{*/
-// ---------------------------------------------------------------------
-/* This searches the package names and package descriptions for a pattern */
+
 struct ExDescFile
 {
    pkgCache::DescFile *Df;
    bool NameMatch;
 };
 
+// Search - Perform a search                                           /*{{{*/
+// ---------------------------------------------------------------------
+/* This searches the package names and package descriptions for a pattern */
 bool Search(CommandLine &CmdL)
 {
    pkgCache &Cache = *GCache;
@@ -1498,15 +1498,26 @@ bool ShowSrcPackage(CommandLine &CmdL)
    if (_error->PendingError() == true)
       return false;
 
+   unsigned found = 0;
    for (const char **I = CmdL.FileList + 1; *I != 0; I++)
    {
       SrcRecs.Restart();
       
       pkgSrcRecords::Parser *Parse;
-      while ((Parse = SrcRecs.Find(*I,false)) != 0)
-        cout << Parse->AsStr() << endl;;
+      unsigned found_this = 0;
+      while ((Parse = SrcRecs.Find(*I,false)) != 0) {
+        cout << Parse->AsStr() << endl;;
+        found++;
+        found_this++;
+      }
+      if (found_this == 0) {
+        _error->Warning(_("Unable to locate package %s"),*I);
+        continue;
+      }
    }      
-   return true;
+   if (found > 0)
+        return true;
+   return _error->Error(_("No packages found"));
 }
                                                                        /*}}}*/
 // Policy - Show the results of the preferences file                   /*{{{*/
@@ -1620,7 +1631,7 @@ bool Policy(CommandLine &CmdL)
            if (SrcList->FindIndex(VF.File(),Indx) == false &&
                _system->FindIndex(VF.File(),Indx) == false)
               return _error->Error(_("Cache is out of sync, can't x-ref a package file"));
-           printf(_("       %4i %s\n"),Plcy.GetPriority(VF.File()),
+           printf("       %4i %s\n",Plcy.GetPriority(VF.File()),
                   Indx->Describe(true).c_str());
         }       
       }      
@@ -1696,7 +1707,6 @@ bool Madison(CommandLine &CmdL)
 
    return true;
 }
-
                                                                        /*}}}*/
 // GenCaches - Call the main cache generator                           /*{{{*/
 // ---------------------------------------------------------------------
@@ -1770,8 +1780,7 @@ void CacheInitialize()
    _config->Set("help",false);
 }
                                                                        /*}}}*/
-
-int main(int argc,const char *argv[])
+int main(int argc,const char *argv[])                                  /*{{{*/
 {
    CommandLine::Args Args[] = {
       {'h',"help","help",0},
@@ -1878,3 +1887,4 @@ int main(int argc,const char *argv[])
           
    return 0;
 }
+                                                                       /*}}}*/