diff options
Diffstat (limited to '')
-rw-r--r-- | dovecot-version.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/dovecot-version.c b/dovecot-version.c index fbb7a88..7733e60 100644 --- a/dovecot-version.c +++ b/dovecot-version.c @@ -5,8 +5,9 @@ int main(int argc, char **argv) { - char *v = PACKAGE_STRING, *e; - int maj = 0, min = 0; + const char *v = PACKAGE_STRING; + char *e; + int maj = 0, min = 0, patch = 0; if (strncmp(v, "dovecot ", 8) && strncmp(v, "Dovecot ", 8)) return 1; @@ -24,11 +25,25 @@ int main(int argc, char **argv) if (v == e) return 1; + /* not end of string yet? */ + if (*e) { + v = e + 1; + + patch = 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_CODE(maj, min, patch) " + "((maj)<<16 | ((min)<<8) | (patch))\n\n"); - printf("#define DOVECOT_VERSION 0x%.2x%.2x\n", maj, min); - printf("#define ANTISPAM_STORAGE \"antispam-storage-%d.%d.c\"\n", maj, min); + printf("#define DOVECOT_VERSION " + "0x%.2x%.2x%.2x\n", maj, min, 0); + printf("#define DOVECOT_VPATCH " + "0x%.2x%.2x%.2x\n", maj, min, patch); + printf("#define ANTISPAM_STORAGE " + "\"antispam-storage-%d.%d.c\"\n", maj, min); return 0; } |