From: Mark Atwood Date: Thu, 20 Sep 2007 19:44:57 +0000 (-0700) Subject: Make the --verbose flag do something X-Git-Tag: 0.2~14 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=8a685f7ae7c61368a40cd702c55bd662c25891b2;p=awesomized%2Flibmemcached Make the --verbose flag do something --- diff --git a/src/memcat.c b/src/memcat.c index 0b9690b2..7789ec9b 100644 --- a/src/memcat.c +++ b/src/memcat.c @@ -34,10 +34,17 @@ int main(int argc, char *argv[]) &string_length, &flags, &rc); if (rc == MEMCACHED_SUCCESS) { - if (opt_displayflag) + if (opt_displayflag) + { + if (opt_verbose) + printf("key: %.*s\nflags: ", argv[argc]); printf("%d\n", flags); + } else { + if (opt_verbose) + printf("key: %.*s\nflags: %d\nlength: %d\nvalue: ", + argv[argc], flags, string_length); printf("%.*s\n", string_length, string); free(string); } diff --git a/src/memcp.c b/src/memcp.c index 90d3fb37..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, diff --git a/src/memrm.c b/src/memrm.c index 5b6474b0..6deca09b 100644 --- a/src/memrm.c +++ b/src/memrm.c @@ -62,6 +62,9 @@ int main(int argc, char *argv[]) while (optind <= argc) { + if (opt_verbose) { + printf("key: %s\nexpires: %ld\n", argv[optind], expires); + } rc = memcached_delete(memc, argv[optind], strlen(argv[optind]), expires); optind++; }