From 19fcec84d8d7d21e796c7624e521b60d28ee21ed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:45:59 +0200 Subject: Adding upstream version 16.2.11+ds. Signed-off-by: Daniel Baumann --- src/librados-config.cc | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 src/librados-config.cc (limited to 'src/librados-config.cc') diff --git a/src/librados-config.cc b/src/librados-config.cc new file mode 100644 index 000000000..7948598b1 --- /dev/null +++ b/src/librados-config.cc @@ -0,0 +1,59 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab +/* + * Ceph - scalable distributed file system + * + * Copyright (C) 2004-2006 Sage Weil + * + * This is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License version 2, as published by the Free Software + * Foundation. See file COPYING. + * + */ +#include + +#include +#include +#include +#include +#include + +#include "include/rados/librados.h" +#include "ceph_ver.h" + +namespace po = boost::program_options; + +int main(int argc, const char **argv) +{ + po::options_description desc{"usage: librados-config [option]"}; + desc.add_options() + ("help,h", "print this help message") + ("version", "library version") + ("vernum", "library version code") + ("release", "print release name"); + + po::parsed_options parsed = + po::command_line_parser(argc, argv).options(desc).run(); + po::variables_map vm; + po::store(parsed, vm); + po::notify(vm); + + if (vm.count("help")) { + std::cout << desc << std::endl; + } else if (vm.count("version")) { + int maj, min, ext; + rados_version(&maj, &min, &ext); + std::cout << maj << "." << min << "." << ext << std::endl; + } else if (vm.count("vernum")) { + std::cout << std::hex << LIBRADOS_VERSION_CODE << std::dec << std::endl; + } else if (vm.count("release")) { + std::cout << CEPH_RELEASE_NAME << ' ' + << '(' << CEPH_RELEASE_TYPE << ')' + << std::endl; + } else { + std::cerr << argv[0] << ": -h or --help for usage" << std::endl; + return 1; + } +} + -- cgit v1.2.3