version 1.1, 2001/04/15 17:58:58
|
version 1.7, 2001/05/10 10:57:20
|
|
|
//BEGIN_LICENSE |
//%///////////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM | // Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM |
// | // |
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. |
// | // |
//END_LICENSE |
//============================================================================== |
//BEGIN_HISTORY |
|
// | // |
// Author: Mike Brasher |
// Author: Mike Brasher (mbrasher@bmc.com) |
// | // |
//END_HISTORY |
// Modified By: |
|
// |
|
//%///////////////////////////////////////////////////////////////////////////// |
| |
#include <iostream> | #include <iostream> |
|
#include <cstdlib> |
#include <Pegasus/Common/FileSystem.h> | #include <Pegasus/Common/FileSystem.h> |
#include <Pegasus/Common/Selector.h> | #include <Pegasus/Common/Selector.h> |
#include <Pegasus/Common/OptionManager.h> | #include <Pegasus/Common/OptionManager.h> |
#include <Pegasus/Server/CIMServer.h> | #include <Pegasus/Server/CIMServer.h> |
|
#include <Pegasus/Common/PegasusVersion.h> |
| |
using namespace Pegasus; | using namespace Pegasus; |
using namespace std; | using namespace std; |
| |
const char PEGASUS_VERSION[] = "Pegasus CIM Server - Version 0.7"; |
// const char PEGASUS_VERSION[] = "Pegasus CIM Server - Version 0.7"; |
| |
void GetEnvironmentVariables( | void GetEnvironmentVariables( |
const char* arg0, | const char* arg0, |
|
|
| |
String configFile = pegasusHome + "/cimserver.conf"; | String configFile = pegasusHome + "/cimserver.conf"; |
| |
if (!FileSystem::exists(configFile)) |
if (FileSystem::exists(configFile)) |
{ |
|
cerr << argv[0] << ": cannot open " << configFile << endl; |
|
exit(1); |
|
} |
|
|
|
om.mergeFile(configFile); | om.mergeFile(configFile); |
| |
om.mergeCommandLine(argc, argv); | om.mergeCommandLine(argc, argv); |
|
|
om.checkRequiredOptions(); | om.checkRequiredOptions(); |
} | } |
| |
|
void PrintHelp(const char* arg0) |
|
{ |
|
cout << '\n'; |
|
cout << PEGASUS_NAME << PEGASUS_VERSION << endl; |
|
cout << '\n'; |
|
cout << "Usage: " << arg0 << " [-port <port_num> -t -h -v]\n"; |
|
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 << endl; |
|
} |
|
|
int main(int argc, char** argv) | int main(int argc, char** argv) |
{ | { |
// Get environment variables: | // Get environment variables: |
|
|
{ | { |
cerr << argv[0] << ": unrecognized options: "; | cerr << argv[0] << ": unrecognized options: "; |
| |
for (Uint32 i = 1; i < argc; i++) |
for (int i = 1; i < argc; i++) |
cerr << argv[i] << ' '; | cerr << argv[i] << ' '; |
cout << endl; | cout << endl; |
exit(1); | exit(1); |
|
|
| |
if (om.lookupValue("help", helpOption) && helpOption == "true") | if (om.lookupValue("help", helpOption) && helpOption == "true") |
{ | { |
cerr << "No help yet!" << endl; |
PrintHelp(argv[0]); |
exit(0); | exit(0); |
} | } |
| |
|
|
CIMServer server(&selector, pegasusHome); | CIMServer server(&selector, pegasusHome); |
| |
char* address = portOption.allocateCString(); | char* address = portOption.allocateCString(); |
|
|
|
// Put out startup up message. |
|
// Put to cout if not daemon |
|
// ATTN: modify when we add daemon |
|
cout << PEGASUS_NAME << PEGASUS_VERSION << |
|
" on port " << address << endl; |
|
cout << "Built " << __DATE__ << " " << __TIME__ << endl; |
|
cout <<"Started..." <<endl; |
|
|
server.bind(address); | server.bind(address); |
delete [] address; | delete [] address; |
server.runForever(); | server.runForever(); |