diff options
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | include/Exceptions.h | 2 | ||||
-rw-r--r-- | include/Handle.h | 2 | ||||
-rw-r--r-- | include/String.h | 6 | ||||
-rw-r--r-- | include/Task.h | 2 | ||||
-rw-r--r-- | include/TaskMan.h | 12 | ||||
-rw-r--r-- | include/Variables.h | 4 | ||||
-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 | ||||
-rw-r--r-- | src/Main.cc | 16 | ||||
-rw-r--r-- | src/Makefile.am | 2 |
17 files changed, 75 insertions, 75 deletions
diff --git a/Makefile.am b/Makefile.am index cf4d28e..75d62d1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,4 +2,4 @@ localedir = $(datadir)/locale SUBDIRS = lib include doc po intl src m4 AM_CFLAGS = -Wall -Wstrict-prototypes -g -INCLUDES = -I. -I$(includedir) -I../include +INCLUDES = -I$(includedir) diff --git a/include/Exceptions.h b/include/Exceptions.h index 85451f0..ef697e7 100644 --- a/include/Exceptions.h +++ b/include/Exceptions.h @@ -84,7 +84,7 @@ INLINE void Base::free(char *& p) { xfree(p); } -INLINE int Base::pipe(int * p, int flag = 0) { +INLINE int Base::pipe(int * p, int flag) { return xpipe(p, flag); } diff --git a/include/Handle.h b/include/Handle.h index 3b9c9dc..6e26e9c 100644 --- a/include/Handle.h +++ b/include/Handle.h @@ -4,7 +4,7 @@ #include <zlib.h> #include <unistd.h> -#include <iostream.h> +#include <iostream> #include <String.h> #include <Exceptions.h> diff --git a/include/String.h b/include/String.h index a0d9220..f8db2c7 100644 --- a/include/String.h +++ b/include/String.h @@ -2,7 +2,7 @@ #define __STRING_H__ #ifdef __cplusplus -#include <iostream.h> +#include <iostream> #include <string.h> #include <Exceptions.h> @@ -56,8 +56,8 @@ class String : public Base { size_t siz; }; -ostream & operator<<(ostream &, const String &); -istream & operator>>(istream &, String &); +std::ostream & operator<<(std::ostream &, const String &); +std::istream & operator>>(std::istream &, String &); #else #error This only works with a C++ compiler diff --git a/include/Task.h b/include/Task.h index b6f9b2e..17df72e 100644 --- a/include/Task.h +++ b/include/Task.h @@ -4,7 +4,7 @@ #include <unistd.h> #include <sys/time.h> -#include <vector.h> +#include <vector> #include <Exceptions.h> #include <Handle.h> diff --git a/include/TaskMan.h b/include/TaskMan.h index 2cab500..a3b03ab 100644 --- a/include/TaskMan.h +++ b/include/TaskMan.h @@ -4,7 +4,7 @@ #include <signal.h> #include <Task.h> -#include <vector.h> +#include <vector> #define E_BURST 0 #define E_HANDLE 1 @@ -15,7 +15,7 @@ class TaskMan : public Base { public: static void AddTask(Task *); - static vector<Task *>::iterator FindTask(Task *) throw (GeneralException); + static std::vector<Task *>::iterator FindTask(Task *) throw (GeneralException); static void RemoveFromWatches(Task *); static void Init() throw (GeneralException); static void MainLoop() throw (GeneralException); @@ -54,16 +54,16 @@ class TaskMan : public Base { int flags; Task * T; }; - typedef vector<Task *> TaskList_t; + typedef std::vector<Task *> TaskList_t; private: static TaskList_t TaskList; static TaskList_t Zombies; static int number; static bool inited; - static vector<w4ha_t> w4ha; - static vector<w4pr_t> w4pr; - static vector<w4to_t> w4to; + static std::vector<w4ha_t> w4ha; + static std::vector<w4pr_t> w4pr; + static std::vector<w4to_t> w4to; static bool stopped; static int event; static Task * etask; diff --git a/include/Variables.h b/include/Variables.h index 8d7189b..c82ad87 100644 --- a/include/Variables.h +++ b/include/Variables.h @@ -2,7 +2,7 @@ #define __VARIABLES_H__ #ifdef __cplusplus -#include <vector.h> +#include <vector> #include <String.h> #include <Handle.h> #include <Exceptions.h> @@ -22,7 +22,7 @@ class Variables : public Base { void Del(const String &); private: - vector<String> Vars; + std::vector<String> Vars; int nbvars; }; 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()) { diff --git a/src/Main.cc b/src/Main.cc index caba9b6..d70c310 100644 --- a/src/Main.cc +++ b/src/Main.cc @@ -1,5 +1,5 @@ #include <unistd.h> -#include <list.h> +#include <list> #include <sys/types.h> #include <sys/wait.h> #include "Handle.h" @@ -145,7 +145,7 @@ int main(int argc, char ** argv) { int c; String port = "1500"; - list<String> testlist; + std::list<String> testlist; testlist.push_front("poide"); in = new InPipe(); @@ -153,11 +153,11 @@ int main(int argc, char ** argv) { in->Hook(); String test = "poide\n", r; - cout << test; - cout.flush(); + std::cout << test; + std::cout.flush(); (*in) >> r; if (r != "poide") { - cerr << "The stdout redirect has failed.\n"; + std::cerr << "The stdout redirect has failed.\n"; exit(-1); } @@ -167,7 +167,7 @@ int main(int argc, char ** argv) { port = optarg; break; default: - cerr << "Usage: " << argv[0] << " [-p port]\n"; + std::cerr << "Usage: " << argv[0] << " [-p port]\n"; exit(-1); } } @@ -180,12 +180,12 @@ int main(int argc, char ** argv) { TaskMan::MainLoop(); } catch (GeneralException e) { - cerr << "Main function got an exception: '" << e.GetMsg() << "'.\n"; + std::cerr << "Main function got an exception: '" << e.GetMsg() << "'.\n"; exit(-1); } catch (...) { - cerr << "Unknow exception.\n" << endl; + std::cerr << "Unknow exception.\n" << std::endl; exit(-1); } diff --git a/src/Makefile.am b/src/Makefile.am index b63b25f..4ff7f55 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,7 +4,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) bin_PROGRAMS = Baltisot |