add beginnings of support for -h, -help, --help, -v, -version, --version. note how the code for this happens way early in main(), before any COM or profile stuff. when running with -v and -h it should be quick.

This commit is contained in:
sspitzer%netscape.com 1999-09-16 11:30:18 +00:00
parent c5e68fac46
commit 0804b138df
2 changed files with 25 additions and 2 deletions

View File

@ -52,7 +52,7 @@ debugging=0
while [ $# -gt 0 ]
do
case $1 in
-h | --help)
-h | --help )
script_args="$script_args -h"
shift
;;
@ -70,7 +70,7 @@ do
# keep this in synch with
# mozilla/xpfe/bootstrap/nsAppRunner.cpp
# and mozilla/profile/src/nsProfile.cpp
-P | -CreateProfile | -ProfileManager | -ProfileWizard | -installer | -edit | -mail | -news | -pref | -compose | -editor | -addressbook | -chrome )
-v | --version | -h | --help | -P | -CreateProfile | -ProfileManager | -ProfileWizard | -installer | -edit | -mail | -news | -pref | -compose | -editor | -addressbook | -chrome )
if [ "x$moreargs" != "x" ]
then
echo "You can't have $1 and $moreargs"

View File

@ -593,10 +593,33 @@ static nsresult main1(int argc, char* argv[])
return rv ;
}
static
void DumpHelp(char *appname)
{
printf("%s: help info here\n", appname);
}
static
void DumpVersion(char *appname)
{
printf("%s: version info\n", appname);
}
int main(int argc, char* argv[])
{
nsresult rv;
/* -help and -version should return quick */
if (argc == 2) {
if ((PL_strcmp(argv[1], "-h") == 0) || (PL_strcmp(argv[1], "-help") == 0) || (PL_strcmp(argv[1], "--help") == 0)) {
DumpHelp(argv[0]);
return 0;
}
else if ((PL_strcmp(argv[1], "-v") == 0) || (PL_strcmp(argv[1], "-version") == 0) || (PL_strcmp(argv[1], "--version") == 0)) {
DumpVersion(argv[0]);
return 0;
}
}
if( !NS_CanRun() )
return 1;