foxygit / doom Log in
commit b00a10ae3398b04c6d6ad890fad80bd53aa7d763
Author:     Mike Swanson <mikeonthecomputer@gmail.com>
AuthorDate: Sat Nov 3 06:43:14 2018 -0700
Commit:     Mike Swanson <mikeonthecomputer@gmail.com>
CommitDate: Thu Nov 8 12:17:33 2018 -0800

    Add a -version parameter like most programs have

    Supports both -version and --version, even though the later breaks
    the normal convention of Doom parameters, it is common enough with
    any general program that it should be useful to include in this.
---
 src/i_main.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/i_main.c b/src/i_main.c
index 8ea237b1..0fb175bb 100644
--- a/src/i_main.c
+++ b/src/i_main.c
@@ -41,6 +41,17 @@ int main(int argc, char **argv)
     myargc = argc;
     myargv = argv;

+    //!
+    // @arg
+    //
+    // Print the program version and exit.
+    //
+
+    if (M_ParmExists("-version") || M_ParmExists("--version")) {
+        puts (PACKAGE_NAME " " PACKAGE_VERSION);
+        exit (0);
+    }
+
     M_FindResponseFile();

     #ifdef SDL_HINT_NO_SIGNAL_HANDLERS