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
/
memflush.c
diff --git
a/src/memflush.c
b/src/memflush.c
index a1a9ccadb527cbe42c533db61c047ee84804211c..af7ab35317c7ba4e178a86b024ccd201a9ccac7a 100644
(file)
--- a/
src/memflush.c
+++ b/
src/memflush.c
@@
-9,6
+9,9
@@
static int opt_verbose= 0;
static time_t opt_expire= 0;
static char *opt_servers= NULL;
static time_t opt_expire= 0;
static char *opt_servers= NULL;
+#define PROGRAM_NAME "memflush"
+#define PROGRAM_DESCRIPTION "Erase all data in a server of memcached servers."
+
/* Prototypes */
void options_parse(int argc, char *argv[]);
/* Prototypes */
void options_parse(int argc, char *argv[]);
@@
-23,7
+26,7
@@
int main(int argc, char *argv[])
if (!opt_servers)
return 0;
if (!opt_servers)
return 0;
- memc= memcached_
init
(NULL);
+ memc= memcached_
create
(NULL);
servers= parse_opt_servers(opt_servers);
memcached_server_push(memc, servers);
servers= parse_opt_servers(opt_servers);
memcached_server_push(memc, servers);
@@
-36,7
+39,7
@@
int main(int argc, char *argv[])
memcached_strerror(memc, rc));
}
memcached_strerror(memc, rc));
}
- memcached_
deinit
(memc);
+ memcached_
free
(memc);
free(opt_servers);
free(opt_servers);
@@
-46,6
+49,11
@@
int main(int argc, char *argv[])
void options_parse(int argc, char *argv[])
{
void options_parse(int argc, char *argv[])
{
+ 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},
@@
-74,12
+82,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, memflush, 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);