*
*/
-#include "config.h"
+#include <config.h>
+#include <cstdio>
+#include <cstring>
+#include <getopt.h>
#include <iostream>
-#include <stdio.h>
-#include <inttypes.h>
-#include <string.h>
#include <unistd.h>
-#include <getopt.h>
#include <libmemcached/memcached.h>
#include "utilities.h"
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)
if (opt_hash)
free(opt_hash);
- shutdown_sasl();
-
return return_code;
}
{
{(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},
case OPT_FILE:
opt_file= optarg;
break;
+
+ case OPT_QUIET:
+ close_stdio();
+ break;
+
case '?':
/* getopt_long already printed an error message. */
exit(1);