X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=clients%2Fmemparse.cc;h=ab4cee9eb7d72e949f97b0e3077c412d646dcb19;hb=2569efffe16042f47dc5d2c34528a9ec22fc18b0;hp=c2be258ec828ea95e71703378a81f5b11034d81b;hpb=aaf07fb6d380f4e4f0b5404d6b006afcfe62aa7f;p=awesomized%2Flibmemcached diff --git a/clients/memparse.cc b/clients/memparse.cc index c2be258e..ab4cee9e 100644 --- a/clients/memparse.cc +++ b/clients/memparse.cc @@ -2,7 +2,7 @@ * * Libmemcached library * - * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,30 +37,33 @@ #include +#include +#include #include -#include +#include int main(int argc, char *argv[]) { - if (argc != 2) + if (argc < 2) { - std::cerr << "Wrong number of arguments" << std::endl; + std::cerr << "No arguments provided." << std::endl; return EXIT_FAILURE; } - memcached_st *memc; - - memc= memcached_create(NULL); - - memcached_return_t rc= memcached_parse_options(memc, argv[1], strlen(argv[1])); - memcached_free(memc); - - if (rc != MEMCACHED_SUCCESS) + for (int x= 1; x < argc; x++) { - std::cerr << "Failed to parse options" << std::endl; - return EXIT_FAILURE; + char buffer[BUFSIZ]; + memcached_return_t rc; + rc= libmemcached_check_configuration(argv[x], strlen(argv[x]), buffer, sizeof(buffer)); + + if (rc != MEMCACHED_SUCCESS) + { + std::cerr << "Failed to parse argument #" << x << " " << argv[x] << std::endl; + std::cerr << buffer << std::endl; + return EXIT_FAILURE; + } } return EXIT_SUCCESS;