]> granicus.if.org Git - re2c/commitdiff
- Add version number support that can be used in autoconf checks
authorhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Mon, 21 Feb 2005 09:00:26 +0000 (09:00 +0000)
committerhelly <helly@642ea486-5414-0410-9d7f-a0204ed87703>
Mon, 21 Feb 2005 09:00:26 +0000 (09:00 +0000)
main.cc

diff --git a/main.cc b/main.cc
index f64bf19f93532f179d5a53c3c08e853449e46c51..46932ed7d76a2752e5bf8a5b348c7d855f1ad160 100644 (file)
--- a/main.cc
+++ b/main.cc
@@ -38,6 +38,7 @@ static const mbo_opt_struct OPTIONS[] =
         {'s', 0, "nested-ifs"},
         {'o', 1, "output"},
         {'v', 0, "version"},
+        {'V', 0, "vernum"},
         {'-', 0, NULL} /* end of args */ 
     };
 
@@ -60,7 +61,9 @@ static void usage()
        "\n"
        "-o      --output=output Specify the output file instead of stdout\n"
        "\n"
-       "-v      --version       Show version information.\n";
+       "-v      --version       Show version information.\n"
+       "-V      --vernum        Show version as one number.\n"
+       ;
 }
 
 } // end namespace re2c
@@ -104,6 +107,15 @@ int main(int argc, char *argv[])
                        case 'v':
                        cerr << "re2c " << PACKAGE_VERSION << "\n";
                        return 2;
+                       
+                       case 'V': {
+                               int v1, v2, v3;
+                               char version[16];
+                               sscanf(PACKAGE_VERSION, "%d.%d.%d", &v1, &v2, &v3);
+                               sprintf(version, "%02d%02d%02d", v1, v2, v3);
+                               cerr << version << "\n";
+                               return 2;
+                       }
 
                        case 'h':