From: Mark Atwood Date: Wed, 19 Sep 2007 10:15:23 +0000 (-0700) Subject: implement --flags for memcat, display flags instead of content X-Git-Tag: 0.2~20 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=18bd58a6e40d5398b84d42725453e47f7834639f;p=m6w6%2Flibmemcached implement --flags for memcat, display flags instead of content --- diff --git a/src/memcat.c b/src/memcat.c index ff8319be..645b54ac 100644 --- a/src/memcat.c +++ b/src/memcat.c @@ -78,10 +78,16 @@ int main(int argc, char *argv[]) { string= memcached_get(memc, argv[x], strlen(argv[x]), &string_length, &flags, &rc); - if (string) - { - printf("%.*s\n", string_length, string); - free(string); + if (rc == MEMCACHED_SUCCESS) { + if (opt_displayflag) { + printf("%d\n", flags); + } else { + if (string) + { + printf("%.*s\n", string_length, string); + free(string); + } + } } }