From: Mark Atwood Date: Thu, 20 Sep 2007 20:15:30 +0000 (-0700) Subject: fix bug in memcat X-Git-Tag: 0.2~12 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=634d51bb8d523b73f5a2507e913cd3ebee4c6cd7;p=m6w6%2Flibmemcached fix bug in memcat would only retrieve the last item on the command line --- diff --git a/src/memcat.c b/src/memcat.c index ec2fad9b..1a6e3898 100644 --- a/src/memcat.c +++ b/src/memcat.c @@ -30,21 +30,21 @@ int main(int argc, char *argv[]) while (optind <= argc) { - string= memcached_get(memc, argv[argc], strlen(argv[argc]), + string= memcached_get(memc, argv[optind], strlen(argv[optind]), &string_length, &flags, &rc); if (rc == MEMCACHED_SUCCESS) { if (opt_displayflag) { if (opt_verbose) - printf("key: %.*s\nflags: ", argv[argc]); + printf("key: %.*s\nflags: ", argv[optind]); printf("%d\n", flags); } else { if (opt_verbose) printf("key: %.*s\nflags: %d\nlength: %d\nvalue: ", - argv[argc], flags, string_length); + argv[optind], flags, string_length); printf("%.*s\n", string_length, string); free(string); } @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) else { fprintf(stderr, "memcat: %s: memcache error %s\n", - argv[argc], memcached_strerror(memc, rc)); + argv[optind], memcached_strerror(memc, rc)); } optind++; }