diff options
Diffstat (limited to 'methods')
-rw-r--r-- | methods/cdrom.cc | 17 | ||||
-rw-r--r-- | methods/connect.cc | 31 | ||||
-rw-r--r-- | methods/copy.cc | 7 | ||||
-rw-r--r-- | methods/file.cc | 7 | ||||
-rw-r--r-- | methods/ftp.cc | 84 | ||||
-rw-r--r-- | methods/gzip.cc | 13 | ||||
-rw-r--r-- | methods/http.cc | 43 | ||||
-rw-r--r-- | methods/rsh.cc | 27 |
8 files changed, 119 insertions, 110 deletions
diff --git a/methods/cdrom.cc b/methods/cdrom.cc index c4fde2217..f6b0bc679 100644 --- a/methods/cdrom.cc +++ b/methods/cdrom.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: cdrom.cc,v 1.19 2002/11/22 07:26:10 doogie Exp $ +// $Id: cdrom.cc,v 1.20 2003/02/10 07:34:41 doogie Exp $ /* ###################################################################### CDROM URI method for APT @@ -8,6 +8,7 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include <apti18n.h> #include <apt-pkg/acquire-method.h> #include <apt-pkg/cdromutl.h> #include <apt-pkg/error.h> @@ -109,7 +110,7 @@ bool CDROMMethod::Fetch(FetchItem *Itm) if (FileExists(DFile) == true) { if (ReadConfigFile(Database,DFile) == false) - return _error->Error("Unable to read the cdrom database %s", + return _error->Error(_("Unable to read the cdrom database %s"), DFile.c_str()); } DatabaseLoaded = true; @@ -118,15 +119,15 @@ bool CDROMMethod::Fetch(FetchItem *Itm) // All non IMS queries for package files fail. if (Itm->IndexFile == true || GetID(Get.Host).empty() == true) { - Fail("Please use apt-cdrom to make this CD recognized by APT." - " apt-get update cannot be used to add new CDs"); + Fail(_("Please use apt-cdrom to make this CD recognized by APT." + " apt-get update cannot be used to add new CDs")); return true; } // We already have a CD inserted, but it is the wrong one if (CurrentID.empty() == false && Database.Find("CD::" + CurrentID) != Get.Host) { - Fail("Wrong CD",true); + Fail(_("Wrong CD"),true); return true; } @@ -159,12 +160,12 @@ bool CDROMMethod::Fetch(FetchItem *Itm) // I suppose this should prompt somehow? if (UnmountCdrom(CDROM) == false) - return _error->Error("Unable to unmount the CD-ROM in %s, it may still be in use.", + return _error->Error(_("Unable to unmount the CD-ROM in %s, it may still be in use."), CDROM.c_str()); if (MediaFail(Get.Host,CDROM) == false) { CurrentID = "FAIL"; - Fail("Wrong CD",true); + Fail(_("Wrong CD"),true); return true; } } @@ -173,7 +174,7 @@ bool CDROMMethod::Fetch(FetchItem *Itm) Res.Filename = CDROM + File; struct stat Buf; if (stat(Res.Filename.c_str(),&Buf) != 0) - return _error->Error("File not found"); + return _error->Error(_("File not found")); if (NewID.empty() == false) CurrentID = NewID; diff --git a/methods/connect.cc b/methods/connect.cc index e58991b55..23961d83b 100644 --- a/methods/connect.cc +++ b/methods/connect.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: connect.cc,v 1.9 2002/09/14 05:28:38 jgg Exp $ +// $Id: connect.cc,v 1.10 2003/02/10 07:34:41 doogie Exp $ /* ###################################################################### Connect - Replacement connect call @@ -11,6 +11,7 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include <apti18n.h> #include "connect.h" #include <apt-pkg/error.h> #include <apt-pkg/fileutl.h> @@ -60,14 +61,14 @@ static bool DoConnect(struct addrinfo *Addr,string Host, getnameinfo(Addr->ai_addr,Addr->ai_addrlen, Name,sizeof(Name),Service,sizeof(Service), NI_NUMERICHOST|NI_NUMERICSERV); - Owner->Status("Connecting to %s (%s)",Host.c_str(),Name); + Owner->Status(_("Connecting to %s (%s)"),Host.c_str(),Name); /* If this is an IP rotation store the IP we are using.. If something goes wrong this will get tacked onto the end of the error message */ if (LastHostAddr->ai_next != 0) { char Name2[NI_MAXHOST + NI_MAXSERV + 10]; - snprintf(Name2,sizeof(Name2),"[IP: %s %s]",Name,Service); + snprintf(Name2,sizeof(Name2),_("[IP: %s %s]"),Name,Service); Owner->SetFailExtraMsg(string(Name2)); } else @@ -76,31 +77,31 @@ static bool DoConnect(struct addrinfo *Addr,string Host, // Get a socket if ((Fd = socket(Addr->ai_family,Addr->ai_socktype, Addr->ai_protocol)) < 0) - return _error->Errno("socket","Could not create a socket for %s (f=%u t=%u p=%u)", + return _error->Errno("socket",_("Could not create a socket for %s (f=%u t=%u p=%u)"), Name,Addr->ai_family,Addr->ai_socktype,Addr->ai_protocol); SetNonBlock(Fd,true); if (connect(Fd,Addr->ai_addr,Addr->ai_addrlen) < 0 && errno != EINPROGRESS) - return _error->Errno("connect","Cannot initiate the connection " - "to %s:%s (%s).",Host.c_str(),Service,Name); + return _error->Errno("connect",_("Cannot initiate the connection " + "to %s:%s (%s)."),Host.c_str(),Service,Name); /* This implements a timeout for connect by opening the connection nonblocking */ if (WaitFd(Fd,true,TimeOut) == false) - return _error->Error("Could not connect to %s:%s (%s), " - "connection timed out",Host.c_str(),Service,Name); + return _error->Error(_("Could not connect to %s:%s (%s), " + "connection timed out"),Host.c_str(),Service,Name); // Check the socket for an error condition unsigned int Err; unsigned int Len = sizeof(Err); if (getsockopt(Fd,SOL_SOCKET,SO_ERROR,&Err,&Len) != 0) - return _error->Errno("getsockopt","Failed"); + return _error->Errno("getsockopt",_("Failed")); if (Err != 0) { errno = Err; - return _error->Errno("connect","Could not connect to %s:%s (%s).",Host.c_str(), + return _error->Errno("connect",_("Could not connect to %s:%s (%s)."),Host.c_str(), Service,Name); } @@ -128,7 +129,7 @@ bool Connect(string Host,int Port,const char *Service,int DefPort,int &Fd, sensible */ if (LastHost != Host || LastPort != Port) { - Owner->Status("Connecting to %s",Host.c_str()); + Owner->Status(_("Connecting to %s"),Host.c_str()); // Free the old address structure if (LastHostAddr != 0) @@ -159,13 +160,13 @@ bool Connect(string Host,int Port,const char *Service,int DefPort,int &Fd, DefPort = 0; continue; } - return _error->Error("Could not resolve '%s'",Host.c_str()); + return _error->Error(_("Could not resolve '%s'"),Host.c_str()); } if (Res == EAI_AGAIN) - return _error->Error("Temporary failure resolving '%s'", + return _error->Error(_("Temporary failure resolving '%s'"), Host.c_str()); - return _error->Error("Something wicked happened resolving '%s:%s' (%i)", + return _error->Error(_("Something wicked happened resolving '%s:%s' (%i)"), Host.c_str(),ServStr,Res); } break; @@ -212,6 +213,6 @@ bool Connect(string Host,int Port,const char *Service,int DefPort,int &Fd, if (_error->PendingError() == true) return false; - return _error->Error("Unable to connect to %s %s:",Host.c_str(),ServStr); + return _error->Error(_("Unable to connect to %s %s:"),Host.c_str(),ServStr); } /*}}}*/ diff --git a/methods/copy.cc b/methods/copy.cc index c89eb975d..87e77eda3 100644 --- a/methods/copy.cc +++ b/methods/copy.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: copy.cc,v 1.6 1999/01/20 04:36:43 jgg Exp $ +// $Id: copy.cc,v 1.7 2003/02/10 07:34:41 doogie Exp $ /* ###################################################################### Copy URI - This method takes a uri like a file: uri and copies it @@ -9,6 +9,7 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include <apti18n.h> #include <apt-pkg/fileutl.h> #include <apt-pkg/acquire-method.h> #include <apt-pkg/error.h> @@ -38,7 +39,7 @@ bool CopyMethod::Fetch(FetchItem *Itm) // Stat the file and send a start message struct stat Buf; if (stat(File.c_str(),&Buf) != 0) - return _error->Errno("stat","Failed to stat"); + return _error->Errno("stat",_("Failed to stat")); // Forumulate a result and send a start message FetchResult Res; @@ -75,7 +76,7 @@ bool CopyMethod::Fetch(FetchItem *Itm) if (utime(Itm->DestFile.c_str(),&TimeBuf) != 0) { To.OpFail(); - return _error->Errno("utime","Failed to set modification time"); + return _error->Errno("utime",_("Failed to set modification time")); } URIDone(Res); diff --git a/methods/file.cc b/methods/file.cc index 298f06608..bf7d380c5 100644 --- a/methods/file.cc +++ b/methods/file.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: file.cc,v 1.8 2000/01/27 04:15:10 jgg Exp $ +// $Id: file.cc,v 1.9 2003/02/10 07:34:41 doogie Exp $ /* ###################################################################### File URI method for APT @@ -13,6 +13,7 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include <apti18n.h> #include <apt-pkg/acquire-method.h> #include <apt-pkg/error.h> @@ -38,7 +39,7 @@ bool FileMethod::Fetch(FetchItem *Itm) string File = Get.Path; FetchResult Res; if (Get.Host.empty() == false) - return _error->Error("Invalid URI, local URIS must not start with //"); + return _error->Error(_("Invalid URI, local URIS must not start with //")); // See if the file exists struct stat Buf; @@ -73,7 +74,7 @@ bool FileMethod::Fetch(FetchItem *Itm) } if (Res.Filename.empty() == true) - return _error->Error("File not found"); + return _error->Error(_("File not found")); URIDone(Res); return true; diff --git a/methods/ftp.cc b/methods/ftp.cc index 10f1406f5..cc2f1395d 100644 --- a/methods/ftp.cc +++ b/methods/ftp.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: ftp.cc,v 1.29 2002/04/24 05:35:13 jgg Exp $ +// $Id: ftp.cc,v 1.30 2003/02/10 07:34:41 doogie Exp $ /* ###################################################################### FTP Aquire Method - This is the FTP aquire method for APT. @@ -15,6 +15,7 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include <apti18n.h> #include <apt-pkg/fileutl.h> #include <apt-pkg/acquire-method.h> #include <apt-pkg/error.h> @@ -158,18 +159,18 @@ bool FTPConn::Open(pkgAcqMethod *Owner) return false; // Login must be before getpeername otherwise dante won't work. - Owner->Status("Logging in"); + Owner->Status(_("Logging in")); bool Res = Login(); // Get the remote server's address PeerAddrLen = sizeof(PeerAddr); if (getpeername(ServerFd,(sockaddr *)&PeerAddr,&PeerAddrLen) != 0) - return _error->Errno("getpeername","Unable to determine the peer name"); + return _error->Errno("getpeername",_("Unable to determine the peer name")); // Get the local machine's address ServerAddrLen = sizeof(ServerAddr); if (getsockname(ServerFd,(sockaddr *)&ServerAddr,&ServerAddrLen) != 0) - return _error->Errno("getsockname","Unable to determine the local name"); + return _error->Errno("getsockname",_("Unable to determine the local name")); return Res; } @@ -200,19 +201,19 @@ bool FTPConn::Login() if (ReadResp(Tag,Msg) == false) return false; if (Tag >= 400) - return _error->Error("Server refused our connection and said: %s",Msg.c_str()); + return _error->Error(_("Server refused our connection and said: %s"),Msg.c_str()); // Send the user if (WriteMsg(Tag,Msg,"USER %s",User.c_str()) == false) return false; if (Tag >= 400) - return _error->Error("USER failed, server said: %s",Msg.c_str()); + return _error->Error(_("USER failed, server said: %s"),Msg.c_str()); // Send the Password if (WriteMsg(Tag,Msg,"PASS %s",Pass.c_str()) == false) return false; if (Tag >= 400) - return _error->Error("PASS failed, server said: %s",Msg.c_str()); + return _error->Error(_("PASS failed, server said: %s"),Msg.c_str()); // Enter passive mode if (_config->Exists("Acquire::FTP::Passive::" + ServerName.Host) == true) @@ -226,13 +227,13 @@ bool FTPConn::Login() if (ReadResp(Tag,Msg) == false) return false; if (Tag >= 400) - return _error->Error("Server refused our connection and said: %s",Msg.c_str()); + return _error->Error(_("Server refused our connection and said: %s"),Msg.c_str()); // Perform proxy script execution Configuration::Item const *Opts = _config->Tree("Acquire::ftp::ProxyLogin"); if (Opts == 0 || Opts->Child == 0) - return _error->Error("A proxy server was specified but no login " - "script, Acquire::ftp::ProxyLogin is empty."); + return _error->Error(_("A proxy server was specified but no login " + "script, Acquire::ftp::ProxyLogin is empty.")); Opts = Opts->Child; // Iterate over the entire login script @@ -259,7 +260,7 @@ bool FTPConn::Login() if (WriteMsg(Tag,Msg,"%s",Tmp.c_str()) == false) return false; if (Tag >= 400) - return _error->Error("Login script command '%s' failed, server said: %s",Tmp.c_str(),Msg.c_str()); + return _error->Error(_("Login script command '%s' failed, server said: %s"),Tmp.c_str(),Msg.c_str()); } // Enter passive mode @@ -285,7 +286,7 @@ bool FTPConn::Login() if (WriteMsg(Tag,Msg,"TYPE I") == false) return false; if (Tag >= 400) - return _error->Error("TYPE failed, server said: %s",Msg.c_str()); + return _error->Error(_("TYPE failed, server said: %s"),Msg.c_str()); return true; } @@ -323,23 +324,23 @@ bool FTPConn::ReadLine(string &Text) if (WaitFd(ServerFd,false,TimeOut) == false) { Close(); - return _error->Error("Connection timeout"); + return _error->Error(_("Connection timeout")); } // Suck it back int Res = read(ServerFd,Buffer + Len,sizeof(Buffer) - Len); if (Res == 0) - _error->Error("Server closed the connection"); + _error->Error(_("Server closed the connection")); if (Res <= 0) { - _error->Errno("read","Read error"); + _error->Errno("read",_("Read error")); Close(); return false; } Len += Res; } - return _error->Error("A response overflowed the buffer."); + return _error->Error(_("A response overflowed the buffer.")); } /*}}}*/ // FTPConn::ReadResp - Read a full response from the server /*{{{*/ @@ -356,7 +357,7 @@ bool FTPConn::ReadResp(unsigned int &Ret,string &Text) char *End; Ret = strtol(Msg.c_str(),&End,10); if (End - Msg.c_str() != 3) - return _error->Error("Protocol corruption"); + return _error->Error(_("Protocol corruption")); // All done ? Text = Msg.c_str()+4; @@ -368,7 +369,7 @@ bool FTPConn::ReadResp(unsigned int &Ret,string &Text) } if (*End != '-') - return _error->Error("Protocol corruption"); + return _error->Error(_("Protocol corruption")); /* Okay, here we do the continued message trick. This is foolish, but proftpd follows the protocol as specified and wu-ftpd doesn't, so @@ -434,13 +435,13 @@ bool FTPConn::WriteMsg(unsigned int &Ret,string &Text,const char *Fmt,...) if (WaitFd(ServerFd,true,TimeOut) == false) { Close(); - return _error->Error("Connection timeout"); + return _error->Error(_("Connection timeout")); } int Res = write(ServerFd,S + Start,Len); if (Res <= 0) { - _error->Errno("write","Write Error"); + _error->Errno("write",_("Write Error")); Close(); return false; } @@ -681,24 +682,24 @@ bool FTPConn::CreateDataFd() // Get a socket if ((DataFd = socket(PasvAddr->ai_family,PasvAddr->ai_socktype, PasvAddr->ai_protocol)) < 0) - return _error->Errno("socket","Could not create a socket"); + return _error->Errno("socket",_("Could not create a socket")); // Connect to the server SetNonBlock(DataFd,true); if (connect(DataFd,PasvAddr->ai_addr,PasvAddr->ai_addrlen) < 0 && errno != EINPROGRESS) - return _error->Errno("socket","Could not create a socket"); + return _error->Errno("socket",_("Could not create a socket")); /* This implements a timeout for connect by opening the connection nonblocking */ if (WaitFd(DataFd,true,TimeOut) == false) - return _error->Error("Could not connect data socket, connection timed out"); + return _error->Error(_("Could not connect data socket, connection timed out")); unsigned int Err; unsigned int Len = sizeof(Err); if (getsockopt(DataFd,SOL_SOCKET,SO_ERROR,&Err,&Len) != 0) - return _error->Errno("getsockopt","Failed"); + return _error->Errno("getsockopt",_("Failed")); if (Err != 0) - return _error->Error("Could not connect passive socket."); + return _error->Error(_("Could not connect passive socket.")); return true; } @@ -716,32 +717,33 @@ bool FTPConn::CreateDataFd() Hints.ai_family = ((struct sockaddr *)&ServerAddr)->sa_family; int Res; if ((Res = getaddrinfo(0,"0",&Hints,&BindAddr)) != 0) - return _error->Error("getaddrinfo was unable to get a listening socket"); + return _error->Error(_("getaddrinfo was unable to get a listening socket")); // Construct the socket if ((DataListenFd = socket(BindAddr->ai_family,BindAddr->ai_socktype, BindAddr->ai_protocol)) < 0) { freeaddrinfo(BindAddr); - return _error->Errno("socket","Could not create a socket"); + return _error->Errno("socket",_("Could not create a socket")); } // Bind and listen if (bind(DataListenFd,BindAddr->ai_addr,BindAddr->ai_addrlen) < 0) { freeaddrinfo(BindAddr); - return _error->Errno("bind","Could not bind a socket"); + return _error->Errno("bind",_("Could not bind a socket")); } freeaddrinfo(BindAddr); if (listen(DataListenFd,1) < 0) - return _error->Errno("listen","Could not listen on the socket"); + return _error->Errno("listen",_("Could not listen on the socket")); SetNonBlock(DataListenFd,true); // Determine the name to send to the remote struct sockaddr_storage Addr; socklen_t AddrLen = sizeof(Addr); if (getsockname(DataListenFd,(sockaddr *)&Addr,&AddrLen) < 0) - return _error->Errno("getsockname","Could not determine the socket's name"); + return _error->Errno("getsockname",_("Could not determine the socket's name")); + // Reverse the address. We need the server address and the data port. char Name[NI_MAXHOST]; @@ -772,7 +774,7 @@ bool FTPConn::CreateDataFd() (int)(Port >> 8) & 0xff, (int)(Port & 0xff)) == false) return false; if (Tag >= 400) - return _error->Error("Unable to send PORT command"); + return _error->Error(_("Unable to send PORT command")); return true; } @@ -782,7 +784,7 @@ bool FTPConn::CreateDataFd() if (AFMap[J].Family == ((struct sockaddr *)&Addr)->sa_family) Proto = AFMap[J].IETFFamily; if (Proto == 0) - return _error->Error("Unkonwn address family %u (AF_*)", + return _error->Error(_("Unknown address family %u (AF_*)"), ((struct sockaddr *)&Addr)->sa_family); // Send the EPRT command @@ -791,7 +793,7 @@ bool FTPConn::CreateDataFd() if (WriteMsg(Tag,Msg,"EPRT |%u|%s|%s|",Proto,Name,Service) == false) return false; if (Tag >= 400) - return _error->Error("EPRT failed, server said: %s",Msg.c_str()); + return _error->Error(_("EPRT failed, server said: %s"),Msg.c_str()); return true; } /*}}}*/ @@ -811,14 +813,14 @@ bool FTPConn::Finalize() // Wait for someone to connect.. if (WaitFd(DataListenFd,false,TimeOut) == false) - return _error->Error("Data socket connect timed out"); + return _error->Error(_("Data socket connect timed out")); // Accept the connection struct sockaddr_in Addr; socklen_t Len = sizeof(Addr); DataFd = accept(DataListenFd,(struct sockaddr *)&Addr,&Len); if (DataFd < 0) - return _error->Errno("accept","Unable to accept connection"); + return _error->Errno("accept",_("Unable to accept connection")); close(DataListenFd); DataListenFd = -1; @@ -857,7 +859,7 @@ bool FTPConn::Get(const char *Path,FileFd &To,unsigned long Resume, { if (Hash.AddFD(To.Fd(),Resume) == false) { - _error->Errno("read","Problem hashing file"); + _error->Errno("read",_("Problem hashing file")); return false; } } @@ -870,7 +872,7 @@ bool FTPConn::Get(const char *Path,FileFd &To,unsigned long Resume, { if (Tag == 550) Missing = true; - return _error->Error("Unable to fetch file, server said '%s'",Msg.c_str()); + return _error->Error(_("Unable to fetch file, server said '%s'"),Msg.c_str()); } // Finish off the data connection @@ -885,7 +887,7 @@ bool FTPConn::Get(const char *Path,FileFd &To,unsigned long Resume, if (WaitFd(DataFd,false,TimeOut) == false) { Close(); - return _error->Error("Data socket timed out"); + return _error->Error(_("Data socket timed out")); } // Read the data.. @@ -915,7 +917,7 @@ bool FTPConn::Get(const char *Path,FileFd &To,unsigned long Resume, if (ReadResp(Tag,Msg) == false) return false; if (Tag >= 400) - return _error->Error("Data transfer failed, server said '%s'",Msg.c_str()); + return _error->Error(_("Data transfer failed, server said '%s'"),Msg.c_str()); return true; } /*}}}*/ @@ -990,7 +992,7 @@ bool FtpMethod::Fetch(FetchItem *Itm) } // Get the files information - Status("Query"); + Status(_("Query")); unsigned long Size; if (Server->Size(File,Size) == false || Server->ModTime(File,FailTime) == false) @@ -1097,7 +1099,7 @@ int main(int argc,const char *argv[]) // Run the http method string Path = flNotFile(argv[0]) + "http"; execl(Path.c_str(),Path.c_str(),0); - cerr << "Unable to invoke " << Path << endl; + cerr << _("Unable to invoke ") << Path << endl; exit(100); } } diff --git a/methods/gzip.cc b/methods/gzip.cc index a07df81a2..35501cb0a 100644 --- a/methods/gzip.cc +++ b/methods/gzip.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: gzip.cc,v 1.16 2001/05/27 04:29:30 jgg Exp $ +// $Id: gzip.cc,v 1.17 2003/02/10 07:34:41 doogie Exp $ /* ###################################################################### GZip method - Take a file URI in and decompress it into the target @@ -9,6 +9,7 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include <apti18n.h> #include <apt-pkg/fileutl.h> #include <apt-pkg/error.h> #include <apt-pkg/acquire-method.h> @@ -53,7 +54,7 @@ bool GzipMethod::Fetch(FetchItem *Itm) int GzOut[2]; if (pipe(GzOut) < 0) - return _error->Errno("pipe","Couldn't open pipe for %s",Prog); + return _error->Errno("pipe",_("Couldn't open pipe for %s"),Prog); // Fork gzip int Process = ExecFork(); @@ -98,7 +99,7 @@ bool GzipMethod::Fetch(FetchItem *Itm) if (Count < 0) { - _error->Errno("read", "Read error from %s process",Prog); + _error->Errno("read", _("Read error from %s process"),Prog); Failed = true; break; } @@ -129,16 +130,16 @@ bool GzipMethod::Fetch(FetchItem *Itm) // Transfer the modification times struct stat Buf; if (stat(Path.c_str(),&Buf) != 0) - return _error->Errno("stat","Failed to stat"); + return _error->Errno("stat",_("Failed to stat")); struct utimbuf TimeBuf; TimeBuf.actime = Buf.st_atime; TimeBuf.modtime = Buf.st_mtime; if (utime(Itm->DestFile.c_str(),&TimeBuf) != 0) - return _error->Errno("utime","Failed to set modification time"); + return _error->Errno("utime",_("Failed to set modification time")); if (stat(Itm->DestFile.c_str(),&Buf) != 0) - return _error->Errno("stat","Failed to stat"); + return _error->Errno("stat",_("Failed to stat")); // Return a Done response Res.LastModified = Buf.st_mtime; diff --git a/methods/http.cc b/methods/http.cc index 4521197ed..d1ff9b6b8 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: http.cc,v 1.54 2002/04/18 05:09:38 jgg Exp $ +// $Id: http.cc,v 1.55 2003/02/10 07:34:41 doogie Exp $ /* ###################################################################### HTTP Aquire Method - This is the HTTP aquire method for APT. @@ -25,6 +25,7 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include <apti18n.h> #include <apt-pkg/fileutl.h> #include <apt-pkg/acquire-method.h> #include <apt-pkg/error.h> @@ -336,7 +337,7 @@ int ServerState::RunHeaders() { State = Header; - Owner->Status("Waiting for file"); + Owner->Status(_("Waiting for file")); Major = 0; Minor = 0; @@ -482,7 +483,7 @@ bool ServerState::HeaderLine(string Line) // The http server might be trying to do something evil. if (Line.length() >= MAXLEN) - return _error->Error("Got a single header line over %u chars",MAXLEN); + return _error->Error(_("Got a single header line over %u chars"),MAXLEN); string::size_type Pos = Line.find(' '); if (Pos == string::npos || Pos+1 > Line.length()) @@ -490,7 +491,7 @@ bool ServerState::HeaderLine(string Line) // Blah, some servers use "connection:closes", evil. Pos = Line.find(':'); if (Pos == string::npos || Pos + 2 > Line.length()) - return _error->Error("Bad header line"); + return _error->Error(_("Bad header line")); Pos++; } @@ -509,14 +510,14 @@ bool ServerState::HeaderLine(string Line) { if (sscanf(Line.c_str(),"HTTP/%u.%u %u %[^\n]",&Major,&Minor, &Result,Code) != 4) - return _error->Error("The http server sent an invalid reply header"); + return _error->Error(_("The http server sent an invalid reply header")); } else { Major = 0; Minor = 9; if (sscanf(Line.c_str(),"HTTP %u %[^\n]",&Result,Code) != 2) - return _error->Error("The http server sent an invalid reply header"); + return _error->Error(_("The http server sent an invalid reply header")); } /* Check the HTTP response header to get the default persistance @@ -545,7 +546,7 @@ bool ServerState::HeaderLine(string Line) return true; if (sscanf(Val.c_str(),"%lu",&Size) != 1) - return _error->Error("The http server sent an invalid Content-Length header"); + return _error->Error(_("The http server sent an invalid Content-Length header")); return true; } @@ -560,9 +561,9 @@ bool ServerState::HeaderLine(string Line) HaveContent = true; if (sscanf(Val.c_str(),"bytes %lu-%*u/%lu",&StartPos,&Size) != 2) - return _error->Error("The http server sent an invalid Content-Range header"); + return _error->Error(_("The http server sent an invalid Content-Range header")); if ((unsigned)StartPos > Size) - return _error->Error("This http server has broken range support"); + return _error->Error(_("This http server has broken range support")); return true; } @@ -586,7 +587,7 @@ bool ServerState::HeaderLine(string Line) if (stringcasecmp(Tag,"Last-Modified:") == 0) { if (StrToTime(Val,Date) == false) - return _error->Error("Unknown date format"); + return _error->Error(_("Unknown date format")); return true; } @@ -729,12 +730,12 @@ bool HttpMethod::Go(bool ToFile,ServerState *Srv) { if (errno == EINTR) return true; - return _error->Errno("select","Select failed"); + return _error->Errno("select",_("Select failed")); } if (Res == 0) { - _error->Error("Connection timed out"); + _error->Error(_("Connection timed out")); return ServerDie(Srv); } @@ -757,7 +758,7 @@ bool HttpMethod::Go(bool ToFile,ServerState *Srv) if (FileFD != -1 && FD_ISSET(FileFD,&wfds)) { if (Srv->In.Write(FileFD) == false) - return _error->Errno("write","Error writing to output file"); + return _error->Errno("write",_("Error writing to output file")); } // Handle commands from APT @@ -785,7 +786,7 @@ bool HttpMethod::Flush(ServerState *Srv) while (Srv->In.WriteSpace() == true) { if (Srv->In.Write(File->Fd()) == false) - return _error->Errno("write","Error writing to file"); + return _error->Errno("write",_("Error writing to file")); if (Srv->In.IsLimit() == true) return true; } @@ -810,7 +811,7 @@ bool HttpMethod::ServerDie(ServerState *Srv) while (Srv->In.WriteSpace() == true) { if (Srv->In.Write(File->Fd()) == false) - return _error->Errno("write","Error writing to the file"); + return _error->Errno("write",_("Error writing to the file")); // Done if (Srv->In.IsLimit() == true) @@ -824,9 +825,9 @@ bool HttpMethod::ServerDie(ServerState *Srv) { Srv->Close(); if (LErrno == 0) - return _error->Error("Error reading from server Remote end closed connection"); + return _error->Error(_("Error reading from server Remote end closed connection")); errno = LErrno; - return _error->Errno("read","Error reading from server"); + return _error->Errno("read",_("Error reading from server")); } else { @@ -908,7 +909,7 @@ int HttpMethod::DealWithHeaders(FetchResult &Res,ServerState *Srv) lseek(File->Fd(),0,SEEK_SET); if (Srv->In.Hash->AddFD(File->Fd(),Srv->StartPos) == false) { - _error->Errno("read","Problem hashing file"); + _error->Errno("read",_("Problem hashing file")); return 5; } lseek(File->Fd(),0,SEEK_END); @@ -1057,7 +1058,7 @@ int HttpMethod::Loop() // The header data is bad case 2: { - _error->Error("Bad header Data"); + _error->Error(_("Bad header Data")); Fail(true); RotateDNS(); continue; @@ -1074,7 +1075,7 @@ int HttpMethod::Loop() if (FailCounter >= 2) { - Fail("Connection failed",true); + Fail(_("Connection failed"),true); FailCounter = 0; } @@ -1165,7 +1166,7 @@ int HttpMethod::Loop() } default: - Fail("Internal error"); + Fail(_("Internal error")); break; } diff --git a/methods/rsh.cc b/methods/rsh.cc index 29ddcdb2c..6cd618201 100644 --- a/methods/rsh.cc +++ b/methods/rsh.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: rsh.cc,v 1.5 2002/11/09 23:33:26 doogie Exp $ +// $Id: rsh.cc,v 1.6 2003/02/10 07:34:41 doogie Exp $ /* ###################################################################### RSH method - Transfer files via rsh compatible program @@ -11,6 +11,7 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include <apti18n.h> #include "rsh.h" #include <apt-pkg/error.h> @@ -87,7 +88,7 @@ bool RSHConn::Connect(string Host, string User) int Pipes[4] = {-1,-1,-1,-1}; if (pipe(Pipes) != 0 || pipe(Pipes+2) != 0) { - _error->Errno("pipe","Failed to create IPC pipe to subprocess"); + _error->Errno("pipe",_("Failed to create IPC pipe to subprocess")); for (int I = 0; I != 4; I++) close(Pipes[I]); return false; @@ -179,21 +180,21 @@ bool RSHConn::ReadLine(string &Text) if (WaitFd(ReadFd,false,TimeOut) == false) { Close(); - return _error->Error("Connection timeout"); + return _error->Error(_("Connection timeout")); } // Suck it back int Res = read(ReadFd,Buffer + Len,sizeof(Buffer) - Len); if (Res <= 0) { - _error->Errno("read","Read error"); + _error->Errno("read",_("Read error")); Close(); return false; } Len += Res; } - return _error->Error("A response overflowed the buffer."); + return _error->Error(_("A response overflowed the buffer.")); } /*}}}*/ // RSHConn::WriteMsg - Send a message with optional remote sync. /*{{{*/ @@ -222,13 +223,13 @@ bool RSHConn::WriteMsg(string &Text,bool Sync,const char *Fmt,...) { Close(); - return _error->Error("Connection timeout"); + return _error->Error(_("Connection timeout")); } int Res = write(WriteFd,S + Start,Len); if (Res <= 0) { - _error->Errno("write","Write Error"); + _error->Errno("write",_("Write Error")); Close(); return false; } @@ -260,7 +261,7 @@ bool RSHConn::Size(const char *Path,unsigned long &Size) char *End; Size = strtoul(Msg.c_str(),&End,10); if (End == Msg.c_str()) - return _error->Error("File Not Found"); + return _error->Error(_("File Not Found")); return true; } /*}}}*/ @@ -299,7 +300,7 @@ bool RSHConn::Get(const char *Path,FileFd &To,unsigned long Resume, if (Resume != 0) { if (Hash.AddFD(To.Fd(),Resume) == false) { - _error->Errno("read","Problem hashing file"); + _error->Errno("read",_("Problem hashing file")); return false; } } @@ -318,7 +319,7 @@ bool RSHConn::Get(const char *Path,FileFd &To,unsigned long Resume, if (WaitFd(ReadFd,false,TimeOut) == false) { Close(); - return _error->Error("Data socket timed out"); + return _error->Error(_("Data socket timed out")); } // Read the data.. @@ -326,7 +327,7 @@ bool RSHConn::Get(const char *Path,FileFd &To,unsigned long Resume, if (Res == 0) { Close(); - return _error->Error("Connection closed prematurely"); + return _error->Error(_("Connection closed prematurely")); } if (Res < 0) @@ -421,7 +422,7 @@ bool RSHMethod::Fetch(FetchItem *Itm) // We say this mainly because the pause here is for the // ssh connection that is still going - Status("Connecting to %s", Get.Host.c_str()); + Status(_("Connecting to %s"), Get.Host.c_str()); // Get the files information unsigned long Size; @@ -429,7 +430,7 @@ bool RSHMethod::Fetch(FetchItem *Itm) Server->ModTime(File,FailTime) == false) { //Fail(true); - //_error->Error("File Not Found"); // Will be handled by Size + //_error->Error(_("File Not Found")); // Will be handled by Size return false; } Res.Size = Size; |