11 #include "client_options.h"
12 #include "utilities.h"
15 void options_parse(int argc
, char *argv
[]);
17 static int opt_verbose
;
18 static int opt_displayflag
;
19 static char *opt_servers
;
21 int main(int argc
, char *argv
[])
25 memc
= memcached_init(NULL
);
26 options_parse(argc
, argv
);
29 parse_opt_servers(memc
, opt_servers
);
31 memcached_deinit(memc
);
36 void options_parse(int argc
, char *argv
[])
38 static struct option long_options
[]=
40 {"version", no_argument
, NULL
, OPT_VERSION
},
41 {"help", no_argument
, NULL
, OPT_HELP
},
42 {"verbose", no_argument
, &opt_verbose
, OPT_VERBOSE
},
43 {"debug", no_argument
, &opt_verbose
, OPT_DEBUG
},
44 {"servers", required_argument
, NULL
, OPT_SERVERS
},
45 {"flag", no_argument
, &opt_displayflag
, OPT_FLAG
},
54 option_rv
= getopt_long(argc
, argv
, "Vhvds:", long_options
, &option_index
);
55 if (option_rv
== -1) break;
60 case OPT_VERBOSE
: /* --verbose or -v */
61 opt_verbose
= OPT_VERBOSE
;
63 case OPT_DEBUG
: /* --debug or -d */
64 opt_verbose
= OPT_DEBUG
;
66 case OPT_VERSION
: /* --version or -V */
67 printf("memcache tools, memcat, v1.0\n");
70 case OPT_HELP
: /* --help or -h */
71 printf("useful help messages go here\n");
74 case OPT_SERVERS
: /* --servers or -s */
78 /* getopt_long already printed an error message. */