X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=clients%2Fmemcat.cc;h=ab482e5d6ad57549b17f06d0352b3b132562f1b4;hb=3481bbb3f9e4f98c7b984b0f77ebeb468a7d486b;hp=fdbcb67ea5180edee241bfe378aa2235dbf3ca0c;hpb=5d66b2f99bf7de6f54a3e463b01542b997f68ac8;p=m6w6%2Flibmemcached diff --git a/clients/memcat.cc b/clients/memcat.cc index fdbcb67e..ab482e5d 100644 --- a/clients/memcat.cc +++ b/clients/memcat.cc @@ -9,14 +9,13 @@ * */ -#include "config.h" +#include +#include +#include +#include #include -#include -#include -#include #include -#include #include #include "utilities.h" @@ -81,10 +80,15 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; } - if (opt_username and initialize_sasl(memc, opt_username, opt_passwd) == false) + if (opt_username) { - memcached_free(memc); - return EXIT_FAILURE; + memcached_return_t ret; + if (memcached_failed(ret= memcached_set_sasl_auth_data(memc, opt_username, opt_passwd))) + { + std::cerr << memcached_last_error_message(memc) << std::endl; + memcached_free(memc); + return EXIT_FAILURE; + } } while (optind < argc) @@ -170,8 +174,6 @@ int main(int argc, char *argv[]) if (opt_hash) free(opt_hash); - shutdown_sasl(); - return return_code; } @@ -190,6 +192,7 @@ void options_parse(int argc, char *argv[]) { {(OPTIONSTRING)"version", no_argument, NULL, OPT_VERSION}, {(OPTIONSTRING)"help", no_argument, NULL, OPT_HELP}, + {(OPTIONSTRING)"quiet", no_argument, NULL, OPT_QUIET}, {(OPTIONSTRING)"verbose", no_argument, &opt_verbose, OPT_VERBOSE}, {(OPTIONSTRING)"debug", no_argument, &opt_verbose, OPT_DEBUG}, {(OPTIONSTRING)"servers", required_argument, NULL, OPT_SERVERS}, @@ -240,6 +243,11 @@ void options_parse(int argc, char *argv[]) case OPT_FILE: opt_file= optarg; break; + + case OPT_QUIET: + close_stdio(); + break; + case '?': /* getopt_long already printed an error message. */ exit(1);