version 1.13, 2001/06/02 02:25:33
|
version 1.14, 2001/06/02 14:01:29
|
|
|
char** argv, | char** argv, |
const String& pegasusHome) | const String& pegasusHome) |
{ | { |
static struct OptionRow options[] = |
static struct OptionRow optionsTable[] = |
{ | { |
{"port", "8888", false, Option::WHOLE_NUMBER, 0, 0, "port"}, |
{"port", "8888", false, Option::WHOLE_NUMBER, 0, 0, "port", |
{"trace", "false", false, Option::BOOLEAN, 0, 0, "t"}, |
"specifies port number to listen on" }, |
{"severity", "ALL", false, Option::STRING, 0, 0, "s"}, |
{"trace", "false", false, Option::BOOLEAN, 0, 0, "t", |
{"logs", "ALL", false, Option::STRING, 0, 0, "L"}, |
"turns on trace of Client IO to console "}, |
{"daemon", "false", false, Option::STRING, 0, 0, "d"}, |
{"logtrace", "false", false, Option::BOOLEAN, 0, 0, "l", |
{"version", "false", false, Option::BOOLEAN, 0, 0, "v"}, |
"Turns on trace of Client IO to trace log "}, |
{"help", "false", false, Option::BOOLEAN, 0, 0, "h"}, |
{"options", "false", false, Option::BOOLEAN, 0, 0, "options", |
{"debug", "false", false, Option::BOOLEAN, 0, 0, "d"} |
" Displays the settings of the Options "}, |
|
{"severity", "ALL", false, Option::STRING, 0, 0, "s", |
|
"Sets the severity level that will be logged "}, |
|
{"logs", "ALL", false, Option::STRING, 0, 0, "X", |
|
"Not Used "}, |
|
{"daemon", "false", false, Option::STRING, 0, 0, "d", |
|
"Not Used "}, |
|
{"version", "false", false, Option::BOOLEAN, 0, 0, "v", |
|
"Displays Pegasus Version "}, |
|
{"help", "false", false, Option::BOOLEAN, 0, 0, "h", |
|
"Prints help message with command line options "}, |
|
{"debug", "false", false, Option::BOOLEAN, 0, 0, "d", |
|
"Not Used "} |
}; | }; |
const Uint32 NUM_OPTIONS = sizeof(options) / sizeof(options[0]); |
const Uint32 NUM_OPTIONS = sizeof(optionsTable) / sizeof(optionsTable[0]); |
| |
om.registerOptions(options, NUM_OPTIONS); |
om.registerOptions(optionsTable, NUM_OPTIONS); |
| |
String configFile = pegasusHome + "/cimserver.conf"; | String configFile = pegasusHome + "/cimserver.conf"; |
| |
|
cout << "Config file from " << configFile << endl; |
|
|
if (FileSystem::exists(configFile)) | if (FileSystem::exists(configFile)) |
om.mergeFile(configFile); | om.mergeFile(configFile); |
| |
|
|
cout << '\n'; | cout << '\n'; |
cout << PEGASUS_NAME << PEGASUS_VERSION << endl; | cout << PEGASUS_NAME << PEGASUS_VERSION << endl; |
cout << '\n'; | cout << '\n'; |
cout << "Usage: " << arg0 << " [-port <port_num> -t -h -v]\n"; |
cout << "Usage: " << arg0 << endl; |
cout << '\n'; |
|
cout << " -h - prints this help message\n"; |
|
cout << " -port - specifies port number to listen on\n"; |
|
cout << " -v - prints out the version number\n"; |
|
cout << " -t - turns on trace mode\n"; |
|
cout << " -d - turns on debug mode\n"; |
|
cout << endl; | cout << endl; |
} | } |
| |
|
|
if (om.lookupValue("help", helpOption) && helpOption == "true") | if (om.lookupValue("help", helpOption) && helpOption == "true") |
{ | { |
PrintHelp(argv[0]); | PrintHelp(argv[0]); |
|
om.printHelp(); |
exit(0); | exit(0); |
} | } |
| |
|
|
Boolean pegasusIOTrace = false; | Boolean pegasusIOTrace = false; |
if (om.valueEquals("trace", "true")) | if (om.valueEquals("trace", "true")) |
{ | { |
Handler::sethandlerTrace(true); |
Handler::setMessageTrace(true); |
pegasusIOTrace = true; | pegasusIOTrace = true; |
cout << "Trace Set" << endl; |
} |
|
|
|
Boolean pegasusIOLog = false; |
|
if (om.valueEquals("logtrace", "true")) |
|
{ |
|
Handler::setMessageLogTrace(true); |
|
pegasusIOLog = true; |
} | } |
| |
// Grab the port otpion: | // Grab the port otpion: |
|
|
char* address = portOption.allocateCString(); | char* address = portOption.allocateCString(); |
| |
// Put out startup up message. | // Put out startup up message. |
// Put to cout if not daemon |
|
// ATTN: modify when we add daemon |
|
cout << PEGASUS_NAME << PEGASUS_VERSION << | cout << PEGASUS_NAME << PEGASUS_VERSION << |
" on port " << address << endl; | " on port " << address << endl; |
cout << "Built " << __DATE__ << " " << __TIME__ << endl; | cout << "Built " << __DATE__ << " " << __TIME__ << endl; |
cout <<"Started..." | cout <<"Started..." |
<< (pegasusIOTrace ? " Tracing": " ") << endl; |
<< (pegasusIOTrace ? " Tracing to Display ": " ") |
|
<< (pegasusIOLog ? " Tracing to Log ": " ") |
|
<< endl; |
|
|
|
// Option to Display the options table. Primarily |
|
// a diagnostic tool. |
|
if (om.valueEquals("options", "true")) |
|
om.print(); |
| |
// Set up the Logger | // Set up the Logger |
Logger::setHomeDirectory("./logs"); | Logger::setHomeDirectory("./logs"); |