From 05eb7df02d6a641678975899b1936500f5bc703b Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 17:00:42 +0000 Subject: [PATCH] i18n stuff. Author: doogie Date: 2003-02-10 00:36:12 GMT i18n stuff. --- apt-inst/contrib/arfile.cc | 15 +++++---- apt-inst/contrib/extracttar.cc | 15 +++++---- apt-inst/deb/debfile.cc | 15 +++++---- apt-inst/deb/dpkgdb.cc | 61 +++++++++++++++++----------------- apt-inst/dirstream.cc | 13 ++++---- apt-inst/extract.cc | 43 ++++++++++++------------ apt-inst/filelist.cc | 17 +++++----- apt-inst/makefile | 1 + 8 files changed, 94 insertions(+), 86 deletions(-) diff --git a/apt-inst/contrib/arfile.cc b/apt-inst/contrib/arfile.cc index 6d937df6d..27d4d9ba4 100644 --- a/apt-inst/contrib/arfile.cc +++ b/apt-inst/contrib/arfile.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: arfile.cc,v 1.4 2002/09/20 05:30:33 tausq Exp $ +// $Id: arfile.cc,v 1.5 2003/02/10 00:36:12 doogie Exp $ /* ###################################################################### AR File - Handle an 'AR' archive @@ -17,6 +17,7 @@ #ifdef __GNUG__ #pragma implementation "apt-pkg/arfile.h" #endif +#include #include #include #include @@ -69,7 +70,7 @@ bool ARArchive::LoadHeaders() if (File.Read(Magic,sizeof(Magic)) == false) return false; if (memcmp(Magic,"!\012",sizeof(Magic)) != 0) - return _error->Error("Invalid archive signature"); + return _error->Error(_("Invalid archive signature")); Left -= sizeof(Magic); // Read the member list @@ -77,7 +78,7 @@ bool ARArchive::LoadHeaders() { MemberHeader Head; if (File.Read(&Head,sizeof(Head)) == false) - return _error->Error("Error reading archive member header"); + return _error->Error(_("Error reading archive member header")); Left -= sizeof(Head); // Convert all of the integer members @@ -89,7 +90,7 @@ bool ARArchive::LoadHeaders() StrToNum(Head.Size,Memb->Size,sizeof(Head.Size)) == false) { delete Memb; - return _error->Error("Invalid archive member header"); + return _error->Error(_("Invalid archive member header")); } // Check for an extra long name string @@ -101,7 +102,7 @@ bool ARArchive::LoadHeaders() Len >= strlen(S)) { delete Memb; - return _error->Error("Invalid archive member header"); + return _error->Error(_("Invalid archive member header")); } if (File.Read(S,Len) == false) return false; @@ -127,11 +128,11 @@ bool ARArchive::LoadHeaders() if (File.Skip(Memb->Size + Skip) == false) return false; if (Left < (signed)(Memb->Size + Skip)) - return _error->Error("Archive is too short"); + return _error->Error(_("Archive is too short")); Left -= Memb->Size + Skip; } if (Left != 0) - return _error->Error("Failed to read the archive headers"); + return _error->Error(_("Failed to read the archive headers")); return true; } diff --git a/apt-inst/contrib/extracttar.cc b/apt-inst/contrib/extracttar.cc index 41cc9c8ec..fcfc89927 100644 --- a/apt-inst/contrib/extracttar.cc +++ b/apt-inst/contrib/extracttar.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: extracttar.cc,v 1.6 2002/11/11 06:55:50 doogie Exp $ +// $Id: extracttar.cc,v 1.7 2003/02/10 00:36:12 doogie Exp $ /* ###################################################################### Extract a Tar - Tar Extractor @@ -19,6 +19,7 @@ #ifdef __GNUG__ #pragma implementation "apt-pkg/extracttar.h" #endif +#include #include #include @@ -111,7 +112,7 @@ bool ExtractTar::StartGzip() { int Pipes[2]; if (pipe(Pipes) != 0) - return _error->Errno("pipe","Failed to create pipes"); + return _error->Errno("pipe",_("Failed to create pipes")); // Fork off the process GZPid = ExecFork(); @@ -136,7 +137,7 @@ bool ExtractTar::StartGzip() Args[1] = "-d"; Args[2] = 0; execv(Args[0],(char **)Args); - cerr << "Failed to exec gzip " << Args[0] << endl; + cerr << _("Failed to exec gzip ") << Args[0] << endl; _exit(100); } @@ -173,7 +174,7 @@ bool ExtractTar::Go(pkgDirStream &Stream) TarHeader *Tar = (TarHeader *)Block; unsigned long CheckSum; if (StrToNum(Tar->Checksum,CheckSum,sizeof(Tar->Checksum),8) == false) - return _error->Error("Corrupted archive"); + return _error->Error(_("Corrupted archive")); /* Compute the checksum field. The actual checksum is blanked out with spaces so it is not included in the computation */ @@ -188,7 +189,7 @@ bool ExtractTar::Go(pkgDirStream &Stream) return Done(true); if (NewSum != CheckSum) - return _error->Error("Tar Checksum failed, archive corrupted"); + return _error->Error(_("Tar Checksum failed, archive corrupted")); // Decode all of the fields pkgDirStream::Item Itm; @@ -199,7 +200,7 @@ bool ExtractTar::Go(pkgDirStream &Stream) 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) - return _error->Error("Corrupted archive"); + return _error->Error(_("Corrupted archive")); // Grab the filename if (LastLongName.empty() == false) @@ -291,7 +292,7 @@ bool ExtractTar::Go(pkgDirStream &Stream) default: BadRecord = true; - _error->Warning("Unkown TAR header type %u, member %s",(unsigned)Tar->LinkFlag,Tar->Name); + _error->Warning(_("Unkown TAR header type %u, member %s"),(unsigned)Tar->LinkFlag,Tar->Name); break; } diff --git a/apt-inst/deb/debfile.cc b/apt-inst/deb/debfile.cc index c93ba88a8..5c8339637 100644 --- a/apt-inst/deb/debfile.cc +++ b/apt-inst/deb/debfile.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: debfile.cc,v 1.2 2001/02/20 07:03:17 jgg Exp $ +// $Id: debfile.cc,v 1.3 2003/02/10 00:36:12 doogie Exp $ /* ###################################################################### Debian Archive File (.deb) @@ -20,6 +20,7 @@ #pragma implementation "apt-pkg/debfile.h" #endif +#include #include #include #include @@ -51,7 +52,7 @@ debDebFile::debDebFile(FileFd &File) : File(File), AR(File) bool debDebFile::CheckMember(const char *Name) { if (AR.FindMember(Name) == 0) - return _error->Error("This is not a valid DEB archive, missing '%s' member",Name); + return _error->Error(_("This is not a valid DEB archive, missing '%s' member"),Name); return true; } /*}}}*/ @@ -68,7 +69,7 @@ const ARArchive::Member *debDebFile::GotoMember(const char *Name) const ARArchive::Member *Member = AR.FindMember(Name); if (Member == 0) { - _error->Error("Internal Error, could not locate member %s",Name); + _error->Error(_("Internal Error, could not locate member %s"),Name); return 0; } if (File.Seek(Member->Start) == false) @@ -100,7 +101,7 @@ bool debDebFile::ExtractControl(pkgDataBase &DB) if (DB.GetMetaTmp(Tmp) == false) return false; if (chdir(Tmp.c_str()) != 0) - return _error->Errno("chdir","Couldn't change to %s",Tmp.c_str()); + return _error->Errno("chdir",_("Couldn't change to %s"),Tmp.c_str()); // Do extraction if (Tar.Go(Extract) == false) @@ -121,7 +122,7 @@ bool debDebFile::ExtractArchive(pkgDirStream &Stream) // Get the archive member and positition the file const ARArchive::Member *Member = AR.FindMember("data.tar.gz"); if (Member == 0) - return _error->Error("Internal Error, could not locate member"); + return _error->Error(_("Internal Error, could not locate member")); if (File.Seek(Member->Start) == false) return false; @@ -154,7 +155,7 @@ pkgCache::VerIterator debDebFile::MergeControl(pkgDataBase &DB) return pkgCache::VerIterator(DB.GetCache()); if (Ver.end() == true) - _error->Error("Failed to locate a valid control file"); + _error->Error(_("Failed to locate a valid control file")); return Ver; } /*}}}*/ @@ -239,7 +240,7 @@ bool debDebFile::MemControlExtract::Read(debDebFile &Deb) Control[Length] = '\n'; Control[Length+1] = '\n'; if (Section.Scan(Control,Length+2) == false) - return _error->Error("Unparsible control file"); + return _error->Error(_("Unparsible control file")); return true; } /*}}}*/ diff --git a/apt-inst/deb/dpkgdb.cc b/apt-inst/deb/dpkgdb.cc index cc3bd966b..f71811a9b 100644 --- a/apt-inst/deb/dpkgdb.cc +++ b/apt-inst/deb/dpkgdb.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: dpkgdb.cc,v 1.6 2002/11/11 06:55:50 doogie Exp $ +// $Id: dpkgdb.cc,v 1.7 2003/02/10 00:36:12 doogie Exp $ /* ###################################################################### DPKGv1 Database Implemenation @@ -17,6 +17,7 @@ #pragma implementation "apt-pkg/dpkgdb.h" #endif +#include #include #include #include @@ -51,13 +52,13 @@ static bool EraseDir(const char *Dir) if (errno == ENOTDIR) { if (unlink(Dir) != 0) - return _error->Errno("unlink","Failed to remove %s",Dir); + return _error->Errno("unlink",_("Failed to remove %s"),Dir); return true; } // Should not happen if (errno != ENOTEMPTY) - return _error->Errno("rmdir","Failed to remove %s",Dir); + return _error->Errno("rmdir",_("Failed to remove %s"),Dir); // Purge it using rm int Pid = ExecFork(); @@ -106,20 +107,20 @@ bool debDpkgDB::InitMetaTmp(string &Dir) { string Tmp = AdminDir + "tmp.ci/"; if (EraseDir(Tmp.c_str()) == false) - return _error->Error("Unable to create %s",Tmp.c_str()); + return _error->Error(_("Unable to create %s"),Tmp.c_str()); if (mkdir(Tmp.c_str(),0755) != 0) - return _error->Errno("mkdir","Unable to create %s",Tmp.c_str()); + return _error->Errno("mkdir",_("Unable to create %s"),Tmp.c_str()); // Verify it is on the same filesystem as the main info directory dev_t Dev; struct stat St; if (stat((AdminDir + "info").c_str(),&St) != 0) - return _error->Errno("stat","Failed to stat %sinfo",AdminDir.c_str()); + return _error->Errno("stat",_("Failed to stat %sinfo"),AdminDir.c_str()); Dev = St.st_dev; if (stat(Tmp.c_str(),&St) != 0) - return _error->Errno("stat","Failed to stat %s",Tmp.c_str()); + return _error->Errno("stat",_("Failed to stat %s"),Tmp.c_str()); if (Dev != St.st_dev) - return _error->Error("The info and temp directories need to be on the same filesystem"); + return _error->Error(_("The info and temp directories need to be on the same filesystem")); // Done Dir = Tmp; @@ -135,7 +136,7 @@ bool debDpkgDB::ReadyPkgCache(OpProgress &Progress) { if (Cache != 0) { - Progress.OverallProgress(1,1,1,"Reading Package Lists"); + Progress.OverallProgress(1,1,1,_("Reading Package Lists")); return true; } @@ -176,7 +177,7 @@ bool debDpkgDB::ReadFList(OpProgress &Progress) path components */ string Cwd = SafeGetCWD(); if (chdir((AdminDir + "info/").c_str()) != 0) - return _error->Errno("chdir","Failed to change to the admin dir %sinfo",AdminDir.c_str()); + return _error->Errno("chdir",_("Failed to change to the admin dir %sinfo"),AdminDir.c_str()); // Allocate a buffer. Anything larger than this buffer will be mmaped unsigned long BufSize = 32*1024; @@ -197,11 +198,11 @@ bool debDpkgDB::ReadFList(OpProgress &Progress) pkgFLCache::PkgIterator FlPkg = FList->GetPkg(I.Name(),0,true); if (FlPkg.end() == true) { - _error->Error("Internal Error getting a Package Name"); + _error->Error(_("Internal Error getting a Package Name")); break; } - Progress.OverallProgress(Count,Total,1,"Reading File Listing"); + Progress.OverallProgress(Count,Total,1,_("Reading File Listing")); // Open the list file snprintf(Name,sizeof(Name),"%s.list",I.Name()); @@ -212,9 +213,9 @@ bool debDpkgDB::ReadFList(OpProgress &Progress) struct stat Stat; if (Fd == -1 || fstat(Fd,&Stat) != 0) { - _error->Errno("open","Failed to open the list file '%sinfo/%s'. If you " + _error->Errno("open",_("Failed to open the list file '%sinfo/%s'. If you " "cannot restore this file then make it empty " - "and immediately re-install the same version of the package!", + "and immediately re-install the same version of the package!"), AdminDir.c_str(),Name); break; } @@ -225,7 +226,7 @@ bool debDpkgDB::ReadFList(OpProgress &Progress) { if (read(Fd,Buffer,Stat.st_size) != Stat.st_size) { - _error->Errno("read","Failed reading the list file %sinfo/%s", + _error->Errno("read",_("Failed reading the list file %sinfo/%s"), AdminDir.c_str(),Name); close(Fd); break; @@ -238,7 +239,7 @@ bool debDpkgDB::ReadFList(OpProgress &Progress) File = (char *)mmap(0,Stat.st_size,PROT_READ,MAP_PRIVATE,Fd,0); if (File == (char *)(-1)) { - _error->Errno("mmap","Failed reading the list file %sinfo/%s", + _error->Errno("mmap",_("Failed reading the list file %sinfo/%s"), AdminDir.c_str(),Name); close(Fd); break; @@ -262,7 +263,7 @@ bool debDpkgDB::ReadFList(OpProgress &Progress) FlPkg.Offset(),true,false); if (Node.end() == true) { - _error->Error("Internal Error getting a Node"); + _error->Error(_("Internal Error getting a Node")); break; } } @@ -305,7 +306,7 @@ bool debDpkgDB::ReadDiversions() FILE *Fd = fopen((AdminDir + "diversions").c_str(),"r"); if (Fd == 0) - return _error->Errno("fopen","Failed to open the diversions file %sdiversions",AdminDir.c_str()); + return _error->Errno("fopen",_("Failed to open the diversions file %sdiversions"),AdminDir.c_str()); FList->BeginDiverLoad(); while (1) @@ -320,24 +321,24 @@ bool debDpkgDB::ReadDiversions() if (fgets(To,sizeof(To),Fd) == 0 || fgets(Package,sizeof(Package),Fd) == 0) { - _error->Error("The diversion file is corrupted"); + _error->Error(_("The diversion file is corrupted")); break; } // Strip the \ns unsigned long Len = strlen(From); if (Len < 2 || From[Len-1] != '\n') - _error->Error("Invalid line in the diversion file: %s",From); + _error->Error(_("Invalid line in the diversion file: %s"),From); else From[Len-1] = 0; Len = strlen(To); if (Len < 2 || To[Len-1] != '\n') - _error->Error("Invalid line in the diversion file: %s",To); + _error->Error(_("Invalid line in the diversion file: %s"),To); else To[Len-1] = 0; Len = strlen(Package); if (Len < 2 || Package[Len-1] != '\n') - _error->Error("Invalid line in the diversion file: %s",Package); + _error->Error(_("Invalid line in the diversion file: %s"),Package); else Package[Len-1] = 0; @@ -351,14 +352,14 @@ bool debDpkgDB::ReadDiversions() pkgFLCache::PkgIterator FlPkg = FList->GetPkg(Package,0,true); if (FlPkg.end() == true) { - _error->Error("Internal Error getting a Package Name"); + _error->Error(_("Internal Error getting a Package Name")); break; } // Install the diversion if (FList->AddDiversion(FlPkg,From,To) == false) { - _error->Error("Internal Error adding a diversion"); + _error->Error(_("Internal Error adding a diversion")); break; } } @@ -379,10 +380,10 @@ bool debDpkgDB::ReadDiversions() bool debDpkgDB::ReadyFileList(OpProgress &Progress) { if (Cache == 0) - return _error->Error("The pkg cache must be initialize first"); + return _error->Error(_("The pkg cache must be initialize first")); if (FList != 0) { - Progress.OverallProgress(1,1,1,"Reading File List"); + Progress.OverallProgress(1,1,1,_("Reading File List")); return true; } @@ -439,12 +440,12 @@ bool debDpkgDB::ReadConfFiles() const char *PkgStart; const char *PkgEnd; if (Section.Find("Package",PkgStart,PkgEnd) == false) - return _error->Error("Failed to find a Package: Header, offset %lu",Offset); + return _error->Error(_("Failed to find a Package: Header, offset %lu"),Offset); // Snag a package record for it pkgFLCache::PkgIterator FlPkg = FList->GetPkg(PkgStart,PkgEnd,true); if (FlPkg.end() == true) - return _error->Error("Internal Error getting a Package Name"); + return _error->Error(_("Internal Error getting a Package Name")); // Parse the conf file lines while (1) @@ -461,12 +462,12 @@ bool debDpkgDB::ReadConfFiles() const char *EndMd5 = StartMd5; for (; isspace(*EndMd5) == 0 && EndMd5 < Stop; EndMd5++); if (StartMd5 == EndMd5 || Start == End) - return _error->Error("Bad ConfFile section in the status file. Offset %lu",Offset); + return _error->Error(_("Bad ConfFile section in the status file. Offset %lu"),Offset); // Insert a new entry unsigned char MD5[16]; if (Hex2Num(string(StartMd5,EndMd5-StartMd5),MD5,16) == false) - return _error->Error("Error parsing MD5. Offset %lu",Offset); + return _error->Error(_("Error parsing MD5. Offset %lu"),Offset); if (FList->AddConfFile(Start,End,FlPkg,MD5) == false) return false; diff --git a/apt-inst/dirstream.cc b/apt-inst/dirstream.cc index 41dbf4403..721041fe5 100644 --- a/apt-inst/dirstream.cc +++ b/apt-inst/dirstream.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: dirstream.cc,v 1.2 2001/02/20 07:03:16 jgg Exp $ +// $Id: dirstream.cc,v 1.3 2003/02/10 00:36:12 doogie Exp $ /* ###################################################################### Directory Stream @@ -15,6 +15,7 @@ #pragma implementation "apt-pkg/dirstream.h" #endif +#include #include #include @@ -41,15 +42,15 @@ bool pkgDirStream::DoItem(Item &Itm,int &Fd) int iFd = open(Itm.Name,O_NDELAY|O_WRONLY|O_CREAT|O_TRUNC|O_APPEND, Itm.Mode); if (iFd < 0) - return _error->Errno("open","Failed write file %s", + return _error->Errno("open",_("Failed write file %s"), Itm.Name); // fchmod deals with umask and fchown sets the ownership if (fchmod(iFd,Itm.Mode) != 0) - return _error->Errno("fchmod","Failed write file %s", + return _error->Errno("fchmod",_("Failed write file %s"), Itm.Name); if (fchown(iFd,Itm.UID,Itm.GID) != 0 && errno != EPERM) - return _error->Errno("fchown","Failed write file %s", + return _error->Errno("fchown",_("Failed write file %s"), Itm.Name); Fd = iFd; return true; @@ -76,7 +77,7 @@ bool pkgDirStream::FinishedFile(Item &Itm,int Fd) return true; if (close(Fd) != 0) - return _error->Errno("close","Failed to close file %s",Itm.Name); + return _error->Errno("close",_("Failed to close file %s"),Itm.Name); /* Set the modification times. The only way it can fail is if someone has futzed with our file, which is intolerable :> */ @@ -84,7 +85,7 @@ bool pkgDirStream::FinishedFile(Item &Itm,int Fd) Time.actime = Itm.MTime; Time.modtime = Itm.MTime; if (utime(Itm.Name,&Time) != 0) - _error->Errno("utime","Failed to close file %s",Itm.Name); + _error->Errno("utime",_("Failed to close file %s"),Itm.Name); return true; } diff --git a/apt-inst/extract.cc b/apt-inst/extract.cc index 5e3ed5af8..437cfbb55 100644 --- a/apt-inst/extract.cc +++ b/apt-inst/extract.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: extract.cc,v 1.5 2002/11/11 06:55:50 doogie Exp $ +// $Id: extract.cc,v 1.6 2003/02/10 00:36:12 doogie Exp $ /* ###################################################################### Archive Extraction Directory Stream @@ -47,6 +47,7 @@ #ifdef __GNUG__ #pragma implementation "apt-pkg/extract.h" #endif +#include #include #include #include @@ -92,7 +93,7 @@ bool pkgExtract::DoItem(Item &Itm,int &Fd) for (; *I != 0 && End < FileName + sizeof(FileName); I++, End++) *End = *I; if (End + 20 >= FileName + sizeof(FileName)) - return _error->Error("The path %s is too long",Itm.Name); + return _error->Error(_("The path %s is too long"),Itm.Name); for (; End > FileName && End[-1] == '/'; End--); *End = 0; Itm.Name = FileName; @@ -123,7 +124,7 @@ bool pkgExtract::DoItem(Item &Itm,int &Fd) which case this needs to be modified anyhow.. */ if ((RealNde->Flags & pkgFLCache::Node::Unpacked) == pkgFLCache::Node::Unpacked) - return _error->Error("Unpacking %s more than once",Itm.Name); + return _error->Error(_("Unpacking %s more than once"),Itm.Name); if (Nde.end() == true) Nde = RealNde; @@ -133,7 +134,7 @@ bool pkgExtract::DoItem(Item &Itm,int &Fd) if ((Nde->Flags & pkgFLCache::Node::Diversion) != 0) { if (Itm.Type == Item::Directory) - return _error->Error("The directory %s is diverted",Itm.Name); + return _error->Error(_("The directory %s is diverted"),Itm.Name); /* A package overwriting a diversion target is just the same as overwriting a normally owned file and is checked for below in @@ -143,8 +144,8 @@ bool pkgExtract::DoItem(Item &Itm,int &Fd) that is never, ever permitted */ pkgFLCache::DiverIterator Div = Nde.Diversion(); if (Div.DivertTo() == Nde) - return _error->Error("The package is trying to write to the " - "diversion target %s/%s",Nde.DirN(),Nde.File()); + return _error->Error(_("The package is trying to write to the " + "diversion target %s/%s"),Nde.DirN(),Nde.File()); // See if it is us and we are following it in the right direction if (Div->OwnerPkg != FLPkg.Offset() && Div.DivertFrom() == Nde) @@ -153,7 +154,7 @@ bool pkgExtract::DoItem(Item &Itm,int &Fd) End = FileName + snprintf(FileName,sizeof(FileName)-20,"%s/%s", Nde.DirN(),Nde.File()); if (End <= FileName) - return _error->Error("The diversion path is too long"); + return _error->Error(_("The diversion path is too long")); } } @@ -163,7 +164,7 @@ bool pkgExtract::DoItem(Item &Itm,int &Fd) { string Res = flNoLink(Itm.Name); if (Res.length() > sizeof(FileName)) - return _error->Error("The path %s is too long",Res.c_str()); + return _error->Error(_("The path %s is too long"),Res.c_str()); if (Debug == true) clog << "Followed conf file from " << FileName << " to " << Res << endl; Itm.Name = strcpy(FileName,Res.c_str()); @@ -177,19 +178,19 @@ bool pkgExtract::DoItem(Item &Itm,int &Fd) { // This is bad news. if (errno != ENOENT) - return _error->Errno("stat","Failed to stat %s",Itm.Name); + return _error->Errno("stat",_("Failed to stat %s"),Itm.Name); // See if we can recover the backup file if (Nde.end() == false) { snprintf(Temp,sizeof(Temp),"%s.%s",Itm.Name,TempExt); if (rename(Temp,Itm.Name) != 0 && errno != ENOENT) - return _error->Errno("rename","Failed to rename %s to %s", + return _error->Errno("rename",_("Failed to rename %s to %s"), Temp,Itm.Name); if (stat(Itm.Name,&LExisting) != 0) { if (errno != ENOENT) - return _error->Errno("stat","Failed to stat %s",Itm.Name); + return _error->Errno("stat",_("Failed to stat %s"),Itm.Name); } else EValid = true; @@ -206,7 +207,7 @@ bool pkgExtract::DoItem(Item &Itm,int &Fd) if (stat(Itm.Name,&Existing) != 0) { if (errno != ENOENT) - return _error->Errno("stat","Failed to stat %s",Itm.Name); + return _error->Errno("stat",_("Failed to stat %s"),Itm.Name); Existing = LExisting; } } @@ -239,13 +240,13 @@ bool pkgExtract::DoItem(Item &Itm,int &Fd) if (S_ISDIR(Existing.st_mode) != 0) { if (CheckDirReplace(Itm.Name) == false) - return _error->Error("The directory %s is being replaced by a non-directory",Itm.Name); + return _error->Error(_("The directory %s is being replaced by a non-directory"),Itm.Name); } if (Debug == true) clog << "Extract " << string(Itm.Name,End) << endl; /* if (Count != 0) - return _error->Error("Done");*/ + return _error->Error(_("Done"));*/ return true; } @@ -279,11 +280,11 @@ bool pkgExtract::Aborted() pkgFLCache::NodeIterator Nde(FLCache,FLCache.HashNode(Files)); for (; Nde.end() == false && Files->File != Nde->File; Nde++); if (Nde.end() == true) - return _error->Error("Failed to locate node in its hash bucket"); + return _error->Error(_("Failed to locate node in its hash bucket")); if (snprintf(FileName,sizeof(FileName)-20,"%s/%s", Nde.DirN(),Nde.File()) <= 0) - return _error->Error("The path is too long"); + return _error->Error(_("The path is too long")); // Deal with diversions if ((Nde->Flags & pkgFLCache::Node::Diversion) != 0) @@ -296,7 +297,7 @@ bool pkgExtract::Aborted() Nde = Div.DivertTo(); if (snprintf(FileName,sizeof(FileName)-20,"%s/%s", Nde.DirN(),Nde.File()) <= 0) - return _error->Error("The diversion path is too long"); + return _error->Error(_("The diversion path is too long")); } } @@ -413,7 +414,7 @@ bool pkgExtract::HandleOverwrites(pkgFLCache::NodeIterator Nde, pkgCache::PkgIterator Pkg = Dep.TargetPkg(); if (Pkg->CurrentVer == 0) { - _error->Warning("Overwrite package match with no version for %s",Pkg.Name()); + _error->Warning(_("Overwrite package match with no version for %s"),Pkg.Name()); continue; } @@ -430,7 +431,7 @@ bool pkgExtract::HandleOverwrites(pkgFLCache::NodeIterator Nde, // Negative Hit if (Ok == false) - return _error->Error("File %s/%s overwrites the one in the package %s", + return _error->Error(_("File %s/%s overwrites the one in the package %s"), Nde.DirN(),Nde.File(),FPkg.Name()); } @@ -463,7 +464,7 @@ bool pkgExtract::CheckDirReplace(string Dir,unsigned int Depth) DIR *D = opendir(Dir.c_str()); if (D == 0) - return _error->Errno("opendir","Unable to read %s",Dir.c_str()); + return _error->Errno("opendir",_("Unable to read %s"),Dir.c_str()); string File; for (struct dirent *Dent = readdir(D); Dent != 0; Dent = readdir(D)) @@ -490,7 +491,7 @@ bool pkgExtract::CheckDirReplace(string Dir,unsigned int Depth) if (lstat(File.c_str(),&St) != 0) { closedir(D); - return _error->Errno("lstat","Unable to stat %s",File.c_str()); + return _error->Errno("lstat",_("Unable to stat %s"),File.c_str()); } // Recurse down directories diff --git a/apt-inst/filelist.cc b/apt-inst/filelist.cc index 3312af8ae..446b9f561 100644 --- a/apt-inst/filelist.cc +++ b/apt-inst/filelist.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: filelist.cc,v 1.3 2001/05/27 23:45:39 jgg Exp $ +// $Id: filelist.cc,v 1.4 2003/02/10 00:36:12 doogie Exp $ /* ###################################################################### File Listing - Manages a Cache of File -> Package names. @@ -36,6 +36,7 @@ #pragma implementation "apt-pkg/filelist.h" #endif +#include #include #include #include @@ -380,7 +381,7 @@ void pkgFLCache::DropNode(map_ptrloc N) NodeIterator Nde(*this,NodeP + N); if (Nde->NextPkg != 0) - _error->Warning("DropNode called on still linked node"); + _error->Warning(_("DropNode called on still linked node")); // Locate it in the hash table Node *Last = 0; @@ -412,7 +413,7 @@ void pkgFLCache::DropNode(map_ptrloc N) break; } - _error->Error("Failed to locate the hash element!"); + _error->Error(_("Failed to locate the hash element!")); } /*}}}*/ // FLCache::BeginDiverLoad - Start reading new diversions /*{{{*/ @@ -459,12 +460,12 @@ bool pkgFLCache::AddDiversion(PkgIterator const &Owner, NodeIterator FromN = GetNode(From,From+strlen(From),0,true,true); NodeIterator ToN = GetNode(To,To+strlen(To),0,true,true); if (FromN.end() == true || ToN.end() == true) - return _error->Error("Failed to allocate diversion"); + return _error->Error(_("Failed to allocate diversion")); // Should never happen if ((FromN->Flags & Node::Diversion) != Node::Diversion || (ToN->Flags & Node::Diversion) != Node::Diversion) - return _error->Error("Internal Error in AddDiversion"); + return _error->Error(_("Internal Error in AddDiversion")); // Now, try to reclaim an existing diversion.. map_ptrloc Diver = 0; @@ -477,7 +478,7 @@ bool pkgFLCache::AddDiversion(PkgIterator const &Owner, { // It could be that the other diversion is no longer in use if ((DiverP[ToN->Pointer].Flags & Diversion::Touched) == Diversion::Touched) - return _error->Error("Trying to overwrite a diversion, %s -> %s and %s/%s", + return _error->Error(_("Trying to overwrite a diversion, %s -> %s and %s/%s"), From,To,ToN.File(),ToN.Dir().Name()); // We can erase it. @@ -506,7 +507,7 @@ bool pkgFLCache::AddDiversion(PkgIterator const &Owner, // Can only have one diversion of the same files Diversion *Div = DiverP + Diver; if ((Div->Flags & Diversion::Touched) == Diversion::Touched) - return _error->Error("Double add of diversion %s -> %s",From,To); + return _error->Error(_("Double add of diversion %s -> %s"),From,To); // Setup the From/To links if (Div->DivertFrom != FromN.Offset() && Div->DivertFrom != ToN.Offset()) @@ -549,7 +550,7 @@ bool pkgFLCache::AddConfFile(const char *Name,const char *NameEnd, continue; if ((Nde->Flags & Node::ConfFile) == Node::ConfFile) - return _error->Error("Duplicate conf file %s/%s",Nde.DirN(),Nde.File()); + return _error->Error(_("Duplicate conf file %s/%s"),Nde.DirN(),Nde.File()); // Allocate a new conf file structure map_ptrloc Conf = Map.Allocate(sizeof(ConfFile)); diff --git a/apt-inst/makefile b/apt-inst/makefile index 3aa7b45d2..0b02d4c79 100644 --- a/apt-inst/makefile +++ b/apt-inst/makefile @@ -15,6 +15,7 @@ LIBEXT=$(GLIBC_VER)$(LIBSTDCPP_VER) MAJOR=1.0 MINOR=0 SLIBS=$(PTHREADLIB) -lapt-pkg +APT_DOMAIN:=libapt-inst$(MAJOR) # Source code for the contributed non-core things SOURCE = contrib/extracttar.cc contrib/arfile.cc -- 2.45.2