Support launching zulutest from zulu

This commit is contained in:
spider%netscape.com 1998-10-21 17:54:58 +00:00
Родитель 92b4962700
Коммит c3b4fdbea3
5 изменённых файлов: 54 добавлений и 8 удалений

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

@ -996,6 +996,21 @@ nsresult nsCalendarShell::ReceiveCommand(nsString& aCommand, nsString& aReply)
nsresult nsCalendarShell::ExecuteCommandScript(nsString aScript)
{
/*
* Make sure the CommandServer is running ...
*/
StartCommandServer();
/*
* Now launch the app that can handle scripting interaction with zulu
*/
nsString script = "-s ";
script += aScript;
mShellInstance->LaunchApplication(nsString("zulutest"),script);
return NS_OK;
}

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

@ -308,7 +308,7 @@ nsresult nsXPFCMenuContainer::ProcessActionCommand(nsString& aAction)
} else if (aAction == "LaunchCommandClient") {
mShellInstance->LaunchApplication(nsString("zulutest"));
mShellInstance->LaunchApplication(nsString("zulutest"),nsString(""));
} else if (aAction == "ComposeEvent") {

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

@ -142,7 +142,7 @@ public:
NS_IMETHOD_(EVENT_CALLBACK) GetShellEventCallback() ;
NS_IMETHOD LaunchApplication(nsString& aApplication) ;
NS_IMETHOD LaunchApplication(nsString& aApplication,nsString& aArgument) ;
NS_IMETHOD GetCommandLineOptions(PLOptState** aOptState, const char * aOptions) ;

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

@ -147,7 +147,7 @@ public:
* Launch an application
* @result nsresult NS_OK upon succcessful completion
*/
NS_IMETHOD LaunchApplication(nsString& aApplication) = 0 ;
NS_IMETHOD LaunchApplication(nsString& aApplication, nsString& aArgument) = 0 ;
};

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

@ -440,19 +440,46 @@ EVENT_CALLBACK nsShellInstance::GetShellEventCallback()
return ((EVENT_CALLBACK)HandleEventApplication);
}
nsresult nsShellInstance::LaunchApplication(nsString& aApplication)
nsresult nsShellInstance::LaunchApplication(nsString& aApplication, nsString& aArgument)
{
char * app = aApplication.ToNewCString();
char *argv[2];
char * argument = nsnull;
char *argv[100];
PRStatus status ;
char path[1024];
nsString temp;
/*
* Build up app
*/
(void)getcwd(path, sizeof(path));
(void)PL_strcat(path, "\\");
(void)PL_strcat(path, app);
argv[0] = path;
argv[1] = nsnull;
/*
* Build up argument list
*/
PRUint32 index = 1;
aArgument.Trim(" \r\n\t");
PRInt32 offset = aArgument.Find(' ');
while(offset != -1)
{
aArgument.Left(temp,offset);
aArgument.Cut(0,offset);
aArgument.Trim(" \r\n\t",PR_TRUE,PR_FALSE);
argv[index++] = temp.ToNewCString();
offset = aArgument.Find(' ');
}
argv[index++] = aArgument.ToNewCString();
argv[index] = nsnull;
status = PR_CreateProcessDetached(argv[0], argv, nsnull, nsnull);
@ -461,6 +488,10 @@ nsresult nsShellInstance::LaunchApplication(nsString& aApplication)
delete app;
index = 1;
while(argv[index] != nsnull)
delete argv[index++];
return NS_OK;
}