summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaram Qashat <cyberbotx@cyberbotx.com>2010-08-01 13:42:35 -0400
committerNaram Qashat <cyberbotx@cyberbotx.com>2010-08-01 13:42:35 -0400
commitd59c1b95e18fd5c9bbec14b8b1b8aab989a3bce7 (patch)
tree94471c29e06725ce1d28ee11ae408084cfd82d41
parent2f6c0e435cbceb60c219f9f1cd925ae4ddffd4d9 (diff)
Cleanup in main.cpp.
-rw-r--r--include/extern.h21
-rw-r--r--modules/core/db_plain.cpp2
-rw-r--r--modules/core/os_quit.cpp2
-rw-r--r--modules/core/os_reload.cpp2
-rw-r--r--modules/core/os_set.cpp8
-rw-r--r--modules/core/os_shutdown.cpp2
-rw-r--r--modules/core/os_update.cpp2
-rw-r--r--modules/protocol/inspircd11.cpp6
-rw-r--r--modules/protocol/inspircd12.cpp6
-rw-r--r--modules/protocol/inspircd20.cpp6
-rw-r--r--src/init.cpp12
-rw-r--r--src/main.cpp37
12 files changed, 51 insertions, 55 deletions
diff --git a/include/extern.h b/include/extern.h
index 6232389ba..a968c37c4 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -193,20 +193,17 @@ E Anope::string version_protocol;
E Anope::string services_dir;
E Anope::string log_filename;
E int debug;
-E int readonly;
+E bool readonly;
E bool LogChan;
-E int nofork;
-E int forceload;
-E int nothird;
-E int noexpire;
-E int protocoldebug;
-
-E int is44;
-E int quitting;
-E int shutting_down;
+E bool nofork;
+E bool nothird;
+E bool noexpire;
+E bool protocoldebug;
+
+E bool quitting;
+E bool shutting_down;
E Anope::string quitmsg;
-E int save_data;
-E int got_alarm;
+E bool save_data;
E time_t start_time;
E Socket *UplinkSock;
diff --git a/modules/core/db_plain.cpp b/modules/core/db_plain.cpp
index 15a116b2e..84e569f9a 100644
--- a/modules/core/db_plain.cpp
+++ b/modules/core/db_plain.cpp
@@ -555,7 +555,7 @@ class DBPlain : public Module
Alog() << "Unable to back up database!";
if (!Config.NoBackupOkay)
- quitting = 1;
+ quitting = true;
return;
}
diff --git a/modules/core/os_quit.cpp b/modules/core/os_quit.cpp
index a2c86bc82..47f3daba3 100644
--- a/modules/core/os_quit.cpp
+++ b/modules/core/os_quit.cpp
@@ -27,7 +27,7 @@ class CommandOSQuit : public Command
if (Config.GlobalOnCycle)
oper_global("", "%s", Config.GlobalOnCycleMessage.c_str());
- quitting = 1;
+ quitting = true;
return MOD_CONT;
}
diff --git a/modules/core/os_reload.cpp b/modules/core/os_reload.cpp
index 722a6bd27..a01625026 100644
--- a/modules/core/os_reload.cpp
+++ b/modules/core/os_reload.cpp
@@ -25,7 +25,7 @@ class CommandOSReload : public Command
if (!read_config(1))
{
quitmsg = "Error during the reload of the configuration file!";
- quitting = 1;
+ quitting = true;
}
FOREACH_MOD(I_OnReload, OnReload(false));
diff --git a/modules/core/os_set.cpp b/modules/core/os_set.cpp
index 74398cb9a..e46d91bb7 100644
--- a/modules/core/os_set.cpp
+++ b/modules/core/os_set.cpp
@@ -72,14 +72,14 @@ class CommandOSSet : public Command
if (setting.equals_ci("ON"))
{
- readonly = 1;
+ readonly = true;
Alog() << "Read-only mode activated";
close_log();
notice_lang(Config.s_OperServ, u, OPER_SET_READONLY_ON);
}
else if (setting.equals_ci("OFF"))
{
- readonly = 0;
+ readonly = false;
open_log();
Alog() << "Read-only mode deactivated";
notice_lang(Config.s_OperServ, u, OPER_SET_READONLY_OFF);
@@ -219,13 +219,13 @@ class CommandOSSet : public Command
if (setting.equals_ci("ON"))
{
- noexpire = 1;
+ noexpire = true;
Alog() << "No expire mode activated";
notice_lang(Config.s_OperServ, u, OPER_SET_NOEXPIRE_ON);
}
else if (setting.equals_ci("OFF"))
{
- noexpire = 0;
+ noexpire = false;
Alog() << "No expire mode deactivated";
notice_lang(Config.s_OperServ, u, OPER_SET_NOEXPIRE_OFF);
}
diff --git a/modules/core/os_shutdown.cpp b/modules/core/os_shutdown.cpp
index c65a21673..c92713f83 100644
--- a/modules/core/os_shutdown.cpp
+++ b/modules/core/os_shutdown.cpp
@@ -26,7 +26,7 @@ class CommandOSShutdown : public Command
if (Config.GlobalOnCycle)
oper_global("", "%s", Config.GlobalOnCycleMessage.c_str());
- shutting_down = 1;
+ shutting_down = true;
return MOD_CONT;
}
diff --git a/modules/core/os_update.cpp b/modules/core/os_update.cpp
index 0765b6acd..dbe6bef24 100644
--- a/modules/core/os_update.cpp
+++ b/modules/core/os_update.cpp
@@ -23,7 +23,7 @@ class CommandOSUpdate : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
notice_lang(Config.s_OperServ, u, OPER_UPDATING);
- save_data = 1;
+ save_data = true;
return MOD_CONT;
}
diff --git a/modules/protocol/inspircd11.cpp b/modules/protocol/inspircd11.cpp
index 7f98433d7..e7297b679 100644
--- a/modules/protocol/inspircd11.cpp
+++ b/modules/protocol/inspircd11.cpp
@@ -1004,21 +1004,21 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av)
{
send_cmd("", "ERROR :m_globops is not loaded. This is required by Anope");
quitmsg = "ERROR: Remote server does not have the m_globops module loaded, and this is required.";
- quitting = 1;
+ quitting = true;
return MOD_STOP;
}
if (!has_servicesmod)
{
send_cmd("", "ERROR :m_services is not loaded. This is required by Anope");
quitmsg = "ERROR: Remote server does not have the m_services module loaded, and this is required.";
- quitting = 1;
+ quitting = true;
return MOD_STOP;
}
if (!has_hidechansmod)
{
send_cmd("", "ERROR :m_hidechans.so is not loaded. This is required by Anope");
quitmsg = "ERROR: Remote server deos not have the m_hidechans module loaded, and this is required.";
- quitting = 1;
+ quitting = true;
return MOD_STOP;
}
if (!has_svsholdmod)
diff --git a/modules/protocol/inspircd12.cpp b/modules/protocol/inspircd12.cpp
index 97cfbac29..61d51ed9a 100644
--- a/modules/protocol/inspircd12.cpp
+++ b/modules/protocol/inspircd12.cpp
@@ -1178,21 +1178,21 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av)
{
send_cmd("", "ERROR :m_globops is not loaded. This is required by Anope");
quitmsg = "Remote server does not have the m_globops module loaded, and this is required.";
- quitting = 1;
+ quitting = true;
return MOD_STOP;
}
if (!has_servicesmod)
{
send_cmd("", "ERROR :m_services_account.so is not loaded. This is required by Anope");
quitmsg = "ERROR: Remote server does not have the m_services_account module loaded, and this is required.";
- quitting = 1;
+ quitting = true;
return MOD_STOP;
}
if (!has_hidechansmod)
{
send_cmd("", "ERROR :m_hidechans.so is not loaded. This is required by Anope");
quitmsg = "ERROR: Remote server does not have the m_hidechans module loaded, and this is required.";
- quitting = 1;
+ quitting = true;
return MOD_STOP;
}
if (!has_svsholdmod)
diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp
index 776ec00d4..69e648193 100644
--- a/modules/protocol/inspircd20.cpp
+++ b/modules/protocol/inspircd20.cpp
@@ -880,7 +880,7 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av)
{
send_cmd("", "ERROR :Protocol mismatch, no or invalid protocol version given in CAPAB START");
quitmsg = "Protocol mismatch, no or invalid protocol version given in CAPAB START";
- quitting = 1;
+ quitting = true;
return MOD_STOP;
}
@@ -1158,14 +1158,14 @@ int anope_event_capab(const Anope::string &source, int ac, const char **av)
{
send_cmd("", "ERROR :m_services_account.so is not loaded. This is required by Anope");
quitmsg = "ERROR: Remote server does not have the m_services_account module loaded, and this is required.";
- quitting = 1;
+ quitting = true;
return MOD_STOP;
}
if (!ModeManager::FindUserModeByName(UMODE_PRIV))
{
send_cmd("", "ERROR :m_hidechans.so is not loaded. This is required by Anope");
quitmsg = "ERROR: Remote server does not have the m_hidechans module loaded, and this is required.";
- quitting = 1;
+ quitting = true;
return MOD_STOP;
}
if (!has_svsholdmod)
diff --git a/src/init.cpp b/src/init.cpp
index 7388f7e79..811981a32 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -225,25 +225,25 @@ int init_primary(int ac, char **av)
}
if (GetCommandLineArgument("nofork", 'n'))
- nofork = 1;
+ nofork = true;
if (GetCommandLineArgument("support", 's'))
{
- nofork = nothird = 1;
+ nofork = nothird = true;
++debug;
}
if (GetCommandLineArgument("readonly", 'r'))
- readonly = 1;
+ readonly = true;
if (GetCommandLineArgument("nothird"))
- nothird = 1;
+ nothird = true;
if (GetCommandLineArgument("noexpire", 'e'))
- noexpire = 1;
+ noexpire = true;
if (GetCommandLineArgument("protocoldebug"))
- protocoldebug = 1;
+ protocoldebug = true;
Anope::string Arg;
if (GetCommandLineArgument("debug", 'd', Arg))
diff --git a/src/main.cpp b/src/main.cpp
index 5e29db9f8..9f108a4d9 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -42,13 +42,12 @@ Anope::string services_bin; /* Binary as specified by the user */
Anope::string orig_cwd; /* Original current working directory */
Anope::string log_filename = "services.log"; /* -log filename */
int debug = 0; /* -debug */
-int readonly = 0; /* -readonly */
+bool readonly = false; /* -readonly */
bool LogChan = false; /* -logchan */
-int nofork = 0; /* -nofork */
-int forceload = 0; /* -forceload */
-int nothird = 0; /* -nothrid */
-int noexpire = 0; /* -noexpire */
-int protocoldebug = 0; /* -protocoldebug */
+bool nofork = false; /* -nofork */
+bool nothird = false; /* -nothrid */
+bool noexpire = false; /* -noexpire */
+bool protocoldebug = false; /* -protocoldebug */
Anope::string binary_dir; /* Used to store base path for Anope */
#ifdef _WIN32
@@ -57,16 +56,16 @@ Anope::string binary_dir; /* Used to store base path for Anope */
#endif
/* Set to 1 if we are to quit */
-int quitting = 0;
+bool quitting = false;
/* Set to 1 if we are to quit after saving databases */
-int shutting_down = 0;
+bool shutting_down = false;
/* Contains a message as to why services is terminating */
Anope::string quitmsg;
/* Should we update the databases now? */
-int save_data = 0;
+bool save_data = false;
/* At what time were we started? */
time_t start_time;
@@ -77,7 +76,7 @@ char **my_av, **my_envp;
/******** Local variables! ********/
/* Set to 1 after we've set everything up */
-static int started = 0;
+static bool started = false;
/*************************************************************************/
@@ -272,7 +271,7 @@ void sighandler(int signum)
if (!read_config(1))
{
quitmsg = "Error Reading Configuration File (Received SIGHUP)";
- quitting = 1;
+ quitting = true;
}
FOREACH_MOD(I_OnReload, OnReload(true));
@@ -418,8 +417,6 @@ static bool Connect()
int main(int ac, char **av, char **envp)
{
- int i;
-
my_av = av;
my_envp = envp;
@@ -456,7 +453,8 @@ int main(int ac, char **av, char **envp)
ModuleRunTimeDirCleanUp();
/* General initialization first */
- if ((i = init_primary(ac, av)))
+ int i = init_primary(ac, av);
+ if (i)
return i;
Alog(LOG_TERMINAL) << "Anope " << Anope::Version() << ", " << Anope::Build();
@@ -467,7 +465,8 @@ int main(int ac, char **av, char **envp)
#endif
/* Initialization stuff. */
- if ((i = init_secondary(ac, av)))
+ i = init_secondary(ac, av);
+ if (i)
return i;
/* If the first connect fails give up, don't sit endlessly trying to reconnect */
@@ -477,7 +476,7 @@ int main(int ac, char **av, char **envp)
ircdproto->SendConnect();
FOREACH_MOD(I_OnServerConnect, OnServerConnect());
- started = 1;
+ started = true;
#ifndef _WIN32
if (Config.DumpCore)
@@ -515,12 +514,12 @@ int main(int ac, char **av, char **envp)
if (shutting_down)
ircdproto->SendGlobops(NULL, "Updating databases on shutdown, please wait.");
save_databases();
- save_data = 0;
+ save_data = false;
}
if (shutting_down)
{
- quitting = 1;
+ quitting = true;
break;
}
@@ -570,7 +569,7 @@ int main(int ac, char **av, char **envp)
if (Config.MaxRetries && j == Config.MaxRetries)
{
Alog() << "Max connection retry limit exceeded";
- quitting = 1;
+ quitting = true;
}
}
}