+static void version_completed(void attribute((unused)) *v,
+ const char attribute((unused)) *err,
+ const char *ver) {
+ long major, minor, patch, dev;
+
+ if(!ver) {
+ server_version = 0;
+ server_version_bytes = 0;
+ return;
+ }
+ server_version = ver;
+ server_version_bytes = 0;
+ major = strtol(ver, (char **)&ver, 10);
+ if(*ver != '.')
+ return;
+ ++ver;
+ minor = strtol(ver, (char **)&ver, 10);
+ if(*ver == '.') {
+ ++ver;
+ patch = strtol(ver, (char **)&ver, 10);
+ } else
+ patch = 0;
+ if(*ver) {
+ if(*ver == '+') {
+ dev = 1;
+ ++ver;
+ }
+ if(*ver)
+ dev = 2;
+ } else
+ dev = 0;
+ server_version_bytes = (major << 24) + (minor << 16) + (patch << 8) + dev;
+}
+