summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2002-04-29 22:48:17 +0000
committerMark Spruiell <mes@zeroc.com>2002-04-29 22:48:17 +0000
commita4e41edee428a3a82fecd4bf94c88d0614f991e9 (patch)
tree3221bb23494dc93443efabe59c30b8da7da9e689 /cpp/src
parentupdating SSL dependencies (diff)
downloadice-a4e41edee428a3a82fecd4bf94c88d0614f991e9.tar.bz2
ice-a4e41edee428a3a82fecd4bf94c88d0614f991e9.tar.xz
ice-a4e41edee428a3a82fecd4bf94c88d0614f991e9.zip
check command-line options
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/IceBox/Server.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/cpp/src/IceBox/Server.cpp b/cpp/src/IceBox/Server.cpp
index 56b3b58680e..afeb2a60bf0 100644
--- a/cpp/src/IceBox/Server.cpp
+++ b/cpp/src/IceBox/Server.cpp
@@ -15,6 +15,17 @@ using namespace std;
using namespace Ice;
using namespace IceBox;
+static void
+usage(const char* appName)
+{
+ cerr << "Usage: " << appName << " [options]\n";
+ cerr <<
+ "Options:\n"
+ "-h, --help Show this message.\n"
+ "-v, --version Display the Ice version.\n"
+ ;
+}
+
int
main(int argc, char* argv[])
{
@@ -26,6 +37,26 @@ main(int argc, char* argv[])
{
communicator = initialize(argc, argv);
+ for (int i = 1; i < argc; ++i)
+ {
+ if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0)
+ {
+ usage(argv[0]);
+ return EXIT_SUCCESS;
+ }
+ else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0)
+ {
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
+ }
+ else
+ {
+ cerr << argv[0] << ": unknown option `" << argv[i] << "'" << endl;
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ }
+
PropertiesPtr properties = communicator->getProperties();
StringSeq args = argsToStringSeq(argc, argv);
args = properties->parseCommandLineOptions("IceBox", args);