summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2015-01-23 17:04:14 +0100
committerNick Wellnhofer <wellnhofer@aevum.de>2015-01-23 17:23:35 +0100
commit3248801a925449644071671dcd85e370303071b4 (patch)
treedaf4bd900de49effe12e035f924e517d9716cd96 /src/main.c
parent96a4e04522584aab4ea1fe444f971bec935abc8a (diff)
Improve version information
Add version number and string as macros and symbols. Version numbers can be easily compared, for example in the C preprocessor: #include <cmark.h> #if CMARK_VERSION < 0x020200 #error Requires libcmark 2.2.0 or higher #endif Storing the version in a global variable allows to check the library version at runtime. For example: if (CMARK_VERSION != cmark_version) { warn("Compiled against libcmark %s, but using %s", CMARK_VERSION_STRING, cmark_version_string); } The version should be updated whenever the public API is changed.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 5855868..ef40a88 100644
--- a/src/main.c
+++ b/src/main.c
@@ -73,7 +73,7 @@ int main(int argc, char *argv[])
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "--version") == 0) {
- printf("cmark %s", CMARK_VERSION);
+ printf("cmark %s", CMARK_VERSION_STRING);
printf(" - CommonMark converter (c) 2014 John MacFarlane\n");
exit(0);
} else if (strcmp(argv[i], "--sourcepos") == 0) {