Mercurial > hg > orthanc
comparison OrthancServer/main.cpp @ 133:1969ff16457c
help
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 08 Oct 2012 13:27:49 +0200 |
parents | 2a24f43d9dca |
children | fe180eae201d |
comparison
equal
deleted
inserted
replaced
132:5321f3609639 | 133:1969ff16457c |
---|---|
88 //index_.db().Execute("DELETE FROM Studies"); | 88 //index_.db().Execute("DELETE FROM Studies"); |
89 } | 89 } |
90 }; | 90 }; |
91 | 91 |
92 | 92 |
93 | 93 void PrintHelp(char* path) |
94 { | |
95 std::cout | |
96 << "Usage: " << path << " [OPTION]... [CONFIGURATION]" << std::endl | |
97 << "Start Orthanc, a lightweight, RESTful DICOM server for healthcare and medical research." << std::endl | |
98 << std::endl | |
99 << "If no configuration file is given on the command line, a set of default parameters " << std::endl | |
100 << "is used. Please refer to the Orthanc homepage for the full instructions about how to use Orthanc " << std::endl | |
101 << "<https://code.google.com/p/orthanc/wiki/OrthancCookbook>." << std::endl | |
102 << std::endl | |
103 << "Command-line options:" << std::endl | |
104 << " --help\t\tdisplay this help and exit" << std::endl | |
105 << " --version\t\toutput version information and exit" << std::endl | |
106 << " --logdir=[dir]\tdirectory where to store the log files" << std::endl | |
107 << "\t\t\t(if not used, the logs are dumped to stderr)" << std::endl | |
108 << std::endl | |
109 << "Exit status:" << std::endl | |
110 << " 0 if OK," << std::endl | |
111 << " -1 if error (have a look at the logs)." << std::endl | |
112 << std::endl; | |
113 } | |
114 | |
115 | |
116 void PrintVersion(char* path) | |
117 { | |
118 std::cout | |
119 << path << " " << ORTHANC_VERSION << std::endl | |
120 << "Copyright (C) 2012 Medical Physics Department, CHU of Liege (Belgium) " << std::endl | |
121 << "Licensing GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>, with OpenSSL exception." << std::endl | |
122 << "This is free software: you are free to change and redistribute it." << std::endl | |
123 << "There is NO WARRANTY, to the extent permitted by law." << std::endl | |
124 << std::endl | |
125 << "Written by Sebastien Jodogne <s.jodogne@gmail.com>" << std::endl; | |
126 } | |
94 | 127 |
95 | 128 |
96 int main(int argc, char* argv[]) | 129 int main(int argc, char* argv[]) |
97 { | 130 { |
98 // Initialize Google's logging library. | 131 // Initialize Google's logging library. |
99 FLAGS_logtostderr = true; | 132 FLAGS_logtostderr = true; |
100 | 133 |
101 for (int i = 1; i < argc; i++) | 134 for (int i = 1; i < argc; i++) |
102 { | 135 { |
136 if (std::string(argv[i]) == "--help") | |
137 { | |
138 PrintHelp(argv[0]); | |
139 return 0; | |
140 } | |
141 | |
142 if (std::string(argv[i]) == "--version") | |
143 { | |
144 PrintVersion(argv[0]); | |
145 return 0; | |
146 } | |
147 | |
103 if (boost::starts_with(argv[i], "--logdir=")) | 148 if (boost::starts_with(argv[i], "--logdir=")) |
104 { | 149 { |
105 FLAGS_logtostderr = false; | 150 FLAGS_logtostderr = false; |
106 FLAGS_log_dir = std::string(argv[i]).substr(9); | 151 FLAGS_log_dir = std::string(argv[i]).substr(9); |
107 } | 152 } |
188 storeScp.Done(); | 233 storeScp.Done(); |
189 } | 234 } |
190 catch (OrthancException& e) | 235 catch (OrthancException& e) |
191 { | 236 { |
192 LOG(ERROR) << "EXCEPTION [" << e.What() << "]"; | 237 LOG(ERROR) << "EXCEPTION [" << e.What() << "]"; |
238 return -1; | |
193 } | 239 } |
194 | 240 |
195 OrthancFinalize(); | 241 OrthancFinalize(); |
196 | 242 |
197 return 0; | 243 return 0; |