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
);
41 cerr
<< argv
[0] << ": -h or --help for usage" << std::endl
;
44 if (ceph_argparse_need_usage(args
)) {
49 bool opt_version
= false;
50 bool opt_vernum
= false;
52 auto cct
= global_init(NULL
, args
, CEPH_ENTITY_TYPE_CLIENT
,
53 CODE_ENVIRONMENT_UTILITY
,
54 CINIT_FLAG_NO_DEFAULT_CONFIG_FILE
);
55 common_init_finish(g_ceph_context
);
56 for (std::vector
<const char*>::iterator i
= args
.begin();
58 if (strcmp(*i
, "--") == 0) {
61 else if (strcmp(*i
, "--version") == 0) {
65 else if (strcmp(*i
, "--vernum") == 0) {
73 if (!opt_version
&& !opt_vernum
)
78 rados_version(&maj
, &min
, &ext
);
79 cout
<< maj
<< "." << min
<< "." << ext
<< std::endl
;
80 } else if (opt_vernum
) {
81 cout
<< hex
<< LIBRADOS_VERSION_CODE
<< dec
<< std::endl
;