return remoterv;
int main(int argc, char* argv[]){  NS_TIMELINE_MARK("enter main");#if defined(DEBUG) && defined(XP_WIN32)  // Disable small heap allocator to get heapwalk() giving us  // accurate heap numbers. Win2k non-debug does not use small heap allocator.  // Win2k debug seems to be still using it.  // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt__set_sbh_threshold.asp  _set_sbh_threshold(0);#endif#if defined(XP_UNIX) || defined(XP_BEOS)  InstallUnixSignalHandlers(argv[0]);#endif#if defined(XP_OS2)  __argc = argc;  __argv = argv;  ULONG    ulMaxFH = 0;  LONG     ulReqCount = 0;  APIRET   rc = NO_ERROR;  DosSetRelMaxFH(&ulReqCount,                 &ulMaxFH);  if (ulMaxFH < 256) {    DosSetMaxFH(256);  }#endif /* XP_OS2 */#if defined(XP_BEOS)  if (NS_OK != InitializeBeOSApp())    return 1;#endif#if defined(XP_MACOSX)  InitializeMacOSXApp(argc, argv);#endif#ifdef _BUILD_STATIC_BIN  // Initialize XPCOM's module info table  NSGetStaticModuleInfo = app_getModuleInfo;#endif  // Handle -help and -version command line arguments.  // They should% return quick, so we deal with them here.  if (HandleDumpArguments(argc, argv))    return 0;#ifdef NS_TRACE_MALLOC  argc = NS_TraceMallocStartupArgs(argc, argv);#endif  // Call the code to install our handler#ifdef MOZ_JPROF  setupProfilingStuff();#endif      NS_TIMELINE_MARK("GRE_Startup...");#ifdef XPCOM_GLUE  nsresult rv = GRE_Startup();#else  nsresult rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);#endif  NS_TIMELINE_MARK("...GRE_Startup done");  if (NS_FAILED(rv)) {       // We should be displaying a dialog here with the reason why we failed.    NS_WARNING("GRE_Startup failed");    return 1;  }  // Try to allocate "native app support."  // Note: this object is not released here.  It is passed to main1 which  //       has responsibility to release it.  nsINativeAppSupport *nativeApp = 0;  rv = NS_CreateNativeAppSupport(&nativeApp);  // See if we can run.  if (nativeApp)  {    PRBool canRun = PR_FALSE;    rv = nativeApp->Start(&canRun);    if (!canRun) {        return 1;    }  } else {    // If platform doesn't implement nsINativeAppSupport, fall    // back to old method.    if (!NS_CanRun())      return 1;  }  // Note: this object is not released here.  It is passed to main1 which  //       has responsibility to release it.  nsISplashScreen *splash = 0;  PRBool dosplash = GetWantSplashScreen(argc, argv);  if (dosplash && !nativeApp) {    // If showing splash screen and platform doesn't implement    // nsINativeAppSupport, then use older nsISplashScreen interface.    rv = NS_CreateSplashScreen(&splash);    NS_ASSERTION(NS_SUCCEEDED(rv), "NS_CreateSplashScreen failed");  }  // If the platform has a splash screen, show it ASAP.  if (dosplash && nativeApp) {    nativeApp->ShowSplashScreen();  } else if (splash) {    splash->Show();  }#ifdef MOZ_ENABLE_XREMOTE  // handle -remote now that xpcom is fired up  int remoterv;  PRBool argused = PR_FALSE;  // argused will be true if someone tried to use a -remote flag.  We  // always exit in that case.  remoterv = HandleRemoteArguments(argc, argv, &argused);  if (argused) {#ifdef XPCOM_GLUE    GRE_Shutdown();#else    NS_ShutdownXPCOM(nsnull);#endif  }#endif  nsresult mainResult = main1(argc, argv, nativeApp ? (nsISupports*)nativeApp : (nsISupports*)splash);  /* if main1() didn't succeed, then don't bother trying to shut down clipboard, etc */  if (NS_SUCCEEDED(mainResult)) {    rv = DoOnShutdown();    NS_ASSERTION(NS_SUCCEEDED(rv), "DoOnShutdown failed");  }#ifdef XPCOM_GLUE  rv = GRE_Shutdown();#else  rv = NS_ShutdownXPCOM(nsnull);#endif  NS_ASSERTION(NS_SUCCEEDED(rv), "GRE_Shutdown failed");  return TranslateReturnValue(mainResult);}