1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License version 2, as published by the Free Software
11 * Foundation. See file COPYING.
15 #include "common/config.h"
17 #include "common/ceph_argparse.h"
18 #include "global/global_init.h"
19 #include "global/global_context.h"
20 #include "include/rados/librados.h"
24 cout << "usage: librados-config [option]\n"
25 << "where options are:\n"
26 << " --version library version\n"
27 << " --vernum library version code\n";
36 int main(int argc, const char **argv)
38 vector<const char*> args;
39 argv_to_vec(argc, argv, args);
42 bool opt_version = false;
43 bool opt_vernum = false;
45 auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
46 CODE_ENVIRONMENT_UTILITY,
47 CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
48 common_init_finish(g_ceph_context);
49 for (std::vector<const char*>::iterator i = args.begin();
51 if (strcmp(*i, "--") == 0) {
54 else if (strcmp(*i, "--version") == 0) {
58 else if (strcmp(*i, "--vernum") == 0) {
66 if (!opt_version && !opt_vernum)
71 rados_version(&maj, &min, &ext);
72 cout << maj << "." << min << "." << ext << std::endl;
73 } else if (opt_vernum) {
74 cout << hex << LIBRADOS_VERSION_CODE << dec << std::endl;