More command line support for zulu. Also, exit if NS_OK not returned

from Application Init() method
This commit is contained in:
spider%netscape.com 1998-10-15 20:47:37 +00:00
Родитель 04f7f601ff
Коммит cce81d8dec
3 изменённых файлов: 66 добавлений и 58 удалений

Просмотреть файл

@ -123,11 +123,11 @@ static nsresult Usage(void)
{
PR_fprintf(output, "zulu usage:\n");
PR_fprintf(output, ">zulu [-d] [-c] [-v] [-s <filename>]\n");
PR_fprintf(output, "\td\tdebug mode \t(false)\n");
PR_fprintf(output, "\tc\tLaunch Command Server\t(none)\n");
PR_fprintf(output, "\tv\tverbose output\t(none)\n");
PR_fprintf(output, "\ts <filename>\tLaunch Command Script \t(implies -c)\n");
return NS_OK;
PR_fprintf(output, " -d\t\tdebug mode\n");
PR_fprintf(output, " -c\t\tlaunch command server\n");
PR_fprintf(output, " -v\t\tverbose output\n");
PR_fprintf(output, " -s <filename>\tlaunch command script \t(implies -c)\n");
return 1;
}
/*
@ -156,6 +156,7 @@ nsCalendarShell::~nsCalendarShell()
Logoff();
if (nsnull != mObserverManager)
nsServiceManager::ReleaseService(kCXPFCObserverManagerCID, mObserverManager);
if (mCAPIPassword)
@ -209,7 +210,10 @@ nsresult nsCalendarShell::Init()
*/
ParseCommandLine();
res = ParseCommandLine();
if (NS_OK != res)
return res;
/*
* Register class factrories needed for application
@ -263,7 +267,7 @@ nsresult nsCalendarShell::ParseCommandLine()
output = PR_GetSpecialFD(PR_StandardError);
mShellInstance->GetCommandLineOptions(&opt,"cGdl:s:");
mShellInstance->GetCommandLineOptions(&opt,"cGhdl:s:");
while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
{

Просмотреть файл

@ -86,7 +86,6 @@ void main(int argc, char **argv)
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
PR_STDIO_INIT();
// Let get a ShellInstance for this Application instance
nsRepository::RegisterFactory(kCShellInstanceCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPFCMenuBarCID, XPFC_DLL, PR_FALSE, PR_FALSE);
@ -139,22 +138,23 @@ void main(int argc, char **argv)
nsApplicationManager::SetShellAssociation(pApplicationShell, pShellInstance);
// Initialize the system
pShellInstance->Init();
pShellInstance->mArgc = argc;
pShellInstance->mArgv = argv;
pShellInstance->Init();
pApplicationShell->Init();
result = pApplicationShell->Init();
if (NS_OK == result)
{
// Now, let actually start dispatching events.
nsIAppShell * app_shell = nsnull;
result = pApplicationShell->QueryInterface(kIAppShellIID,(void**)&app_shell);
if (result == NS_OK)
{
result = app_shell->Run();
NS_RELEASE(app_shell);
NS_IF_RELEASE(app_shell);
}

Просмотреть файл

@ -132,7 +132,10 @@ int CALLBACK WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParam,
pShellInstance->mArgv = __argv;
pShellInstance->Init();
pApplicationShell->Init();
result = pApplicationShell->Init();
if (NS_OK == result)
{
// Now, let actually start dispatching events.
nsIAppShell * app_shell = nsnull;
@ -140,9 +143,10 @@ int CALLBACK WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParam,
result = pApplicationShell->QueryInterface(kIAppShellIID,(void**)&app_shell);
if (result == NS_OK)
{
result = app_shell->Run();
NS_RELEASE(app_shell);
NS_IF_RELEASE(app_shell);
}
// We're done, clean up