memcached_st *memc;\r
char *string;\r
size_t string_length;\r
- uint16_t flags;\r
+ uint16_t flags;\r
memcached_return rc;\r
\r
memc= memcached_init(NULL);\r
if (opt_displayflag)\r
{\r
if (opt_verbose)\r
- printf("key: %.*s\nflags: ", argv[optind]);\r
- printf("%d\n", flags);\r
+ printf("key: %s\nflags: ", argv[optind]);\r
+ printf("%x\n", flags);\r
}\r
else \r
{\r
if (opt_verbose)\r
- printf("key: %.*s\nflags: %d\nlength: %d\nvalue: ",\r
+ printf("key: %s\nflags: %x\nlength: %zu\nvalue: ",\r
argv[optind], flags, string_length);\r
printf("%.*s\n", string_length, string);\r
free(string);\r
\r
void options_parse(int argc, char *argv[])\r
{\r
- int option_index = 0;\r
+ int option_index= 0;\r
int option_rv;\r
\r
- static struct option long_options[] =\r
+ static struct option long_options[]=\r
{\r
{"version", no_argument, NULL, OPT_VERSION},\r
{"help", no_argument, NULL, OPT_HELP},\r
\r
while (1) \r
{\r
- option_rv = getopt_long(argc, argv, "Vhvds:", long_options, &option_index);\r
+ option_rv= getopt_long(argc, argv, "Vhvds:", long_options, &option_index);\r
if (option_rv == -1) break;\r
- switch (option_rv) {\r
+ switch (option_rv)\r
+ {\r
case 0:\r
break;\r
case OPT_VERSION: /* --version or -V */\r
char *ptr;\r
\r
fd= open(argv[optind], O_RDONLY);\r
- if (fd < 0) {\r
+ if (fd < 0)\r
+ {\r
fprintf(stderr, "memcp: %s: %s\n", argv[optind], strerror(errno));\r
optind++;\r
continue;\r
\r
(void)fstat(fd, &sbuf);\r
mptr= mmap(NULL, sbuf.st_size, PROT_READ, MAP_PRIVATE, fd, 0);\r
- if (mptr == MAP_FAILED) {\r
+ if (mptr == MAP_FAILED)\r
+ {\r
fprintf(stderr, "memcp: %s: %s\n", argv[optind], strerror(errno));\r
close(fd);\r
optind++;\r
else\r
ptr= argv[optind];\r
\r
- if (opt_verbose) {\r
- static char *opstr[] = { "set", "add", "replace" };\r
- printf("op: %s\nsource file: %s\nlength: %d\n"\r
- "key: %s\nflags: %d\n expires: %ld\n",\r
+ if (opt_verbose)\r
+ {\r
+ static char *opstr[]= { "set", "add", "replace" };\r
+ printf("op: %s\nsource file: %s\nlength: %zu\n"\r
+ "key: %s\nflags: %x\n expires: %ld\n",\r
opstr[opt_replace], argv[optind], sbuf.st_size,\r
ptr, opt_flags, opt_expires);\r
}\r
else\r
abort();\r
\r
- if (rc != MEMCACHED_SUCCESS) {\r
+ if (rc != MEMCACHED_SUCCESS)\r
+ {\r
fprintf(stderr, "memcp: %s: memcache error %s\n", \r
ptr, memcached_strerror(memc, rc));\r
}\r
memcached_deinit(memc);\r
\r
return 0;\r
-};\r
+}\r
\r
void options_parse(int argc, char *argv[])\r
{\r
int option_index= 0;\r
int option_rv;\r
\r
- static struct option long_options[] =\r
+ static struct option long_options[]=\r
{\r
{"version", no_argument, NULL, OPT_VERSION},\r
{"help", no_argument, NULL, OPT_HELP},\r
\r
if (option_rv == -1) break;\r
\r
- switch (option_rv) {\r
+ switch (option_rv)\r
+ {\r
case 0:\r
break;\r
case OPT_VERSION: /* --version or -V */\r
opt_servers= optarg;\r
break;\r
case OPT_FLAG: /* --flag */\r
- opt_flags= (uint16_t)strtol(optarg, (char **)NULL, 10);\r
+ opt_flags= (uint16_t)strtol(optarg, (char **)NULL, 16);\r
break;\r
case OPT_EXPIRE: /* --expire */\r
opt_expires= (time_t)strtol(optarg, (char **)NULL, 10);\r
memcached_st *memc;\r
char *string;\r
size_t string_length;\r
- time_t expires = 0;\r
+ time_t expires= 0;\r
memcached_return rc;\r
\r
- static struct option long_options[] =\r
+ static struct option long_options[]=\r
{\r
{"version", no_argument, NULL, OPT_VERSION},\r
{"help", no_argument, NULL, OPT_HELP},\r
{"expire", required_argument, NULL, OPT_EXPIRE},\r
{0, 0, 0, 0},\r
};\r
- int option_index = 0;\r
+ int option_index= 0;\r
int option_rv;\r
\r
while (1) \r
{\r
- option_rv = getopt_long(argc, argv, "Vhvds:", long_options, &option_index);\r
+ option_rv= getopt_long(argc, argv, "Vhvds:", long_options, &option_index);\r
if (option_rv == -1) break;\r
- switch (option_rv) {\r
+ switch (option_rv)\r
+ {\r
case 0:\r
break;\r
case OPT_VERSION: /* --version or -V */\r
exit(0);\r
break;\r
case OPT_SERVERS: /* --servers or -s */\r
- opt_servers = optarg;\r
+ opt_servers= optarg;\r
break;\r
case OPT_EXPIRE: /* --expire */\r
- expires = (time_t)strtol(optarg, (char **)NULL, 10);\r
+ expires= (time_t)strtol(optarg, (char **)NULL, 10);\r
break;\r
case '?':\r
/* getopt_long already printed an error message. */\r
\r
while (optind <= argc) \r
{\r
- if (opt_verbose) {\r
+ if (opt_verbose)\r
printf("key: %s\nexpires: %ld\n", argv[optind], expires);\r
- }\r
- rc = memcached_delete(memc, argv[optind], strlen(argv[optind]), expires);\r
\r
- if (rc != MEMCACHED_SUCCESS) {\r
+ rc= memcached_delete(memc, argv[optind], strlen(argv[optind]), expires);\r
+\r
+ if (rc != MEMCACHED_SUCCESS)\r
fprintf(stderr, "memrm: %s: memcache error %s\n", \r
argv[optind], memcached_strerror(memc, rc));\r
- }\r
\r
optind++;\r
}\r
memcached_deinit(memc);\r
\r
return 0;\r
-};\r
+}\r
void options_parse(int argc, char *argv[])
{
- static struct option long_options[] =
+ static struct option long_options[]=
{
{"version", no_argument, NULL, OPT_VERSION},
{"help", no_argument, NULL, OPT_HELP},
{0, 0, 0, 0},
};
- int option_index = 0;
+ int option_index= 0;
int option_rv;
while (1)
{
- option_rv = getopt_long(argc, argv, "Vhvds:", long_options, &option_index);
+ option_rv= getopt_long(argc, argv, "Vhvds:", long_options, &option_index);
if (option_rv == -1) break;
- switch (option_rv) {
+ switch (option_rv)
+ {
case 0:
break;
case OPT_VERSION: /* --version or -V */
exit(0);
break;
case OPT_SERVERS: /* --servers or -s */
- opt_servers = optarg;
+ opt_servers= optarg;
break;
case '?':
/* getopt_long already printed an error message. */