diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/HttpServ.cc | 44 | ||||
-rw-r--r-- | lib/IRC.cc | 6 | ||||
-rw-r--r-- | lib/Makefile.am | 2 | ||||
-rw-r--r-- | lib/Output.cc | 2 | ||||
-rw-r--r-- | lib/Regex.cc | 8 | ||||
-rw-r--r-- | lib/String.cc | 6 | ||||
-rw-r--r-- | lib/Task.cc | 6 | ||||
-rw-r--r-- | lib/TaskMan.cc | 28 |
8 files changed, 51 insertions, 51 deletions
diff --git a/lib/HttpServ.cc b/lib/HttpServ.cc index 8824bcc..f649a78 100644 --- a/lib/HttpServ.cc +++ b/lib/HttpServ.cc @@ -60,7 +60,7 @@ int ProcessRequest::Do() throw(GeneralException) { bad = false; -// cerr << "---- Got a request from handle " << s.GetHandle() << " \n"; +// std::cerr << "---- Got a request from handle " << s.GetHandle() << " \n"; post = ParseUri(file, domain, gvars, &b); @@ -71,9 +71,9 @@ int ProcessRequest::Do() throw(GeneralException) { do { int p; b >> t; -// cerr << "Read Request (n): " << t << endl; +// std::cerr << "Read Request (n): " << t << std::endl; if ((t.strstr("Content-Length: ") == 0) || (t.strstr("Content-length: ") == 0)) { -// cerr << "Saw 'Content-Lenght:', reading length from '" << t.extract(16) << "'\n"; +// std::cerr << "Saw 'Content-Lenght:', reading length from '" << t.extract(16) << "'\n"; len = t.extract(16).to_int(); } if (t.strstr("Host: ") == 0) { @@ -88,7 +88,7 @@ int ProcessRequest::Do() throw(GeneralException) { } } while (t.strlen()); -// cerr << "---- Processing it.\n"; +// std::cerr << "---- Processing it.\n"; hasvars = false; @@ -96,10 +96,10 @@ int ProcessRequest::Do() throw(GeneralException) { // On a pas eu de ligne 'Content-Length' mais on a eu une méthode POST. // Cela est une erreur. if (len == -1) { -// cerr << "Error: method POST but no Content-Length\n"; +// std::cerr << "Error: method POST but no Content-Length\n"; bad = true; } else { -// cerr << "Got a POST request. Parsing variables. (len = " << len << ")\n"; +// std::cerr << "Got a POST request. Parsing variables. (len = " << len << ")\n"; // Les variables seront initialisées ici. hasvars = true; } @@ -125,7 +125,7 @@ int ProcessRequest::Do() throw(GeneralException) { ParseVars(&b, len); } - cerr << " Domain = '" << domain << "' - File = '" << file << "'\n"; + std::cerr << " Domain = '" << domain << "' - File = '" << file << "'\n"; if (!bad) { // Nous vérifions le domaine. @@ -136,7 +136,7 @@ int ProcessRequest::Do() throw(GeneralException) { if (domain == "/bin") bad = false; if (domain == "/") bad = false; if (bad) { - cerr << "Error: bad domain.\n"; + std::cerr << "Error: bad domain.\n"; } } else { // L'url sans domaine ni fichier est valide. (cela arrive sur certains navigateurs...) @@ -170,11 +170,11 @@ int ProcessRequest::Do() throw(GeneralException) { SendHeads(&b, GetMime(file), String("Accept-Ranges: bytes") + endhl + "Content-Length: " + (unsigned long long int) i->GetSize() + endhl, i->GetModif()); i->SetNonBlock(); a = new CopyJob(i, &s); - cerr << "File found, dumping.\n"; + std::cerr << "File found, dumping.\n"; } catch (IOGeneral e) { ShowError(&b); - cerr << "File not found, error showed.\n"; + std::cerr << "File not found, error showed.\n"; } } } @@ -183,7 +183,7 @@ int ProcessRequest::Do() throw(GeneralException) { delete Vars; delete Heads; -// cerr << "---- Sending header buffer.\n"; +// std::cerr << "---- Sending header buffer.\n"; c = new CopyJob(&b, &s, -1, false); WaitFor(c); current = 3; @@ -193,7 +193,7 @@ int ProcessRequest::Do() throw(GeneralException) { delete c; if (a) { -// cerr << "---- Sending contents.\n"; +// std::cerr << "---- Sending contents.\n"; a->Restart(); WaitFor(a); current = 4; @@ -202,7 +202,7 @@ int ProcessRequest::Do() throw(GeneralException) { case 4: if (a) delete a; -// cerr << "---- End of Request.\n"; +// std::cerr << "---- End of Request.\n"; } return TASK_DONE; } @@ -218,7 +218,7 @@ void ProcessRequest::ParseVars(Handle * s, int len) { s->read(&l, 1); t += l; } -// cerr << "Post variables line: '" << t << "'\n"; +// std::cerr << "Post variables line: '" << t << "'\n"; // Les variables sont sous la forme 'var1=val1&var2=val2&val3=var3'. Donc le nombre d'occurences @@ -254,7 +254,7 @@ void ProcessRequest::ParseVars(Handle * s, int len) { v += t[pos++]; } } -// cerr << "Pushing HTTP variable: " << v << endl; +// std::cerr << "Pushing HTTP variable: " << v << std::endl; Vars->Add(v); pos++; } @@ -274,7 +274,7 @@ bool ProcessRequest::ParseUri(String & file, String & domain, String & gvars, Ha ssize_t sppos; *s >> t; - cerr << "Read Request (1): " << t << endl; + std::cerr << "Read Request (1): " << t << std::endl; int IPos = t.strchr('?'); @@ -288,7 +288,7 @@ bool ProcessRequest::ParseUri(String & file, String & domain, String & gvars, Ha free(sdup); } -// cerr << "New request: " << t << ", gvars = " << gvars << endl; +// std::cerr << "New request: " << t << ", gvars = " << gvars << std::endl; bad = false; @@ -299,7 +299,7 @@ bool ProcessRequest::ParseUri(String & file, String & domain, String & gvars, Ha p = t.to_charp(5); post = true; } else { -// cerr << "Error: unknow request.\n"; +// std::cerr << "Error: unknow request.\n"; bad = true; } break; @@ -307,12 +307,12 @@ bool ProcessRequest::ParseUri(String & file, String & domain, String & gvars, Ha if (t.extract(1, 3) == "ET ") { p = t.to_charp(4); } else { -// cerr << "Error: unknow request.\n"; +// std::cerr << "Error: unknow request.\n"; bad = true; } break; default: -// cerr << "Error: unknow request.\n"; +// std::cerr << "Error: unknow request.\n"; bad = true; } @@ -427,7 +427,7 @@ String ProcessRequest::GetMime(const String & f) { HttpServ::HttpServ(Action * ap, int port, const String & nname) throw (GeneralException) : p(ap), name(nname), localport(port) { bool r = true; -// cerr << "Initialising Mini HTTP-Server on port " << localport << endl; +// std::cerr << "Initialising Mini HTTP-Server on port " << localport << std::endl; r = Listener.SetLocal("", port); if (!r) { @@ -443,7 +443,7 @@ HttpServ::HttpServ(Action * ap, int port, const String & nname) throw (GeneralEx Listener.SetNonBlock(); WaitFor(&Listener, W4_STICKY | W4_READING); -// cerr << "Mini HTTP-Server '" << name << "' ready and listening for port " << port << endl; +// std::cerr << "Mini HTTP-Server '" << name << "' ready and listening for port " << port << std::endl; } HttpServ::~HttpServ(void) { @@ -199,7 +199,7 @@ bool IRC::Connect() { int IRC::Parse(const String & line) { if (line.extract(0, 3) == "PING") { sock << "PONG" << line.extract(4) << endhl; - cerr << "PING/PONG" << line.extract(4) << endhl; + std::cerr << "PING/PONG" << line.extract(4) << endhl; return 0; } @@ -213,14 +213,14 @@ void IRC::MainLoop() { while (true) { switch (loginsequence) { case 1: - cerr << "Trying the login sequence..." << endl; + std::cerr << "Trying the login sequence..." << std::endl; sock << "NICK " << nick << endhl; sock << "USER " << user << " 8 * :" << name << endhl; loginsequence = 0; } sock >> line; if ((code = Parse(line))) { - cerr << "Unparsable: " << line << endl; + std::cerr << "Unparsable: " << line << std::endl; } if (count == 20) { diff --git a/lib/Makefile.am b/lib/Makefile.am index 09bdfb9..eb8f82e 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -2,7 +2,7 @@ localedir = $(datadir)/locale DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ AM_CFLAGS = -O3 -Wall -Wstrict-prototypes AM_CXXFLAGS = -O3 -Wall -Wstrict-prototypes -INCLUDES = -I. -I.. -I$(includedir) -I../include +INCLUDES = -I../include -I$(includedir) lib_LTLIBRARIES = libBaltisot.la libBaltisot_la_SOURCES = Action.cc Buffer.cc checkargs.c Confirm.cc CopyJob.cc \ diff --git a/lib/Output.cc b/lib/Output.cc index deecfb0..e0a37ba 100644 --- a/lib/Output.cc +++ b/lib/Output.cc @@ -9,7 +9,7 @@ #include "Exceptions.h" #include "config.h" -Output::Output(String no, int trunc = 1) throw (GeneralException) : +Output::Output(String no, int trunc) throw (GeneralException) : Handle(no.strlen() ? open(no.to_charp(), O_WRONLY | O_CREAT | (trunc ? O_TRUNC : O_APPEND), 00666) : dup(1)), n(no) { if (GetHandle() < 0) { diff --git a/lib/Regex.cc b/lib/Regex.cc index 013951a..41f303c 100644 --- a/lib/Regex.cc +++ b/lib/Regex.cc @@ -9,9 +9,9 @@ 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:"); + std::cerr << _("Error in regcomp:"); regerror(r, &preg, t, sizeof(t)); - cerr << t << endl; + std::cerr << t << std::endl; throw GeneralException(String(_("Regex \"")) + regex + _("\" failed to compile: ") + t + "\n"); } } @@ -20,9 +20,9 @@ Regex::Regex(const Regex & regex) : pattern(Base::strdup(pattern)) { int r; if ((r = regcomp(&preg, pattern, cflags | REG_NOSUB))) { - cerr << "Error in regcomp:"; + std::cerr << "Error in regcomp:"; regerror(r, &preg, t, sizeof(t)); - cerr << t << endl; + std::cerr << t << std::endl; throw GeneralException(String(_("Regex \"")) + pattern + _("\" failed to compile: ") + t + "\n"); } } diff --git a/lib/String.cc b/lib/String.cc index 0fa4278..786c623 100644 --- a/lib/String.cc +++ b/lib/String.cc @@ -1,4 +1,4 @@ -#include <iostream.h> +#include <iostream> #include <string.h> #include <stdarg.h> #include "String.h" @@ -178,11 +178,11 @@ String & String::operator+=(const String & s) { return (*this); } -ostream & operator<<(ostream & os, const String & s) { +std::ostream & operator<<(std::ostream & os, const String & s) { return (os << s.to_charp()); } -istream & operator>>(istream & is, String & s) { +std::istream & operator>>(std::istream & is, String & s) { char c = 0; s.set(""); diff --git a/lib/Task.cc b/lib/Task.cc index 3cac327..d554000 100644 --- a/lib/Task.cc +++ b/lib/Task.cc @@ -1,5 +1,5 @@ #include <sys/time.h> -#include <iostream.h> +#include <iostream> #include "TaskMan.h" #include "Task.h" #include "String.h" @@ -25,7 +25,7 @@ int Task::Run() { return state; } catch (GeneralException e) { - cerr << _("Task ") << GetName() << _(" caused an unexpected exception: \"") << e.GetMsg() << _("\". Terminating.\n"); + std::cerr << _("Task ") << GetName() << _(" caused an unexpected exception: \"") << e.GetMsg() << _("\". Terminating.\n"); state = TASK_DONE; return TASK_DONE; } @@ -41,7 +41,7 @@ int Task::DryRun() { catch (TaskSwitch) { } catch (GeneralException e) { - cerr << _("Task ") << GetName() << _(" caused an unexpected exception during dry-run: \"") << e.GetMsg() << _("\". Terminating.\n"); + std::cerr << _("Task ") << GetName() << _(" caused an unexpected exception during dry-run: \"") << e.GetMsg() << _("\". Terminating.\n"); state = TASK_DONE; } } diff --git a/lib/TaskMan.cc b/lib/TaskMan.cc index e75863b..1bc8cd8 100644 --- a/lib/TaskMan.cc +++ b/lib/TaskMan.cc @@ -6,7 +6,7 @@ #include <sys/time.h> #include <sys/types.h> #include <unistd.h> -#include <vector.h> +#include <vector> #include "TaskMan.h" #include "config.h" @@ -14,9 +14,9 @@ TaskMan::TaskList_t TaskMan::TaskList; TaskMan::TaskList_t TaskMan::Zombies; -vector<TaskMan::w4ha_t> TaskMan::w4ha; -vector<TaskMan::w4pr_t> TaskMan::w4pr; -vector<TaskMan::w4to_t> TaskMan::w4to; +std::vector<TaskMan::w4ha_t> TaskMan::w4ha; +std::vector<TaskMan::w4pr_t> TaskMan::w4pr; +std::vector<TaskMan::w4to_t> TaskMan::w4to; bool TaskMan::stopped = false; int TaskMan::number = 0; @@ -116,7 +116,7 @@ void TaskMan::AddTask(Task * t) { } } -vector<Task *>::iterator TaskMan::FindTask(Task * t) throw (GeneralException) { +std::vector<Task *>::iterator TaskMan::FindTask(Task * t) throw (GeneralException) { if (!inited) { Init(); } @@ -124,7 +124,7 @@ vector<Task *>::iterator TaskMan::FindTask(Task * t) throw (GeneralException) { if (TaskList.empty()) throw TaskNotFound(); - for (vector<Task *>::iterator p = TaskList.begin(); p != TaskList.end(); p++) { + for (std::vector<Task *>::iterator p = TaskList.begin(); p != TaskList.end(); p++) { if (*p == t) { return p; } @@ -135,7 +135,7 @@ vector<Task *>::iterator TaskMan::FindTask(Task * t) throw (GeneralException) { void TaskMan::RemoveFromWatches(Task * t) { if (!w4ha.empty()) { - for (vector<w4ha_t>::iterator p = w4ha.begin(); p != w4ha.end(); p++) { + for (std::vector<w4ha_t>::iterator p = w4ha.begin(); p != w4ha.end(); p++) { if (p->T == t) { w4ha.erase(p); p--; @@ -144,7 +144,7 @@ void TaskMan::RemoveFromWatches(Task * t) { } if (!w4pr.empty()) { - for (vector<w4pr_t>::iterator p = w4pr.begin(); p != w4pr.end(); p++) { + for (std::vector<w4pr_t>::iterator p = w4pr.begin(); p != w4pr.end(); p++) { if (p->T == t) { w4pr.erase(p); p--; @@ -153,7 +153,7 @@ void TaskMan::RemoveFromWatches(Task * t) { } if (!w4to.empty()) { - for (vector<w4to_t>::iterator p = w4to.begin(); p != w4to.end(); p++) { + for (std::vector<w4to_t>::iterator p = w4to.begin(); p != w4to.end(); p++) { if (p->T == t) { w4to.erase(p); p--; @@ -186,7 +186,7 @@ void TaskMan::WaitFor(Handle * h, Task * t, int flags) { void TaskMan::WaitFor(pid_t pid, Task * t, int status) { if (status == -1) { if (!w4pr.empty()) { - for (vector<w4pr_t>::iterator p = w4pr.begin(); p != w4pr.end(); p++) { + for (std::vector<w4pr_t>::iterator p = w4pr.begin(); p != w4pr.end(); p++) { if (p->pr == pid) { p->T = t; p->flag = true; @@ -272,7 +272,7 @@ void TaskMan::MainLoop() throw (GeneralException) { if (nfds != 0) { int r; - vector<w4ha_t>::iterator p; + std::vector<w4ha_t>::iterator p; #ifdef USE_POLL struct pollfd * q; #else @@ -369,7 +369,7 @@ void TaskMan::MainLoop() throw (GeneralException) { // We have to look into the handle structure now... bool touched; if (!w4ha.empty()) { - for (vector<w4ha_t>::iterator p = w4ha.begin(); p != w4ha.end(); p = touched ? w4ha.begin() : p + 1) { + for (std::vector<w4ha_t>::iterator p = w4ha.begin(); p != w4ha.end(); p = touched ? w4ha.begin() : p + 1) { touched = false; if ((p->ha->GetHandle() == fd) && (!p->T->IsStopped()) && (p->T->GetState() != TASK_DONE) && (!p->dirthy)) { // We've got one, launch it. @@ -389,7 +389,7 @@ void TaskMan::MainLoop() throw (GeneralException) { if (w4.T->GetState() == TASK_DONE) { // This task died, remove it. try { - vector<Task *>::iterator q = FindTask(w4.T); + std::vector<Task *>::iterator q = FindTask(w4.T); TaskList.erase(q); number--; Zombies.push_back(w4.T); @@ -452,7 +452,7 @@ void TaskMan::MainLoop() throw (GeneralException) { if (got_sigchild) { if (!w4pr.empty()) { - for (vector<w4pr_t>::iterator p = w4pr.begin(); p != w4pr.end(); p++) { + for (std::vector<w4pr_t>::iterator p = w4pr.begin(); p != w4pr.end(); p++) { if (p->flag) { Task * t; if (p->T->IsStopped()) { |