# HG changeset patch # User Sebastien Jodogne # Date 1349695669 -7200 # Node ID 1969ff16457c3e1927a8e02d2d03e3ceca85a22b # Parent 5321f3609639824be552e0e1a62e48d254159eb2 help diff -r 5321f3609639 -r 1969ff16457c CMakeLists.txt --- a/CMakeLists.txt Mon Oct 08 10:34:13 2012 +0200 +++ b/CMakeLists.txt Mon Oct 08 13:27:49 2012 +0200 @@ -6,6 +6,8 @@ include(CheckIncludeFiles) include(CheckIncludeFileCXX) +add_definitions(-DORTHANC_VERSION="mainline") + SET(STATIC_BUILD ON CACHE BOOL "Static build of the third-party libraries (necessary for Windows)") SET(STANDALONE_BUILD OFF CACHE BOOL "Standalone build (necessary for cross-compilation or binary releases)") SET(ENABLE_SSL ON CACHE BOOL "Include support for SSL") diff -r 5321f3609639 -r 1969ff16457c OrthancServer/main.cpp --- a/OrthancServer/main.cpp Mon Oct 08 10:34:13 2012 +0200 +++ b/OrthancServer/main.cpp Mon Oct 08 13:27:49 2012 +0200 @@ -90,16 +90,61 @@ }; +void PrintHelp(char* path) +{ + std::cout + << "Usage: " << path << " [OPTION]... [CONFIGURATION]" << std::endl + << "Start Orthanc, a lightweight, RESTful DICOM server for healthcare and medical research." << std::endl + << std::endl + << "If no configuration file is given on the command line, a set of default parameters " << std::endl + << "is used. Please refer to the Orthanc homepage for the full instructions about how to use Orthanc " << std::endl + << "." << std::endl + << std::endl + << "Command-line options:" << std::endl + << " --help\t\tdisplay this help and exit" << std::endl + << " --version\t\toutput version information and exit" << std::endl + << " --logdir=[dir]\tdirectory where to store the log files" << std::endl + << "\t\t\t(if not used, the logs are dumped to stderr)" << std::endl + << std::endl + << "Exit status:" << std::endl + << " 0 if OK," << std::endl + << " -1 if error (have a look at the logs)." << std::endl + << std::endl; +} +void PrintVersion(char* path) +{ + std::cout + << path << " " << ORTHANC_VERSION << std::endl + << "Copyright (C) 2012 Medical Physics Department, CHU of Liege (Belgium) " << std::endl + << "Licensing GPLv3+: GNU GPL version 3 or later , with OpenSSL exception." << std::endl + << "This is free software: you are free to change and redistribute it." << std::endl + << "There is NO WARRANTY, to the extent permitted by law." << std::endl + << std::endl + << "Written by Sebastien Jodogne " << std::endl; +} + int main(int argc, char* argv[]) { // Initialize Google's logging library. FLAGS_logtostderr = true; - + for (int i = 1; i < argc; i++) { + if (std::string(argv[i]) == "--help") + { + PrintHelp(argv[0]); + return 0; + } + + if (std::string(argv[i]) == "--version") + { + PrintVersion(argv[0]); + return 0; + } + if (boost::starts_with(argv[i], "--logdir=")) { FLAGS_logtostderr = false; @@ -190,6 +235,7 @@ catch (OrthancException& e) { LOG(ERROR) << "EXCEPTION [" << e.What() << "]"; +return -1; } OrthancFinalize();