Command processing for arguments

This commit is contained in:
spider%netscape.com 1998-10-15 20:07:17 +00:00
Родитель ff7bbf74b0
Коммит 72db3e4c2a
3 изменённых файлов: 38 добавлений и 11 удалений

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

@ -61,6 +61,7 @@ public:
NS_METHOD LoadUI();
NS_METHOD LoadPreferences();
NS_METHOD ParseCommandLine();
NS_METHOD ExecuteCommandScript(nsString aScript);
NS_METHOD EnsureUserPath( JulianString& sPath );

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

@ -43,6 +43,8 @@ public:
NS_IMETHOD LoadUI() = 0;
NS_IMETHOD LoadPreferences() = 0;
NS_IMETHOD ParseCommandLine() = 0;
NS_IMETHOD ExecuteCommandScript(nsString aScript) = 0;
NS_IMETHOD SetCAPISession(CAPISession aCAPISession) = 0;
NS_IMETHOD_(CAPISession) GetCAPISession() = 0;

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

@ -117,6 +117,19 @@ nsresult NS_RegisterApplicationShellFactory()
return res;
}
static PRFileDesc *output = NULL;
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;
}
/*
* nsCalendarShell Definition
*/
@ -248,7 +261,9 @@ nsresult nsCalendarShell::ParseCommandLine()
PLOptStatus os;
PLOptState *opt;
mShellInstance->GetCommandLineOptions(&opt,"Gdl:c:");
output = PR_GetSpecialFD(PR_StandardError);
mShellInstance->GetCommandLineOptions(&opt,"cGdl:s:");
while (PL_OPT_EOL != (os = PL_GetNextOpt(opt)))
{
@ -259,21 +274,25 @@ nsresult nsCalendarShell::ParseCommandLine()
{
case 'G': /* GLOBAL threads */
//thread_scope = PR_GLOBAL_THREAD;
break;
break;
case 'd': /* debug mode */
break;
break;
case 'l': /* loop count */
//loops = atoi(opt->value);
break;
case 'c': /* concurrency limit */
//cpus = atoi(opt->value);
break;
case 'c': /* */
StartCommandServer();
break;
case 's':
{
nsString script = opt->value;
ExecuteCommandScript(script);
}
break;
case 'h': /* confused */
default:
break;
return Usage();
}
}
return NS_OK;
@ -899,6 +918,11 @@ nsresult nsCalendarShell::ReceiveCommand(nsString& aCommand, nsString& aReply)
return NS_OK;
}
nsresult nsCalendarShell::ExecuteCommandScript(nsString aScript)
{
return NS_OK;
}
nsresult nsCalendarShell::StartCommandServer()
{