summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/initfile.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/initfile.cc')
-rw-r--r--crawl-ref/source/initfile.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index 162b97fd2f..6c9072505a 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -3514,6 +3514,7 @@ enum commandline_option_type {
CLO_ARENA,
CLO_TEST,
CLO_HELP,
+ CLO_VERSION,
CLO_NOPS
};
@@ -3521,7 +3522,7 @@ enum commandline_option_type {
static const char *cmd_ops[] = {
"scores", "name", "species", "job", "plain", "dir", "rc",
"rcdir", "tscores", "vscores", "scorefile", "morgue", "macro",
- "mapstat", "arena", "test", "help"
+ "mapstat", "arena", "test", "help", "version"
};
const int num_cmd_ops = CLO_NOPS;
@@ -3554,6 +3555,13 @@ std::string find_executable_path()
return std::string(tempPath);
}
+static void _print_version()
+{
+ printf("Crawl version %s" EOL, Version::Long().c_str());
+
+ printf("%s", compilation_info().c_str());
+}
+
bool parse_args( int argc, char **argv, bool rc_only )
{
COMPILE_CHECK(ARRAYSZ(cmd_ops) == CLO_NOPS, c1);
@@ -3798,6 +3806,10 @@ bool parse_args( int argc, char **argv, bool rc_only )
case CLO_HELP:
// Shouldn't happen.
return (false);
+
+ case CLO_VERSION:
+ _print_version();
+ end(0);
}
// Update position.