]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-cache.cc
Document the general effect of the comma operator
[apt.git] / cmdline / apt-cache.cc
index b9da85b342d338adb7981fb673c0d112ba7dab5f..a0322498652954073f2ba4cc410af21c879ecdaf 100644 (file)
@@ -310,10 +310,15 @@ static void ShowHashTableStats(std::string Type,
 // Stats - Dump some nice statistics                                   /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-static bool Stats(CommandLine &)
+static bool Stats(CommandLine &CmdL)
 {
    pkgCacheFile CacheFile;
    pkgCache *Cache = CacheFile.GetPkgCache();
+
+   if (CmdL.FileSize() > 1) {
+      _error->Error(_("apt-cache stats does not take any arguments"));
+      return false;
+   }
    if (unlikely(Cache == NULL))
       return false;
 
@@ -749,9 +754,9 @@ static bool ShowDepends(CommandLine &CmdL, bool const RevDepends)
              }
            
            // Display all solutions
-           SPtrArray<pkgCache::Version *> List = D.AllTargets();
-           pkgPrioSortList(*Cache,List);
-           for (pkgCache::Version **I = List; *I != 0; I++)
+           std::unique_ptr<pkgCache::Version *[]> List(D.AllTargets());
+           pkgPrioSortList(*Cache,List.get());
+           for (pkgCache::Version **I = List.get(); *I != 0; I++)
            {
               pkgCache::VerIterator V(*Cache,*I);
               if (V != Cache->VerP + V.ParentPkg()->VersionList ||
@@ -1689,9 +1694,9 @@ static bool Policy(CommandLine &CmdL)
            if (Prio == 0)
               continue;
 
+           cout << "     ";
            // Print the package name and the version we are forcing to
-           cout << "     " << I.FullName(true) << " -> ";
-           cout << V.VerStr() << _(" with priority ") << Prio << endl;
+           ioprintf(cout, _("%s -> %s with priority %d\n"), I.FullName(true).c_str(), V.VerStr(), Prio);
         }
       }
       return true;