diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-05-31 11:27:02 +0200 |
---|---|---|
committer | Johannes Berg <johannes@sipsolutions.net> | 2008-05-31 11:27:02 +0200 |
commit | d1553f1417896deea5f534518a19ad92d9ecbcb9 (patch) | |
tree | 8e4650c8127b674790ca481307885a0a06214d18 /dovecot-version.c | |
parent | 5a2cb64e4da591bea59a38fc4363ace858063930 (diff) | |
download | dovecot-antispam-d1553f1417896deea5f534518a19ad92d9ecbcb9.tar.gz dovecot-antispam-d1553f1417896deea5f534518a19ad92d9ecbcb9.tar.xz dovecot-antispam-d1553f1417896deea5f534518a19ad92d9ecbcb9.zip |
auto-detect dovecot version
Diffstat (limited to 'dovecot-version.c')
-rw-r--r-- | dovecot-version.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/dovecot-version.c b/dovecot-version.c new file mode 100644 index 0000000..82772a9 --- /dev/null +++ b/dovecot-version.c @@ -0,0 +1,34 @@ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include "config.h" + +int main(int argc, char **argv) +{ + char *v = PACKAGE_STRING, *e; + int maj = 0, min = 0; + + if (strncmp(v, "dovecot ", 8)) + return 1; + + /* skip "dovecot " */ + v += 8; + + maj = strtol(v, &e, 10); + if (v == e) + return 1; + + v = e + 1; + + min = strtol(v, &e, 10); + if (v == e) + return 1; + + printf("/* Auto-generated file, do not edit */\n\n"); + printf("#define DOVECOT_VERSION_CODE(maj, min) ((maj)<<8 | (min))\n\n"); + + printf("#define DOVECOT_VERSION 0x%.2x%.2x\n", maj, min); + printf("#define ANTISPAM_STORAGE \"antispam-storage-%d.%d.c\"\n", maj, min); + + return 0; +} |