X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmemcp.c;h=6ae8e3b4905154b3de3115e23408a44e442c064a;hb=8a685f7ae7c61368a40cd702c55bd662c25891b2;hp=88cbc351372588341757f1caecd46a4127ba7845;hpb=6d0bec130624e22e695dbf4038fbeed9e1c26c60;p=m6w6%2Flibmemcached diff --git a/src/memcp.c b/src/memcp.c index 88cbc351..6ae8e3b4 100644 --- a/src/memcp.c +++ b/src/memcp.c @@ -55,6 +55,14 @@ int main(int argc, char *argv[]) else ptr= argv[optind]; + if (opt_verbose) { + static char *opstr[] = { "set", "add", "replace" }; + printf("op: %s\nsource file: %s\nlength: %d\n" + "key: %s\nflags: %d\n expires: %ld\n", + opstr[opt_replace], argv[optind], sbuf.st_size, + ptr, opt_flags, opt_expires); + } + if (opt_replace == 0) rc= memcached_set(memc, ptr, strlen(ptr), mptr, sbuf.st_size, @@ -102,21 +110,20 @@ void options_parse(int argc, char *argv[]) while (1) { - option_rv= getopt_long(argc, argv, "", long_options, &option_index); + option_rv= getopt_long(argc, argv, "Vhvds:", long_options, &option_index); if (option_rv == -1) break; switch (option_rv) { case 0: - if (long_options[option_index].name) break; - case OPT_VERSION: /* --version */ + case OPT_VERSION: /* --version or -V */ printf("memcache tools, memcp, v1.0\n"); exit(0); - case OPT_HELP: /* --help */ + case OPT_HELP: /* --help or -h */ printf("useful help messages go here\n"); exit(0); - case OPT_SERVERS: /* --servers */ + case OPT_SERVERS: /* --servers or -s */ opt_servers= optarg; break; case OPT_FLAG: /* --flag */