atf-version.cpp revision ef421f66f47224a42073deaf087378c5d0c9952e
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick//
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick// Automated Testing Framework (atf)
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick//
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick// Copyright (c) 2007, 2008, 2009, 2010 The NetBSD Foundation, Inc.
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick// All rights reserved.
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick//
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick// Redistribution and use in source and binary forms, with or without
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick// modification, are permitted provided that the following conditions
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick// are met:
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick// 1. Redistributions of source code must retain the above copyright
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick// notice, this list of conditions and the following disclaimer.
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick// 2. Redistributions in binary form must reproduce the above copyright
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick// notice, this list of conditions and the following disclaimer in the
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick// documentation and/or other materials provided with the distribution.
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick//
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick// THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick// CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick// IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick// IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick//
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick#if defined(HAVE_CONFIG_H)
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick#include "bconfig.h"
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick#endif
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick#include <cstdlib>
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick#include <iostream>
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick#include "atf-c++/detail/application.hpp"
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick#include "atf-c++/detail/ui.hpp"
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick#include "revision.h"
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiickclass atf_version : public atf::application::app {
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick static const char* m_description;
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiickpublic:
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick atf_version(void);
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick int main(void);
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick};
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiickconst char* atf_version::m_description =
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick "atf-version is a tool that shows information about the currently "
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick "installed version of ATF.";
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiickatf_version::atf_version(void) :
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick app(m_description, "atf-version(1)", "atf(7)")
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick{
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick}
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiick
e2c5185af3c50d9510e5df68aa37abdc6c0d3aacChristopher Kiickint
atf_version::main(void)
{
using atf::ui::format_text;
using atf::ui::format_text_with_tag;
std::cout << PACKAGE_STRING " (" PACKAGE_TARNAME "-" PACKAGE_VERSION
")\n" PACKAGE_COPYRIGHT "\n\n";
#if defined(PACKAGE_REVISION_TYPE_DIST)
std::cout << format_text("Built from a distribution file; no revision "
"information available.") << "\n";
#elif defined(PACKAGE_REVISION_TYPE_MTN)
std::cout << format_text_with_tag(PACKAGE_REVISION_BRANCH, "Branch: ",
false) << "\n";
std::cout << format_text_with_tag(PACKAGE_REVISION_BASE
# if PACKAGE_REVISION_MODIFIED
" (locally modified)"
# endif
" " PACKAGE_REVISION_DATE,
"Base revision: ", false) << "\n";
#else
# error "Unknown PACKAGE_REVISION_TYPE value"
#endif
return EXIT_SUCCESS;
}
int
main(int argc, char* const* argv)
{
return atf_version().run(argc, argv);
}