X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Fbin%2Fcommon%2Foptions.cpp;h=33b085a7842eb0bf3ca8326dcff016d480253608;hb=03c0a641f8dbd5cc8a0d9ac62f7e8e2b00f45159;hp=4583e7b73e9a2537b5daf2e1ed906b0cc0561b9d;hpb=2e9eb0803f1fc81bfe6c3e2dda0ed2cbe1aa6a76;p=awesomized%2Flibmemcached diff --git a/src/bin/common/options.cpp b/src/bin/common/options.cpp index 4583e7b7..33b085a7 100644 --- a/src/bin/common/options.cpp +++ b/src/bin/common/options.cpp @@ -1,6 +1,6 @@ /* +--------------------------------------------------------------------+ - | libmemcached - C/C++ Client Library for memcached | + | libmemcached-awesome - C/C++ Client Library for memcached | +--------------------------------------------------------------------+ | Redistribution and use in source and binary forms, with or without | | modification, are permitted under the terms of the BSD license. | @@ -9,18 +9,11 @@ | the terms online at: https://opensource.org/licenses/BSD-3-Clause | +--------------------------------------------------------------------+ | Copyright (c) 2006-2014 Brian Aker https://datadifferential.com/ | - | Copyright (c) 2020 Michael Wallner | + | Copyright (c) 2020-2021 Michael Wallner https://awesome.co/ | +--------------------------------------------------------------------+ */ #include "options.hpp" -#include - -option client_options::null_opt{}; -const client_options::extended_option client_options::null_ext_opt{ - client_options::null_opt, - {}, {}, {},nullptr, false -}; void client_options::print_version() const { std::cout << prog_name << " v" << prog_vers << " (libmemcached v" << LIBMEMCACHED_VERSION_STRING << ")" @@ -84,8 +77,7 @@ void client_options::print_help() const { std::cout << "\n\t\t" << ext.help << "\n"; } - const auto &servers = get("servers"); - if (&servers != &null_ext_opt) { + if (has("servers")) { std::cout << "\nEnvironment:\n"; std::cout << "\tMEMCACHED_SERVERS=\n"; std::cout << "\t\tList of servers to use if `-s|--servers` was not provided.\n"; @@ -95,7 +87,7 @@ void client_options::print_help() const { bool client_options::parse(int argc, char **argv, char ***argp) { /* extern */ optind = 1; - auto &debug = get("debug"); + auto debug = has("debug") ? &get("debug") : nullptr; std::string short_opts{}; std::vector