diff options
author | Arch Librarian <arch@canonical.com> | 2004-09-20 17:02:10 +0000 |
---|---|---|
committer | Arch Librarian <arch@canonical.com> | 2004-09-20 17:02:10 +0000 |
commit | 9d366c89f1baafc92b08c0d57f189ca9c8c98895 (patch) | |
tree | 1e9a7dade5c468299e1f034e638faeaf263c6568 /cmdline/apt-cache.cc | |
parent | cb99271c2b7944cc4653cb06f7c2137f3d828dd5 (diff) |
* Have apt-cache show exit with an error if it cannot f...
Author: mdz
Date: 2003-07-22 03:10:01 GMT
* Have apt-cache show exit with an error if it cannot find any of the
specified packages (Closes: #101490)
Diffstat (limited to 'cmdline/apt-cache.cc')
-rw-r--r-- | cmdline/apt-cache.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index df68f7833..a9e9e6062 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.64 2003/05/15 09:39:38 piefel Exp $ +// $Id: apt-cache.cc,v 1.65 2003/07/22 03:10:01 mdz Exp $ /* ###################################################################### apt-cache - Manages the cache files @@ -1344,6 +1344,8 @@ bool ShowPackage(CommandLine &CmdL) { pkgCache &Cache = *GCache; pkgDepCache::Policy Plcy; + + unsigned found = 0; for (const char **I = CmdL.FileList + 1; *I != 0; I++) { @@ -1354,6 +1356,8 @@ bool ShowPackage(CommandLine &CmdL) continue; } + ++found; + // Find the proper version to use. if (_config->FindB("APT::Cache::AllVersions","true") == true) { @@ -1373,7 +1377,10 @@ bool ShowPackage(CommandLine &CmdL) return false; } } - return true; + + if (found > 0) + return true; + return _error->Error(_("No packages found")); } /*}}}*/ // ShowPkgNames - Show package names /*{{{*/ |