Add some versioning info. * md4c.h now contains macros MD_VERSION_xxxx. * md2html has option --version. (Of course those shall have some meaningful values only when we introduce some release process.)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
diff --git a/md2html/md2html.c b/md2html/md2html.c
index 27fddd8..d76d5a7 100644
--- a/md2html/md2html.c
+++ b/md2html/md2html.c
@@ -192,6 +192,7 @@ static const option cmdline_options[] = {
{ "full-html", 'f', 'f', OPTION_ARG_NONE },
{ "stat", 's', 's', OPTION_ARG_NONE },
{ "help", 'h', 'h', OPTION_ARG_NONE },
+ { "version", 'v', 'v', OPTION_ARG_NONE },
{ "fverbatim-entities", 0, 'E', OPTION_ARG_NONE },
{ "fpermissive-atx-headers", 0, 'A', OPTION_ARG_NONE },
{ "fpermissive-url-autolinks", 0, 'U', OPTION_ARG_NONE },
@@ -218,6 +219,7 @@ usage(void)
" -f, --full-html Generate full HTML document, including header\n"
" -s, --stat Measure time of input parsing\n"
" -h, --help Display this help and exit\n"
+ " -v, --version Display version and exit\n"
"\n"
"Markdown extension options:\n"
" --fcollapse-whitespace\n"
@@ -243,6 +245,12 @@ usage(void)
);
}
+static void
+version(void)
+{
+ printf("%d.%d.%d\n", MD_VERSION_MAJOR, MD_VERSION_MINOR, MD_VERSION_RELEASE);
+}
+
static const char* input_path = NULL;
static const char* output_path = NULL;
@@ -263,6 +271,7 @@ cmdline_callback(int opt, char const* value, void* data)
case 'f': want_fullhtml = 1; break;
case 's': want_stat = 1; break;
case 'h': usage(); exit(0); break;
+ case 'v': version(); exit(0); break;
case 'E': renderer_flags |= MD_RENDER_FLAG_VERBATIM_ENTITIES; break;
case 'A': parser_flags |= MD_FLAG_PERMISSIVEATXHEADERS; break;
diff --git a/md4c/md4c.h b/md4c/md4c.h
index 6c214ba..1e78647 100644
--- a/md4c/md4c.h
+++ b/md4c/md4c.h
@@ -31,6 +31,11 @@
#endif
+#define MD_VERSION_MAJOR 0
+#define MD_VERSION_MINOR 2
+#define MD_VERSION_RELEASE 0
+
+
/* Magic to support UTF-16. */
#if defined MD4C_USE_UTF16
#ifdef _WIN32