3 memcached_return
memcached_version(memcached_st
*ptr
)
8 char buffer
[MEMCACHED_DEFAULT_COMMAND_SIZE
];
10 char *command
= "version\r\n";
12 send_length
= strlen(command
);
14 rc
= MEMCACHED_SUCCESS
;
15 for (x
= 0; x
< ptr
->number_of_hosts
; x
++)
19 rrc
= memcached_do(ptr
, x
, command
, send_length
, 1);
20 if (rrc
!= MEMCACHED_SUCCESS
)
22 rc
= MEMCACHED_SOME_ERRORS
;
26 rrc
= memcached_response(ptr
, buffer
, MEMCACHED_DEFAULT_COMMAND_SIZE
, NULL
, x
);
27 if (rrc
!= MEMCACHED_SUCCESS
)
28 rc
= MEMCACHED_SOME_ERRORS
;
30 /* Find the space, and then move one past it to copy version */
31 response_ptr
= index(buffer
, ' ');
34 ptr
->hosts
[x
].major_version
= (uint8_t)strtol(response_ptr
, (char **)NULL
, 10);
35 response_ptr
= index(response_ptr
, '.');
37 ptr
->hosts
[x
].minor_version
= (uint8_t)strtol(response_ptr
, (char **)NULL
, 10);
38 response_ptr
= index(response_ptr
, '.');
40 ptr
->hosts
[x
].micro_version
= (uint8_t)strtol(response_ptr
, (char **)NULL
, 10);