// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: apt-cache.cc,v 1.52 2001/07/02 00:10:32 jgg Exp $
+// $Id: apt-cache.cc,v 1.61 2003/02/10 01:40:58 doogie Exp $
/* ######################################################################
apt-cache - Manages the cache files
#include <config.h>
#include <apti18n.h>
-#include <iostream.h>
+#include <locale.h>
+#include <iostream>
#include <unistd.h>
#include <errno.h>
#include <regex.h>
#include <stdio.h>
/*}}}*/
+using namespace std;
+
pkgCache *GCache = 0;
pkgSourceList *SrcList = 0;
if (ReadPinFile(Plcy) == false)
return false;
- pkgCache::VerFile **VFList = new pkgCache::VerFile *[Cache.HeaderP->PackageCount];
- memset(VFList,0,sizeof(*VFList)*Cache.HeaderP->PackageCount);
+ unsigned long Count = Cache.HeaderP->PackageCount+1;
+ pkgCache::VerFile **VFList = new pkgCache::VerFile *[Count];
+ memset(VFList,0,sizeof(*VFList)*Count);
// 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] = VF;
}
- LocalitySort(VFList,Cache.HeaderP->PackageCount,sizeof(*VFList));
+ LocalitySort(VFList,Count,sizeof(*VFList));
// Iterate over all the package files and write them out.
char *Buffer = new char[Cache.HeaderP->MaxVerFileSize+10];
_("Usage: apt-cache [options] command\n"
" apt-cache [options] add file1 [file1 ...]\n"
" apt-cache [options] showpkg pkg1 [pkg2 ...]\n"
+ " apt-cache [options] showsrc pkg1 [pkg2 ...]\n"
"\n"
"apt-cache is a low-level tool used to manipulate APT's binary\n"
"cache files, and query information from them\n"
"\n"
"Commands:\n"
- " add - Add an package file to the source cache\n"
+ " add - Add a package file to the source cache\n"
" gencaches - Build both the package and source cache\n"
" showpkg - Show some general information for a single package\n"
+ " showsrc - Show source records\n"
" stats - Show some basic statistics\n"
" dump - Show the entire file in a terse form\n"
" dumpavail - Print an available file to stdout\n"
{'g',"generate","APT::Cache::Generate",0},
{'a',"all-versions","APT::Cache::AllVersions",0},
{0,"names-only","APT::Cache::NamesOnly",0},
- {0,"all-names","APT::Cache::AllNames",0},
+ {'n',"all-names","APT::Cache::AllNames",0},
{0,"recurse","APT::Cache::RecurseDepends",0},
{'c',"config-file",0,CommandLine::ConfigFile},
{'o',"option",0,CommandLine::ArbItem},
{0,0}};
CacheInitialize();
-
+
+ // Set up gettext support
+ setlocale(LC_ALL,"");
+ textdomain(PACKAGE);
+
// Parse the command line and initialize the package library
CommandLine CmdL(Args,_config);
if (pkgInitConfig(*_config) == false ||
if (CmdL.DispatchArg(CmdsA,false) == false && _error->PendingError() == false)
{
- MMap *Map;
+ MMap *Map = 0;
if (_config->FindB("APT::Cache::Generate",true) == false)
{
Map = new MMap(*new FileFd(_config->FindFile("Dir::Cache::pkgcache"),