static int opt_displayflag;\r
static char *opt_servers;\r
\r
+struct memcached_st *parse_opt_servers (struct memcached_st *m,\r
+ char *opt_servers)\r
+{\r
+ char *s, *hostname;\r
+ unsigned int portnum;\r
+ while (s = strsep(&opt_servers, ",")) {\r
+ hostname = strsep(&s, ":");\r
+ portnum = atoi(s);\r
+ memcached_server_add(m, hostname, portnum);\r
+ }\r
+ return m;\r
+}\r
+\r
int main(int argc, char *argv[])\r
{\r
memcached_st *memc;\r
}\r
}\r
\r
- /* todo, turn opt_servers into something to pass to memcached_init */\r
- memc= memcached_init(NULL);\r
+ memc = malloc(sizeof(struct memcached_st));\r
+ memcached_init(memc);\r
+ memc= parse_opt_servers(memc, opt_servers);\r
+ memc= memcached_init(memc);\r
\r
for (x= 1; x < argc; x++)\r
{\r