diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CopyJob.cc | 2 | ||||
-rw-r--r-- | lib/Exceptions.cc | 10 | ||||
-rw-r--r-- | lib/IRC.cc | 2 | ||||
-rw-r--r-- | lib/InPipe.cc | 2 | ||||
-rw-r--r-- | lib/Input.cc | 3 | ||||
-rw-r--r-- | lib/OutPipe.cc | 2 | ||||
-rw-r--r-- | lib/Output.cc | 2 | ||||
-rw-r--r-- | lib/ReadJob.cc | 2 | ||||
-rw-r--r-- | lib/Regex.cc | 6 | ||||
-rw-r--r-- | lib/Socket.cc | 4 | ||||
-rw-r--r-- | lib/String.cc | 4 | ||||
-rw-r--r-- | lib/Task.cc | 4 | ||||
-rw-r--r-- | lib/TaskMan.cc | 14 |
13 files changed, 27 insertions, 30 deletions
diff --git a/lib/CopyJob.cc b/lib/CopyJob.cc index 5f348db..637f4b2 100644 --- a/lib/CopyJob.cc +++ b/lib/CopyJob.cc @@ -51,6 +51,6 @@ int CopyJob::Do() throw (GeneralException) { } String CopyJob::GetName() { - return (String("CopyJob from ") + s->GetName() + " to " + d->GetName()); + return (String(_("CopyJob from ")) + s->GetName() + _(" to ") + d->GetName()); } diff --git a/lib/Exceptions.cc b/lib/Exceptions.cc index 6d24646..53d974d 100644 --- a/lib/Exceptions.cc +++ b/lib/Exceptions.cc @@ -12,17 +12,17 @@ char GeneralException::t[BUFSIZ]; GeneralException::GeneralException(String emsg) : msg(emsg.strdup()) { #ifdef DEBUG - cerr << "Generating a General Exception error: '" << msg << "'.\n"; + cerr << _("Generating a General Exception error: '") << msg << "'.\n"; #endif } GeneralException::GeneralException() : msg(0) { #ifdef DEBUG - cerr << "Generating a General Exception error: '" << msg << "'.\n"; + cerr << _("Generating a General Exception error: '") << msg << "'.\n"; #endif } GeneralException::GeneralException(const GeneralException & e) : msg(strdup(e.msg)) { #ifdef DEBUG - cerr << "Generating a General Exception error: '" << msg << "'.\n"; + cerr << _("Generating a General Exception error: '") << msg << "'.\n"; #endif } @@ -120,7 +120,7 @@ void xfree(void *& p) { int xpipe(int * p, int flag) throw (GeneralException) { if (pipe(p)) { - throw GeneralException(String("Error creating pipe: ") + strerror(errno)); + throw GeneralException(String(_("Error creating pipe: ")) + strerror(errno)); } return p[flag]; @@ -132,7 +132,7 @@ pid_t xfork() throw (GeneralException) { p = fork(); if (p == -1) { - throw GeneralException("Was not able to fork().\n"); + throw GeneralException(_("Was not able to fork().\n")); } return p; @@ -215,12 +215,10 @@ void IRC::MainLoop() { cerr << "Trying the login sequence..." << endl; sock << "NICK " << nick << endhl; sock << "USER " << user << " 8 * :" << name << endhl; -// sock << "JOIN #linuxdjeunz" << endhl; loginsequence = 0; } sock >> line; if ((code = Parse(line))) { -// sock << "PRIVMSG #phear.org : Unparsable: " << line << endhl; cerr << "Unparsable: " << line << endl; } diff --git a/lib/InPipe.cc b/lib/InPipe.cc index 60f3751..f019768 100644 --- a/lib/InPipe.cc +++ b/lib/InPipe.cc @@ -27,5 +27,5 @@ bool InPipe::CanRead() { } String InPipe::GetName() { - return (String("Input pipe from stdout (") + (hooked ? "" : "not ") + "hooked)"); + return (String(_("Input pipe from stdout (")) + (hooked ? "" : _("not ")) + _("hooked)")); } diff --git a/lib/Input.cc b/lib/Input.cc index a466468..99c4bae 100644 --- a/lib/Input.cc +++ b/lib/Input.cc @@ -14,10 +14,9 @@ Input::Input(String no) throw (GeneralException) : Handle(no.strlen() ? open(no.to_charp(), O_RDONLY) : 0), n(no) { if (GetHandle() < 0) { - throw IOGeneral(String("Error opening file") + no + " for reading: " + strerror(errno)); + throw IOGeneral(String(_("Error opening file")) + no + _(" for reading: ") + strerror(errno)); } - cerr << "File " << no << " is opened with handle " << GetHandle() << endl; size = lseek(GetHandle(), 0, SEEK_END); lseek(GetHandle(), 0, SEEK_SET); diff --git a/lib/OutPipe.cc b/lib/OutPipe.cc index 35d23d3..ef0bf4a 100644 --- a/lib/OutPipe.cc +++ b/lib/OutPipe.cc @@ -27,5 +27,5 @@ bool OutPipe::CanRead() { } String OutPipe::GetName() { - return (String("Output pipe to stdin (") + (hooked ? "" : "not ") + "hooked)"); + return (String("Output pipe to stdin (") + (hooked ? "" : _("not ")) + _("hooked)")); } diff --git a/lib/Output.cc b/lib/Output.cc index 9e7437f..3f755ef 100644 --- a/lib/Output.cc +++ b/lib/Output.cc @@ -14,7 +14,7 @@ Output::Output(String no, int trunc = 1) throw (GeneralException) : Handle(no.strlen() ? open(no.to_charp(), O_WRONLY | O_CREAT | (trunc ? O_TRUNC : O_APPEND)) : 1), n(no) { if (GetHandle() < 0) { - throw IOGeneral(String("Error opening file") + no + " for writing: " + strerror(errno)); + throw IOGeneral(String(_("Error opening file")) + no + _(" for writing: ") + strerror(errno)); } } diff --git a/lib/ReadJob.cc b/lib/ReadJob.cc index a29f641..a012c97 100644 --- a/lib/ReadJob.cc +++ b/lib/ReadJob.cc @@ -43,5 +43,5 @@ int ReadJob::Do() throw (GeneralException) { } String ReadJob::GetName() { - return (String("ReadJob from ") + s->GetName() + " to " + d->GetName()); + return (String(_("ReadJob from ")) + s->GetName() + _(" to ") + d->GetName()); } diff --git a/lib/Regex.cc b/lib/Regex.cc index 3c566bd..41c55c7 100644 --- a/lib/Regex.cc +++ b/lib/Regex.cc @@ -8,10 +8,10 @@ Regex::Regex(const String & regex, int acflags, int aeflags) throw (GeneralExcep int r; if ((r = regcomp(&preg, pattern, cflags | REG_NOSUB))) { - cerr << "Error in regcomp:"; + cerr << _("Error in regcomp:"); regerror(r, &preg, t, sizeof(t)); cerr << t << endl; - throw GeneralException(String("Regex \"") + regex + "\" failed to compile: " + t + "\n"); + throw GeneralException(String(_("Regex \"")) + regex + _("\" failed to compile: ") + t + "\n"); } } @@ -22,7 +22,7 @@ Regex::Regex(const Regex & regex) : pattern(Base::strdup(pattern)) { cerr << "Error in regcomp:"; regerror(r, &preg, t, sizeof(t)); cerr << t << endl; - throw GeneralException(String("Regex \"") + pattern + "\" failed to compile: " + t + "\n"); + throw GeneralException(String(_("Regex \"")) + pattern + _("\" failed to compile: ") + t + "\n"); } } diff --git a/lib/Socket.cc b/lib/Socket.cc index f35bb72..aada133 100644 --- a/lib/Socket.cc +++ b/lib/Socket.cc @@ -15,7 +15,7 @@ Socket::Socket() throw (GeneralException) : Handle(socket(AF_INET, SOCK_STREAM, 0)), connected(false), listening(false) { if (GetHandle() < 0) { - throw GeneralException("Error creating socket."); + throw GeneralException(_("Error creating socket.")); } } @@ -117,7 +117,7 @@ Socket Socket::Accept(void) throw (GeneralException) { int h; if ((h = accept(GetHandle(), &inaddr, &inlen)) < 0) { - throw GeneralException("Failed accepting."); + throw GeneralException(_("Failed accepting.")); } else { return Socket(h); } diff --git a/lib/String.cc b/lib/String.cc index 60ca6df..d131fba 100644 --- a/lib/String.cc +++ b/lib/String.cc @@ -314,7 +314,7 @@ double String::datedif(const String & s) const { } bool String::is_number(void) const { - for (size_t i = ((str[i] == '-') ? 1 : 0); i < siz; i++) { + for (size_t i = ((str[0] == '-') ? 1 : 0); i < siz; i++) { if ((str[i] > '9') || (str[i] < '0')) return false; } return true; @@ -323,7 +323,7 @@ bool String::is_number(void) const { bool String::is_float(void) const { bool seendot = false; - for (size_t i = ((str[i] == '-') ? 1 : 0); i < siz; i++) { + for (size_t i = ((str[0] == '-') ? 1 : 0); i < siz; i++) { if ((str[i] > '9') || (str[i] < '0')) { if ((str[i] == '.') && !seendot) { seendot = true; diff --git a/lib/Task.cc b/lib/Task.cc index 72023e4..25733ff 100644 --- a/lib/Task.cc +++ b/lib/Task.cc @@ -24,7 +24,7 @@ int Task::Run() { return state; } catch (GeneralException e) { - cerr << "Task " << GetName() << " caused an unexpected exception: \"" << e.GetMsg() << "\". Terminating.\n"; + cerr << _("Task ") << GetName() << _(" caused an unexpected exception: \"") << e.GetMsg() << _("\". Terminating.\n"); return TASK_DONE; } @@ -36,7 +36,7 @@ int Task::GetState() { } String Task::GetName() { - return "Unknow Task"; + return _("Unknow Task"); } void Task::Suspend(int newstate) throw (GeneralException) { diff --git a/lib/TaskMan.cc b/lib/TaskMan.cc index 5709d02..3968f6b 100644 --- a/lib/TaskMan.cc +++ b/lib/TaskMan.cc @@ -55,7 +55,7 @@ int TaskMan::GotChild(pid_t pid, int status) { void TaskMan::Init() throw (GeneralException) { if (inited) { - throw GeneralException("Task Manager already initialised."); + throw GeneralException(_("Task Manager already initialised.")); } signal(SIGCHLD, taskman_sigchild); @@ -142,7 +142,7 @@ void TaskMan::MainLoop() throw (GeneralException) { while (1) { if (number == 0) { - throw GeneralException("TaskMan: No more task to manage."); + throw GeneralException(_("TaskMan: No more task to manage.")); } if (stopped) return; @@ -236,7 +236,7 @@ void TaskMan::MainLoop() throw (GeneralException) { if (errno == EINTR) { // child } else { - throw GeneralException(String("Error during poll: ") + strerror(errno)); + throw GeneralException(String(_("Error during poll: ")) + strerror(errno)); } } else if (r == 0) { // timeout... @@ -247,15 +247,15 @@ void TaskMan::MainLoop() throw (GeneralException) { int i; for (q = ufsd, i = 0; i < nfds; i++, q++) { if (q->revents & POLLNVAL) { - throw GeneralException(String("Error with poll, handle ") + q->fd + " invalid."); + throw GeneralException(String(_("Error with poll, handle ")) + q->fd + _(" invalid.")); } if (q->revents & POLLERR) { - cerr << "Error condition whith poll, handle " << q->fd << endl; + cerr << _("Error condition with poll, handle ") << q->fd << endl; } if (q->revents & POLLHUP) { - cerr << "Handle " << q->fd << " hung up.\n"; + cerr << _("Handle ") << q->fd << _(" hung up.\n"); // What should I do now? } @@ -326,7 +326,7 @@ void TaskMan::MainLoop() throw (GeneralException) { if (o->GetState() == TASK_DONE) { TaskList_t::iterator f = FindTask(o); if (!f) { - throw GeneralException("TaskMan: internal error (task not found)"); + throw GeneralException(_("TaskMan: internal error (task not found)")); } TaskList.erase(f); number--; |