static int opt_verbose= 0;
static char *opt_servers= NULL;
+static char *opt_hash= NULL;
static int opt_method= OPT_SET;
static uint32_t opt_flags= 0;
static time_t opt_expires= 0;
options_parse(argc, argv);
memc= memcached_create(NULL);
+ process_hash_option(memc, opt_hash);
if (!opt_servers)
{
if ((temp= getenv("MEMCACHED_SERVERS")))
opt_servers= strdup(temp);
else
+ {
+ fprintf(stderr, "No Servers provided\n");
exit(1);
+ }
}
if (opt_servers)
memcached_free(memc);
- free(opt_servers);
+ if (opt_servers)
+ free(opt_servers);
+ if (opt_hash)
+ free(opt_hash);
return 0;
}
{"set", no_argument, NULL, OPT_SET},
{"add", no_argument, NULL, OPT_ADD},
{"replace", no_argument, NULL, OPT_REPLACE},
+ {"hash", required_argument, NULL, OPT_HASH},
{0, 0, 0, 0},
};
break;
case OPT_ADD:
opt_method= OPT_ADD;
+ case OPT_HASH:
+ opt_hash= strdup(optarg);
break;
case '?':
/* getopt_long already printed an error message. */