/* ######################################################################
Extract a Tar - Tar Extractor
/* ######################################################################
Extract a Tar - Tar Extractor
#include <apt-pkg/extracttar.h>
#include <apt-pkg/error.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/extracttar.h>
#include <apt-pkg/error.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/configuration.h>
// ExtractTar::ExtractTar - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
// ExtractTar::ExtractTar - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
-ExtractTar::ExtractTar(FileFd &Fd,unsigned long Max) : File(Fd),
- MaxInSize(Max)
+ExtractTar::ExtractTar(FileFd &Fd,unsigned long Max,string DecompressionProgram) : File(Fd),
+ MaxInSize(Max), DecompressProg(DecompressionProgram)
- if (ExecWait(GZPid,_config->Find("dir::bin::gzip","/bin/gzip").c_str(),
+ string confvar = string("dir::bin::") + DecompressProg;
+ if (ExecWait(GZPid,_config->Find(confvar.c_str(),DecompressProg.c_str()).c_str(),
- Args[0] = _config->Find("dir::bin::gzip","/bin/gzip").c_str();
+ string confvar = string("dir::bin::") + DecompressProg;
+ string argv0 = _config->Find(confvar.c_str(),DecompressProg.c_str());
+ Args[0] = argv0.c_str();
- execv(Args[0],(char **)Args);
- cerr << "Failed to exec gzip " << Args[0] << endl;
+ execvp(Args[0],(char **)Args);
+ cerr << _("Failed to exec gzip ") << Args[0] << endl;
TarHeader *Tar = (TarHeader *)Block;
unsigned long CheckSum;
if (StrToNum(Tar->Checksum,CheckSum,sizeof(Tar->Checksum),8) == false)
TarHeader *Tar = (TarHeader *)Block;
unsigned long CheckSum;
if (StrToNum(Tar->Checksum,CheckSum,sizeof(Tar->Checksum),8) == false)
/* Compute the checksum field. The actual checksum is blanked out
with spaces so it is not included in the computation */
/* Compute the checksum field. The actual checksum is blanked out
with spaces so it is not included in the computation */
StrToNum(Tar->MTime,Itm.MTime,sizeof(Tar->MTime),8) == false ||
StrToNum(Tar->Major,Itm.Major,sizeof(Tar->Major),8) == false ||
StrToNum(Tar->Minor,Itm.Minor,sizeof(Tar->Minor),8) == false)
StrToNum(Tar->MTime,Itm.MTime,sizeof(Tar->MTime),8) == false ||
StrToNum(Tar->Major,Itm.Major,sizeof(Tar->Major),8) == false ||
StrToNum(Tar->Minor,Itm.Minor,sizeof(Tar->Minor),8) == false)
- _error->Warning("Unkown TAR header type %u, member %s",(unsigned)Tar->LinkFlag,Tar->Name);
+ _error->Warning(_("Unknown TAR header type %u, member %s"),(unsigned)Tar->LinkFlag,Tar->Name);