int main (int argc, char* argv []) { OSInfoCommand command = OSInfoCommand (); int rc; MessageLoader::setPegasusMsgHomeRelative(argv[0]); try { command.setCommand (argc, argv); } catch (const CommandFormatException& cfe) { cerr << OSInfoCommand::COMMAND_NAME << ": " << cfe.getMessage() << endl; MessageLoaderParms parms(ERR_USAGE_KEY,ERR_USAGE); parms.msg_src_path = MSG_PATH; cerr << OSInfoCommand::COMMAND_NAME << ": " << MessageLoader::getMessage(parms) << endl; exit (Command::RC_ERROR); } catch (const InvalidLocatorException &ile) { cerr << OSInfoCommand::COMMAND_NAME << ": " << ile.getMessage() << endl; exit (Command::RC_ERROR); } rc = command.execute (cout, cerr); exit (rc); return 0; }
int main (int argc, char* argv []) { OSInfoCommand command = OSInfoCommand (); int rc; MessageLoader::setPegasusMsgHomeRelative(argv[0]); try { command.setCommand (argc, argv); } catch (const CommandFormatException& cfe) { String msg(cfe.getMessage()); cerr << OSInfoCommand::COMMAND_NAME << ": " << msg << endl; if (msg.find(String("Unknown flag")) != PEG_NOT_FOUND) { MessageLoaderParms parms(ERR_OPTION_NOT_SUPPORTED_KEY,ERR_OPTION_NOT_SUPPORTED); parms.msg_src_path = MSG_PATH; cerr << OSInfoCommand::COMMAND_NAME << ": " << MessageLoader::getMessage(parms) << endl; } else { MessageLoaderParms parms(ERR_USAGE_KEY,ERR_USAGE); parms.msg_src_path = MSG_PATH; cerr << OSInfoCommand::COMMAND_NAME << ": " << MessageLoader::getMessage(parms) << endl; } exit (Command::RC_ERROR); } rc = command.execute (cout, cerr); exit (rc); return 0; }