X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Fbin%2Fcommon%2Foptions.hpp;h=980ca38dc39ab8865a498002e98d6f334d4c2814;hb=4b584c02c679edd005cd2e542d2ff1d9dcb312b9;hp=70be59039d877b713c88e3a7ff11de29b70b812b;hpb=adec10db28a123bc0d64f8d1ff70b51b5ea5c435;p=awesomized%2Flibmemcached diff --git a/src/bin/common/options.hpp b/src/bin/common/options.hpp index 70be5903..980ca38d 100644 --- a/src/bin/common/options.hpp +++ b/src/bin/common/options.hpp @@ -19,13 +19,18 @@ #include #include #include -#include #include #include #include #include "libmemcached/common.h" +#ifdef HAVE_GETOPT_H +# include +#elif defined _MSC_VER +# include "win32/getopt.h" +#endif + class client_options { public: @@ -94,13 +99,13 @@ public: def("username", 'u', required_argument, "SASL username.") .apply = [](const client_options &opt, const extended_option &ext, memcached_st *memc) { if (auto username = ext.arg) { - if (!LIBMEMCACHED_WITH_SASL_SUPPORT) { +#if !LIBMEMCACHED_WITH_SASL_SUPPORT if (!opt.isset("quiet")) { std::cerr << "SASL username was supplied, but binary was not built with SASL support.\n"; - return false; } - } + return false; +#else if (memc) { if (MEMCACHED_SUCCESS != memcached_set_sasl_auth_data(memc, username, opt.argof("password"))) { @@ -110,6 +115,7 @@ public: return false; } } +#endif } return true; };