nsresult DoCommandLines(nsICmdLineService* cmdLineArgs, PRBool heedGeneralStartupPrefs, PRBool *windowOpened)
DoCommandLines(nsICmdLineService* cmdLineArgs, PRBool heedGeneralStartupPrefs, PRBool *windowOpened)
nsresult DoCommandLines(nsICmdLineService* cmdLineArgs, PRBool heedGeneralStartupPrefs, PRBool *windowOpened){  NS_ENSURE_ARG(windowOpened);  *windowOpened = PR_FALSE;  nsresult rv;	PRInt32 height = nsIAppShellService::SIZE_TO_CONTENT;	PRInt32 width  = nsIAppShellService::SIZE_TO_CONTENT;	nsXPIDLCString tempString;	// Get the value of -width option	rv = cmdLineArgs->GetCmdLineValue("-width", getter_Copies(tempString));	if (NS_SUCCEEDED(rv) && !tempString.IsEmpty())    PR_sscanf(tempString.get(), "%d", &width);	// Get the value of -height option	rv = cmdLineArgs->GetCmdLineValue("-height", getter_Copies(tempString));	if (NS_SUCCEEDED(rv) && !tempString.IsEmpty())    PR_sscanf(tempString.get(), "%d", &height);    if (heedGeneralStartupPrefs) {    nsCOMPtr<nsIAppShellService> appShell(do_GetService("@mozilla.org/appshell/appShellService;1", &rv));    if (NS_FAILED(rv)) return rv;    rv = appShell->CreateStartupState(width, height, windowOpened);    if (NS_FAILED(rv)) return rv;  }  else {    PRInt32 argc = 0;    rv = cmdLineArgs->GetArgc(&argc);    if (NS_FAILED(rv)) return rv;    char **argv = nsnull;    rv = cmdLineArgs->GetArgv(&argv);    if (NS_FAILED(rv)) return rv;    PRInt32 i = 0;    for (i=1;i<argc;i++) {#ifdef DEBUG_CMD_LINE      printf("XXX argv[%d] = %s\n",i,argv[i]);#endif /* DEBUG_CMD_LINE */      if (IsStartupCommand(argv[i])) {        // skip over the - (or / on windows)        char *command = argv[i] + 1;#ifdef XP_UNIX        // unix allows -mail and --mail        if ((argv[i][0] == '-') && (argv[i][1] == '-')) {          command = argv[i] + 2;        }#endif /* XP_UNIX */        // this can fail, as someone could do -foo, where -foo is not handled        rv = LaunchApplicationWithArgs((const char *)(argv[i]),                                       cmdLineArgs, command,                                       height, width, windowOpened);        if (rv == NS_ERROR_NOT_AVAILABLE || rv == NS_ERROR_ABORT)          return rv;      }    }  }  return NS_OK;}