summaryrefslogtreecommitdiff
path: root/src/misc.cpp
diff options
context:
space:
mode:
authorDukePyrolator <DukePyrolator@anope.org>2011-03-13 03:42:30 -0400
committerAdam <Adam@anope.org>2011-03-13 03:42:30 -0400
commit3fbf39b25d3ab95cab83baf198a24a7d6ad3689b (patch)
tree0b785f887b531ace1649ed019836b04954f3b460 /src/misc.cpp
parent15a833283b0ec501f8c986b269b8360c6aa923f9 (diff)
Added some useful Anope::Version functions to prevent some files from unnecessarily rebuilding on every make
Diffstat (limited to 'src/misc.cpp')
-rw-r--r--src/misc.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/misc.cpp b/src/misc.cpp
index 3fce523aa..1e1110fd9 100644
--- a/src/misc.cpp
+++ b/src/misc.cpp
@@ -11,6 +11,8 @@
*/
#include "services.h"
+#include "version.h"
+#include "modules.h"
/* Cheaper than isspace() or isblank() */
#define issp(c) ((c) == 32)
@@ -805,7 +807,7 @@ Anope::string Anope::printf(const Anope::string &fmt, ...)
{
va_list args;
char buf[1024];
- va_start(args, fmt.c_str());
+ va_start(args, fmt);
vsnprintf(buf, sizeof(buf), fmt.c_str(), args);
va_end(args);
return buf;
@@ -1150,3 +1152,28 @@ const Anope::string Anope::LastError()
#endif
}
+Version Module::GetVersion() const
+{
+ return Version(VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD);
+}
+
+Anope::string Anope::Version()
+{
+ return stringify(VERSION_MAJOR) + "." + stringify(VERSION_MINOR) + "." + stringify(VERSION_PATCH) + VERSION_EXTRA + " (" + stringify(VERSION_BUILD) + ")";
+}
+
+Anope::string Anope::VersionShort()
+{
+ return stringify(VERSION_MAJOR) + "." + stringify(VERSION_MINOR) + "." + stringify(VERSION_PATCH);
+}
+
+Anope::string Anope::VersionBuildString()
+{
+ return "build #" + stringify(BUILD) + ", compiled " + Anope::compiled;
+}
+
+int Anope::VersionMajor() { return VERSION_MAJOR; }
+int Anope::VersionMinor() { return VERSION_MINOR; }
+int Anope::VersionPatch() { return VERSION_PATCH; }
+int Anope::VersionBuild() { return VERSION_BUILD; }
+