3 const char * memcached_lib_version(void)
5 return LIBMEMCACHED_VERSION_STRING
;
8 memcached_return
memcached_version(memcached_st
*ptr
)
13 char buffer
[MEMCACHED_DEFAULT_COMMAND_SIZE
];
15 char *command
= "version\r\n";
17 send_length
= strlen(command
);
19 rc
= MEMCACHED_SUCCESS
;
20 for (x
= 0; x
< ptr
->number_of_hosts
; x
++)
24 rrc
= memcached_do(&ptr
->hosts
[x
], command
, send_length
, 1);
25 if (rrc
!= MEMCACHED_SUCCESS
)
27 rc
= MEMCACHED_SOME_ERRORS
;
31 rrc
= memcached_response(&ptr
->hosts
[x
], buffer
, MEMCACHED_DEFAULT_COMMAND_SIZE
, NULL
);
32 if (rrc
!= MEMCACHED_SUCCESS
)
33 rc
= MEMCACHED_SOME_ERRORS
;
35 /* Find the space, and then move one past it to copy version */
36 response_ptr
= index(buffer
, ' ');
39 ptr
->hosts
[x
].major_version
= (uint8_t)strtol(response_ptr
, (char **)NULL
, 10);
40 response_ptr
= index(response_ptr
, '.');
42 ptr
->hosts
[x
].minor_version
= (uint8_t)strtol(response_ptr
, (char **)NULL
, 10);
43 response_ptr
= index(response_ptr
, '.');
45 ptr
->hosts
[x
].micro_version
= (uint8_t)strtol(response_ptr
, (char **)NULL
, 10);