X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=clients%2Fmemcp.c;h=617057b32d4f54dfb836154498051ce7d6278459;hb=98c99981e0ebe7f716bea2e4d95434d159103fcd;hp=716bfefd03482e94c40d8b881260e598c2d55206;hpb=4801b6fa83529ab4327b1757e2d3a7ab4670ed5b;p=awesomized%2Flibmemcached diff --git a/clients/memcp.c b/clients/memcp.c index 716bfefd..617057b3 100644 --- a/clients/memcp.c +++ b/clients/memcp.c @@ -1,3 +1,14 @@ +/* LibMemcached + * Copyright (C) 2006-2009 Brian Aker + * All rights reserved. + * + * Use and distribution licensed under the BSD license. See + * the COPYING file in the parent directory for full text. + * + * Summary: + * + */ + #include "libmemcached/common.h" #include #include @@ -21,7 +32,7 @@ #define PROGRAM_DESCRIPTION "Copy a set of files to a memcached cluster." /* Prototypes */ -void options_parse(int argc, char *argv[]); +static void options_parse(int argc, char *argv[]); static int opt_binary=0; static int opt_verbose= 0; @@ -34,7 +45,7 @@ static time_t opt_expires= 0; int main(int argc, char *argv[]) { memcached_st *memc; - memcached_return rc; + memcached_return_t rc; memcached_server_st *servers; options_parse(argc, argv); @@ -65,7 +76,7 @@ int main(int argc, char *argv[]) memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, (uint64_t)opt_binary); - while (optind < argc) + while (optind < argc) { struct stat sbuf; int fd; @@ -89,7 +100,7 @@ int main(int argc, char *argv[]) else ptr= argv[optind]; - if (opt_verbose) + if (opt_verbose) { static const char *opstr[] = { "set", "add", "replace" }; printf("op: %s\nsource file: %s\nlength: %zu\n" @@ -100,13 +111,13 @@ int main(int argc, char *argv[]) if ((file_buffer_ptr= (char *)malloc(sizeof(char) * (size_t)sbuf.st_size)) == NULL) { - fprintf(stderr, "malloc: %s\n", strerror(errno)); + fprintf(stderr, "malloc: %s\n", strerror(errno)); exit(1); } if ((read_length= read(fd, file_buffer_ptr, (size_t)sbuf.st_size)) == -1) { - fprintf(stderr, "read: %s\n", strerror(errno)); + fprintf(stderr, "read: %s\n", strerror(errno)); exit(1); } @@ -131,7 +142,7 @@ int main(int argc, char *argv[]) if (rc != MEMCACHED_SUCCESS) { - fprintf(stderr, "memcp: %s: memcache error %s", + fprintf(stderr, "memcp: %s: memcache error %s", ptr, memcached_strerror(memc, rc)); if (memc->cached_errno) fprintf(stderr, " system error %s", strerror(memc->cached_errno)); @@ -153,7 +164,7 @@ int main(int argc, char *argv[]) return 0; } -void options_parse(int argc, char *argv[]) +static void options_parse(int argc, char *argv[]) { int option_index= 0; int option_rv; @@ -180,7 +191,7 @@ void options_parse(int argc, char *argv[]) {0, 0, 0, 0}, }; - while (1) + while (1) { option_rv= getopt_long(argc, argv, "Vhvds:", long_options, &option_index); @@ -222,6 +233,7 @@ void options_parse(int argc, char *argv[]) break; case OPT_ADD: opt_method= OPT_ADD; + break; case OPT_HASH: opt_hash= strdup(optarg); break;