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,7 +156,8 @@ nsCalendarShell::~nsCalendarShell()
Logoff();
nsServiceManager::ReleaseService(kCXPFCObserverManagerCID, mObserverManager);
if (nsnull != mObserverManager)
nsServiceManager::ReleaseService(kCXPFCObserverManagerCID, mObserverManager);
if (mCAPIPassword)
PR_Free(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)))
{

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

@ -83,32 +83,31 @@ void main(int argc, char **argv)
gAppContext = app_context;
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
PR_STDIO_INIT();
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);
nsRepository::RegisterFactory(kCXPFCMenuContainerCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPFCMenuItemCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCMenuManagerCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPFCToolbarCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPFCDialogCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPFCButtonCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPFCTextWidgetCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPFCTabWidgetCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPFCToolbarManagerCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCStreamManagerCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCStreamObjectCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCVectorCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCVectorIteratorCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCstackCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPButtonCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPItemCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCBoxLayoutCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCListLayoutCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCUserCID, XPFC_DLL, PR_FALSE, PR_FALSE);
// 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);
nsRepository::RegisterFactory(kCXPFCMenuContainerCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPFCMenuItemCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCMenuManagerCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPFCToolbarCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPFCDialogCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPFCButtonCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPFCTextWidgetCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPFCTabWidgetCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPFCToolbarManagerCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCStreamManagerCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCStreamObjectCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCVectorCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCVectorIteratorCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCstackCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPButtonCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPItemCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCBoxLayoutCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCListLayoutCID, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCUserCID, XPFC_DLL, PR_FALSE, PR_FALSE);
result = nsRepository::CreateInstance(kCShellInstanceCID,
NULL,
@ -131,34 +130,35 @@ void main(int argc, char **argv)
// Let the the State know who it's Application Instance is
pShellInstance->SetNativeInstance((nsNativeApplicationInstance) topLevel);
pShellInstance->SetApplicationShell(pApplicationShell);
pShellInstance->SetNativeInstance((nsNativeApplicationInstance) topLevel);
pShellInstance->SetApplicationShell(pApplicationShell);
// Tell the application manager to store away the association so the
// Application can look up its State
nsApplicationManager::SetShellAssociation(pApplicationShell, pShellInstance);
// Tell the application manager to store away the association so the
// Application can look up its State
nsApplicationManager::SetShellAssociation(pApplicationShell, pShellInstance);
// Initialize the system
// Initialize the system
pShellInstance->mArgc = argc;
pShellInstance->mArgv = argv;
pShellInstance->Init();
pShellInstance->Init();
pShellInstance->mArgc = argc;
pShellInstance->mArgv = argv;
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);
}
result = app_shell->Run();
NS_IF_RELEASE(app_shell);
}
// We're done, clean up
// We're done, clean up
nsApplicationManager::DeleteShellAssociation(pApplicationShell, pShellInstance);
//PR_Cleanup();

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

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