static int opt_verbose= 0;
static int opt_displayflag= 0;
-static char *opt_servers;
+static char *opt_servers= NULL;
+static char *opt_hash= NULL;
int main(int argc, char *argv[])
{
}
memc= memcached_create(NULL);
+ process_hash_option(memc, opt_hash);
servers= memcached_servers_parse(opt_servers);
memcached_free(memc);
- free(opt_servers);
+ if (opt_servers)
+ free(opt_servers);
+ if (opt_hash)
+ free(opt_hash);
return 0;
}
{"debug", no_argument, &opt_verbose, OPT_DEBUG},
{"servers", required_argument, NULL, OPT_SERVERS},
{"flag", no_argument, &opt_displayflag, OPT_FLAG},
+ {"hash", required_argument, NULL, OPT_HASH},
{0, 0, 0, 0},
};
case OPT_SERVERS: /* --servers or -s */
opt_servers= strdup(optarg);
break;
+ case OPT_HASH:
+ opt_hash= strdup(optarg);
+ break;
case '?':
/* getopt_long already printed an error message. */
exit(1);