3 const char * memcached_lib_version(void) {
4 return LIBMEMCACHED_VERSION_STRING
;
7 memcached_return
memcached_version(memcached_st
*ptr
)
12 char buffer
[MEMCACHED_DEFAULT_COMMAND_SIZE
];
14 char *command
= "version\r\n";
16 send_length
= strlen(command
);
18 rc
= MEMCACHED_SUCCESS
;
19 for (x
= 0; x
< ptr
->number_of_hosts
; x
++)
23 rrc
= memcached_do(ptr
, x
, command
, send_length
, 1);
24 if (rrc
!= MEMCACHED_SUCCESS
)
26 rc
= MEMCACHED_SOME_ERRORS
;
30 rrc
= memcached_response(ptr
, buffer
, MEMCACHED_DEFAULT_COMMAND_SIZE
, NULL
, x
);
31 if (rrc
!= MEMCACHED_SUCCESS
)
32 rc
= MEMCACHED_SOME_ERRORS
;
34 /* Find the space, and then move one past it to copy version */
35 response_ptr
= index(buffer
, ' ');
38 ptr
->hosts
[x
].major_version
= (uint8_t)strtol(response_ptr
, (char **)NULL
, 10);
39 response_ptr
= index(response_ptr
, '.');
41 ptr
->hosts
[x
].minor_version
= (uint8_t)strtol(response_ptr
, (char **)NULL
, 10);
42 response_ptr
= index(response_ptr
, '.');
44 ptr
->hosts
[x
].micro_version
= (uint8_t)strtol(response_ptr
, (char **)NULL
, 10);