*/
#include "config.h"
-#include <stdio.h>
-#include <unistd.h>
+#include <cstdio>
+#include <cstring>
#include <getopt.h>
+#include <iostream>
+#include <unistd.h>
+
#include <libmemcached/memcached.h>
-#include <string.h>
#include "client_options.h"
#include "utilities.h"
options_parse(argc, argv);
initialize_sockets();
- if (!opt_servers)
+ if (opt_servers == 0)
{
char *temp;
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL,
(uint64_t) opt_binary);
- if (!initialize_sasl(memc, opt_username, opt_passwd))
+ if (opt_username and LIBMEMCACHED_WITH_SASL_SUPPORT == 0)
+ {
+ memcached_free(memc);
+ std::cerr << "--username was supplied, but binary was not built with SASL support." << std::endl;
+ return EXIT_FAILURE;
+ }
+
+
+ if (opt_username and initialize_sasl(memc, opt_username, opt_passwd) == false)
{
+ std::cerr << "Failed to initialize SASL support." << std::endl;
+
memcached_free(memc);
return EXIT_FAILURE;
}