5 memcached_server_st
*parse_opt_servers(char *server_strings
)
11 memcached_server_st
*servers
= NULL
;
14 assert(server_strings
);
16 end_ptr
= server_strings
+ strlen(server_strings
);
18 for (begin_ptr
= server_strings
, string
= index(server_strings
, ',');
20 string
= index(begin_ptr
, ','))
22 char buffer
[HUGE_STRING_LEN
];
26 memset(buffer
, 0, HUGE_STRING_LEN
);
29 memcpy(buffer
, begin_ptr
, string
- begin_ptr
);
34 size_t length
= strlen(begin_ptr
);
35 memcpy(buffer
, begin_ptr
, length
);
39 ptr
= index(buffer
, ':');
47 port
= strtol(ptr
, (char **)NULL
, 10);
50 servers
= memcached_server_list_append(servers
, buffer
, port
, &rc
);
52 if (isspace(*begin_ptr
))
59 long int timedif(struct timeval a
, struct timeval b
)
63 us
= a
.tv_usec
- b
.tv_usec
;
65 s
= a
.tv_sec
- b
.tv_sec
;
70 void version_command(char *command_name
)
72 printf("%s v%u.%u\n", command_name
, 1, 0);
76 void help_command(char *command_name
, char *description
,
77 const struct option
*long_options
,
78 memcached_programs_help_st
*options
)
82 printf("%s v%u.%u\n\n", command_name
, 1, 0);
83 printf("\t%s\n\n", description
);
84 printf("Current options. A '=' means the option takes a value.\n\n");
86 for (x
= 0; long_options
[x
].name
; x
++)
87 printf("\t --%s%c\n", long_options
[x
].name
,
88 long_options
[x
].has_arg
? '=' : ' ');