projects
/
m6w6
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Files are generated with each run, no reason to save them.
[m6w6/libmemcached]
/
src
/
memcat.c
diff --git
a/src/memcat.c
b/src/memcat.c
index 05011c0a6faecd09f40016058a305c5c871dded4..bb00ca66d494341cbbfdd6a6d37c5ba5fb3676cc 100644
(file)
--- a/
src/memcat.c
+++ b/
src/memcat.c
@@
-6,6
+6,9
@@
#include "client_options.h"
#include "utilities.h"
#include "client_options.h"
#include "utilities.h"
+#define PROGRAM_NAME "memcat"
+#define PROGRAM_DESCRIPTION "Cat a set of key values to stdout."
+
/* Prototypes */
void options_parse(int argc, char *argv[]);
/* Prototypes */
void options_parse(int argc, char *argv[]);
@@
-21,13
+24,18
@@
int main(int argc, char *argv[])
size_t string_length;
uint16_t flags;
memcached_return rc;
size_t string_length;
uint16_t flags;
memcached_return rc;
-
- memc= memcached_init(NULL);
+ memcached_server_st *servers;
options_parse(argc, argv);
options_parse(argc, argv);
- if (opt_servers)
- parse_opt_servers(memc, opt_servers);
+ if (!opt_servers)
+ return 0;
+
+ memc= memcached_create(NULL);
+
+ servers= parse_opt_servers(opt_servers);
+ memcached_server_push(memc, servers);
+ memcached_server_list_free(servers);
while (optind < argc)
{
while (optind < argc)
{
@@
-58,7
+66,7
@@
int main(int argc, char *argv[])
optind++;
}
optind++;
}
- memcached_
deinit
(memc);
+ memcached_
free
(memc);
free(opt_servers);
free(opt_servers);
@@
-71,6
+79,11
@@
void options_parse(int argc, char *argv[])
int option_index= 0;
int option_rv;
int option_index= 0;
int option_rv;
+ memcached_programs_help_st help_options[]=
+ {
+ {0},
+ };
+
static struct option long_options[]=
{
{"version", no_argument, NULL, OPT_VERSION},
static struct option long_options[]=
{
{"version", no_argument, NULL, OPT_VERSION},
@@
-97,12
+110,10
@@
void options_parse(int argc, char *argv[])
opt_verbose = OPT_DEBUG;
break;
case OPT_VERSION: /* --version or -V */
opt_verbose = OPT_DEBUG;
break;
case OPT_VERSION: /* --version or -V */
- printf("memcache tools, memcat, v1.0\n");
- exit(0);
+ version_command(PROGRAM_NAME);
break;
case OPT_HELP: /* --help or -h */
break;
case OPT_HELP: /* --help or -h */
- printf("useful help messages go here\n");
- exit(0);
+ help_command(PROGRAM_NAME, PROGRAM_DESCRIPTION, long_options, help_options);
break;
case OPT_SERVERS: /* --servers or -s */
opt_servers= strdup(optarg);
break;
case OPT_SERVERS: /* --servers or -s */
opt_servers= strdup(optarg);