From: Mark Atwood Date: Wed, 19 Sep 2007 12:16:17 +0000 (-0700) Subject: now memcp uses --set, --add, --replace X-Git-Tag: 0.2~18^2~1 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=926592394900405948468504e1e2ca0aabe88981;p=m6w6%2Flibmemcached now memcp uses --set, --add, --replace --- diff --git a/src/memcp.c b/src/memcp.c index b259c698..517ac940 100644 --- a/src/memcp.c +++ b/src/memcp.c @@ -115,10 +115,22 @@ int main(int argc, char *argv[]) { ptr= argv[optind]; } - - rc= memcached_set(memc, ptr, strlen(ptr), - mptr, sbuf.st_size, - expires, flags); + + if (opt_replace == 0) { + rc= memcached_set(memc, ptr, strlen(ptr), + mptr, sbuf.st_size, + expires, flags); + } else if (opt_replace == 1) { + rc= memcached_add(memc, ptr, strlen(ptr), + mptr, sbuf.st_size, + expires, flags); + } else if (opt_replace == 2) { + rc= memcached_replace(memc, ptr, strlen(ptr), + mptr, sbuf.st_size, + expires, flags); + } else { + abort(); + } munmap(mptr, sbuf.st_size); close(fd);