Back out bug 328357 to see whether that fixes tinderbox orange.

This commit is contained in:
bzbarsky%mit.edu 2006-07-28 17:39:59 +00:00
Родитель 686ea4b1a9
Коммит 7fb1d4ec68
2 изменённых файлов: 130 добавлений и 97 удалений

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

@ -170,6 +170,10 @@
extern "C" void ShowOSAlert(const char* aMessage);
#define HELP_SPACER_1 "\t"
#define HELP_SPACER_2 "\t\t"
#define HELP_SPACER_4 "\t\t\t\t"
#ifdef DEBUG
#include "prlog.h"
#endif
@ -755,8 +759,9 @@ static void DumpArbitraryHelp()
static void
DumpHelp()
{
printf("Usage: %s [ options ... ] [URL]\n"
" where options include:\n\n", gArgv[0]);
printf("Usage: %s [ options ... ] [URL]\n", gArgv[0]);
printf(" where options include:\n");
printf("\n");
#ifdef MOZ_WIDGET_GTK
/* insert gtk options above moz options, like any other gtk app
@ -765,49 +770,52 @@ DumpHelp()
* these straight from a user's gtk version -- but it seems to be
* what most gtk apps do. -dr
*/
printf("GTK options\n"
"\t--gdk-debug=FLAGS\t\tGdk debugging flags to set\n"
"\t--gdk-no-debug=FLAGS\t\tGdk debugging flags to unset\n"
"\t--gtk-debug=FLAGS\t\tGtk+ debugging flags to set\n"
"\t--gtk-no-debug=FLAGS\t\tGtk+ debugging flags to unset\n"
"\t--gtk-module=MODULE\t\tLoad an additional Gtk module\n"
"\t-install\t\tInstall a private colormap\n");
printf("GTK options\n");
printf("%s--gdk-debug=FLAGS%sGdk debugging flags to set\n", HELP_SPACER_1, HELP_SPACER_2);
printf("%s--gdk-no-debug=FLAGS%sGdk debugging flags to unset\n", HELP_SPACER_1, HELP_SPACER_2);
printf("%s--gtk-debug=FLAGS%sGtk+ debugging flags to set\n", HELP_SPACER_1, HELP_SPACER_2);
printf("%s--gtk-no-debug=FLAGS%sGtk+ debugging flags to unset\n", HELP_SPACER_1, HELP_SPACER_2);
printf("%s--gtk-module=MODULE%sLoad an additional Gtk module\n", HELP_SPACER_1, HELP_SPACER_2);
printf("%s-install%sInstall a private colormap\n", HELP_SPACER_1, HELP_SPACER_2);
/* end gtk toolkit options */
#endif /* MOZ_WIDGET_GTK */
#if MOZ_WIDGET_XLIB
printf("Xlib options\n"
"\t-display=DISPLAY\t\tX display to use\n"
"\t-visual=VISUALID\t\tX visual to use\n"
"\t-install_colormap\t\tInstall own colormap\n"
"\t-sync\t\tMake X calls synchronous\n"
"\t-no-xshm\t\tDon't use X shared memory extension\n");
printf("Xlib options\n");
printf("%s-display=DISPLAY%sX display to use\n", HELP_SPACER_1, HELP_SPACER_2);
printf("%s-visual=VISUALID%sX visual to use\n", HELP_SPACER_1, HELP_SPACER_2);
printf("%s-install_colormap%sInstall own colormap\n", HELP_SPACER_1, HELP_SPACER_2);
printf("%s-sync%sMake X calls synchronous\n", HELP_SPACER_1, HELP_SPACER_2);
printf("%s-no-xshm%sDon't use X shared memory extension\n", HELP_SPACER_1, HELP_SPACER_2);
/* end xlib toolkit options */
#endif /* MOZ_WIDGET_XLIB */
#ifdef MOZ_X11
printf("X11 options\n"
"\t--display=DISPLAY\t\tX display to use\n"
"\t--sync\t\tMake X calls synchronous\n"
"\t--no-xshm\t\tDon't use X shared memory extension\n"
"\t--xim-preedit=STYLE\n"
"\t--xim-status=STYLE\n");
printf("X11 options\n");
printf("%s--display=DISPLAY%sX display to use\n", HELP_SPACER_1, HELP_SPACER_2);
printf("%s--sync%sMake X calls synchronous\n", HELP_SPACER_1, HELP_SPACER_2);
printf("%s--no-xshm%sDon't use X shared memory extension\n", HELP_SPACER_1, HELP_SPACER_2);
printf("%s--xim-preedit=STYLE\n", HELP_SPACER_1);
printf("%s--xim-status=STYLE\n", HELP_SPACER_1);
#endif
#ifdef XP_UNIX
printf("\t--g-fatal-warnings\t\tMake all warnings fatal\n"
"\nMozilla options\n");
printf("%s--g-fatal-warnings%sMake all warnings fatal\n", HELP_SPACER_1, HELP_SPACER_2);
printf("\nMozilla options\n");
#endif
printf("\t-height <value>\t\tSet height of startup window to <value>.\n"
"\t-h or -help\t\tPrint this message.\n"
"\t-width <value>\t\tSet width of startup window to <value>.\n"
"\t-v or -version\t\tPrint %s version.\n"
"\t-P <profile>\t\tStart with <profile>.\n"
"\t-ProfileManager\t\tStart with ProfileManager.\n"
"\t-UILocale <locale>\t\tStart with <locale> resources as UI Locale.\n"
"\t-contentLocale <locale>\t\tStart with <locale> resources as content Locale.\n"
"\t-safe-mode\t\tDisables extensions and themes for this session.\n", gAppData->name);
printf("%s-height <value>%sSet height of startup window to <value>.\n",HELP_SPACER_1,HELP_SPACER_2);
printf("%s-h or -help%sPrint this message.\n",HELP_SPACER_1,HELP_SPACER_2);
printf("%s-width <value>%sSet width of startup window to <value>.\n",HELP_SPACER_1,HELP_SPACER_2);
printf("%s-v or -version%sPrint %s version.\n",HELP_SPACER_1,HELP_SPACER_2, gAppData->name);
printf("%s-P <profile>%sStart with <profile>.\n",HELP_SPACER_1,HELP_SPACER_2);
printf("%s-ProfileManager%sStart with Profile Manager.\n",HELP_SPACER_1,HELP_SPACER_2);
printf("%s-UILocale <locale>%sStart with <locale> resources as UI Locale.\n",HELP_SPACER_1,HELP_SPACER_2);
printf("%s-contentLocale <locale>%sStart with <locale> resources as content Locale.\n",HELP_SPACER_1,HELP_SPACER_2);
printf("%s-safe-mode%sDisables extensions and themes for this session.\n",HELP_SPACER_1,HELP_SPACER_2);
#if defined(XP_WIN) || defined(XP_OS2)
printf("\t-console\t\tStart %s with a debugging console.\n", gAppData->name);
printf("%s-console%sStart %s with a debugging console.\n",HELP_SPACER_1,HELP_SPACER_2,gAppData->name);
#endif
// this works, but only after the components have registered. so if you drop in a new command line handler, -help
@ -891,11 +899,10 @@ VerifyInstallation(nsIFile* aAppDir)
#include <ieeefp.h>
#endif
static inline void
static void
DumpVersion()
{
printf("%s %s %s, %s\n",
gAppData->vendor ? gAppData->vendor : "", gAppData->name, gAppData->version, gAppData->copyright);
printf("%s %s %s, %s\n", gAppData->vendor ? gAppData->vendor : "", gAppData->name, gAppData->version, gAppData->copyright);
}
#ifdef MOZ_ENABLE_XREMOTE

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

@ -147,6 +147,10 @@ static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
extern "C" void ShowOSAlert(const char* aMessage);
#define HELP_SPACER_1 "\t"
#define HELP_SPACER_2 "\t\t"
#define HELP_SPACER_4 "\t\t\t\t"
#ifdef DEBUG
#include "prlog.h"
#endif
@ -355,15 +359,27 @@ static nsresult GetNativeAppSupport(nsINativeAppSupport** aNativeApp)
return *aNativeApp ? NS_OK : NS_ERROR_FAILURE;
}
/*
* This routine translates the nsresult into a platform specific return
* code for the application...
*/
static int TranslateReturnValue(nsresult aResult)
{
if (NS_SUCCEEDED(aResult)) {
return 0;
}
return 1;
}
#ifdef XP_MAC
#include "nsCommandLineServiceMac.h"
#endif
static inline void
static void
PrintUsage(void)
{
fprintf(stderr, "Usage: apprunner <url>\n"
"\t<url>: a fully defined url string like http:// etc..\n");
fprintf(stderr, "Usage: apprunner <url>\n");
fprintf(stderr, "\t<url>: a fully defined url string like http:// etc..\n");
}
static nsresult OpenWindow(const nsCString& aChromeURL,
@ -486,7 +502,7 @@ static void DumpArbitraryHelp()
if (NS_FAILED(rv)) continue;
if (!commandLineArg.IsEmpty()) {
printf("\t%s", commandLineArg.get());
printf("%s%s", HELP_SPACER_1, commandLineArg.get());
PRBool handlesArgs = PR_FALSE;
rv = handler->GetHandlesArgs(&handlesArgs);
@ -494,7 +510,7 @@ static void DumpArbitraryHelp()
printf(" <url>");
}
if (!helpText.IsEmpty()) {
printf("\t\t%s\n", helpText.get());
printf("%s%s\n", HELP_SPACER_2, helpText.get());
}
}
}
@ -602,8 +618,9 @@ LaunchApplicationWithArgs(const char *commandLineArg,
static PRBool IsStartupCommand(const char *arg)
{
if (!arg || (arg[0] == '\0') || (arg[1] == '\0'))
return PR_FALSE;
if (!arg) return PR_FALSE;
if (PL_strlen(arg) <= 1) return PR_FALSE;
// windows allows /mail or -mail
if ((arg[0] == '-')
@ -1237,8 +1254,9 @@ static nsresult main1(int argc, char* argv[], nsISupports *nativeApp )
// here, or in a native resource file.
static void DumpHelp(char *appname)
{
printf("Usage: %s [ options ... ] [URL]\n"
" where options include:\n\n", appname);
printf("Usage: %s [ options ... ] [URL]\n", appname);
printf(" where options include:\n");
printf("\n");
#ifdef MOZ_WIDGET_GTK
/* insert gtk options above moz options, like any other gtk app
@ -1247,63 +1265,66 @@ static void DumpHelp(char *appname)
* these straight from a user's gtk version -- but it seems to be
* what most gtk apps do. -dr
*/
printf("GTK options\n"
"\t--gdk-debug=FLAGS\t\tGdk debugging flags to set\n"
"\t--gdk-no-debug=FLAGS\t\tGdk debugging flags to unset\n"
"\t--gtk-debug=FLAGS\t\tGtk+ debugging flags to set\n"
"\t--gtk-no-debug=FLAGS\t\tGtk+ debugging flags to unset\n"
"\t--gtk-module=MODULE\t\tLoad an additional Gtk module\n"
"\t-install\t\tInstall a private colormap\n");
printf("GTK options\n");
printf("%s--gdk-debug=FLAGS%sGdk debugging flags to set\n", HELP_SPACER_1, HELP_SPACER_2);
printf("%s--gdk-no-debug=FLAGS%sGdk debugging flags to unset\n", HELP_SPACER_1, HELP_SPACER_2);
printf("%s--gtk-debug=FLAGS%sGtk+ debugging flags to set\n", HELP_SPACER_1, HELP_SPACER_2);
printf("%s--gtk-no-debug=FLAGS%sGtk+ debugging flags to unset\n", HELP_SPACER_1, HELP_SPACER_2);
printf("%s--gtk-module=MODULE%sLoad an additional Gtk module\n", HELP_SPACER_1, HELP_SPACER_2);
printf("%s-install%sInstall a private colormap\n", HELP_SPACER_1, HELP_SPACER_2);
/* end gtk toolkit options */
#endif /* MOZ_WIDGET_GTK */
#if MOZ_WIDGET_XLIB
printf("Xlib options\n"
"\t-display=DISPLAY\t\tX display to use\n"
"\t-visual=VISUALID\t\tX visual to use\n"
"\t-install_colormap\t\tInstall own colormap\n"
"\t-sync\t\tMake X calls synchronous\n"
"\t-no-xshm\t\tDon't use X shared memory extension\n");
printf("Xlib options\n");
printf("%s-display=DISPLAY%sX display to use\n", HELP_SPACER_1, HELP_SPACER_2);
printf("%s-visual=VISUALID%sX visual to use\n", HELP_SPACER_1, HELP_SPACER_2);
printf("%s-install_colormap%sInstall own colormap\n", HELP_SPACER_1, HELP_SPACER_2);
printf("%s-sync%sMake X calls synchronous\n", HELP_SPACER_1, HELP_SPACER_2);
printf("%s-no-xshm%sDon't use X shared memory extension\n", HELP_SPACER_1, HELP_SPACER_2);
/* end xlib toolkit options */
#endif /* MOZ_WIDGET_XLIB */
#ifdef MOZ_X11
printf("X11 options\n"
"\t--display=DISPLAY\t\tX display to use\n"
"\t--sync\t\tMake X calls synchronous\n"
"\t--no-xshm\t\tDon't use X shared memory extension\n"
"\t--xim-preedit=STYLE\n"
"\t--xim-status=STYLE\n");
printf("X11 options\n");
printf("%s--display=DISPLAY%sX display to use\n", HELP_SPACER_1, HELP_SPACER_2);
printf("%s--sync%sMake X calls synchronous\n", HELP_SPACER_1, HELP_SPACER_2);
printf("%s--no-xshm%sDon't use X shared memory extension\n", HELP_SPACER_1, HELP_SPACER_2);
printf("%s--xim-preedit=STYLE\n", HELP_SPACER_1);
printf("%s--xim-status=STYLE\n", HELP_SPACER_1);
#endif
#ifdef XP_UNIX
printf("\t--g-fatal-warnings\t\tMake all warnings fatal\n"
"\n%s options\n", NS_STRINGIFY(MOZ_APP_DISPLAYNAME));
printf("%s--g-fatal-warnings%sMake all warnings fatal\n", HELP_SPACER_1, HELP_SPACER_2);
printf("\n%s options\n", NS_STRINGIFY(MOZ_APP_DISPLAYNAME));
#endif
printf("\t-height <value>\t\tSet height of startup window to <value>.\n"
"\t-h or -help\t\tPrint this message.\n"
"\t-installer\t\tStart with 4.x migration window.\n"
"\t-width <value>\t\tSet width of startup window to <value>.\n"
"\t-v or -version\t\tPrint %s version.\n"
"\t-CreateProfile <profile>\t\tCreate <profile>.\n"
"\t-P <profile>\t\tStart with <profile>.\n"
"\t-ProfileWizard\t\tStart with profile wizard.\n"
"\t-ProfileManager\t\tStart with profile manager.\n"
"\t-SelectProfile\t\tStart with profile selection dialog.\n"
"\t-UILocale <locale>\t\tStart with <locale> resources as UI Locale.\n"
"\t-contentLocale <locale>\t\tStart with <locale> resources as content Locale.\n", appname);
printf("%s-height <value>%sSet height of startup window to <value>.\n",HELP_SPACER_1,HELP_SPACER_2);
printf("%s-h or -help%sPrint this message.\n",HELP_SPACER_1,HELP_SPACER_2);
printf("%s-installer%sStart with 4.x migration window.\n",HELP_SPACER_1,HELP_SPACER_2);
printf("%s-width <value>%sSet width of startup window to <value>.\n",HELP_SPACER_1,HELP_SPACER_2);
printf("%s-v or -version%sPrint %s version.\n",HELP_SPACER_1,HELP_SPACER_2, appname);
printf("%s-CreateProfile <profile>%sCreate <profile>.\n",HELP_SPACER_1,HELP_SPACER_2);
printf("%s-P <profile>%sStart with <profile>.\n",HELP_SPACER_1,HELP_SPACER_2);
printf("%s-ProfileWizard%sStart with profile wizard.\n",HELP_SPACER_1,HELP_SPACER_2);
printf("%s-ProfileManager%sStart with profile manager.\n",HELP_SPACER_1,HELP_SPACER_2);
printf("%s-SelectProfile%sStart with profile selection dialog.\n",HELP_SPACER_1,HELP_SPACER_2);
printf("%s-UILocale <locale>%sStart with <locale> resources as UI Locale.\n",HELP_SPACER_1,HELP_SPACER_2);
printf("%s-contentLocale <locale>%sStart with <locale> resources as content Locale.\n",HELP_SPACER_1,HELP_SPACER_2);
#if defined(XP_WIN32) || defined(XP_OS2)
printf("\t-console\t\tStart %s with a debugging console.\n",NS_STRINGIFY(MOZ_APP_DISPLAYNAME));
printf("%s-console%sStart %s with a debugging console.\n",HELP_SPACER_1,HELP_SPACER_2,NS_STRINGIFY(MOZ_APP_DISPLAYNAME));
#endif
#ifdef MOZ_ENABLE_XREMOTE
printf("\t-remote <command>\t\tExecute <command> in an already running\n"
"\t\t\t\t%s process. For more info, see:\n"
"\n\t\thttp://www.mozilla.org/unix/remote.html\n\n"
"\t-splash\t\tEnable splash screen.\n",
NS_STRINGIFY(MOZ_APP_DISPLAYNAME));
printf("%s-remote <command>%sExecute <command> in an already running\n"
"%s%s process. For more info, see:\n"
"\n%shttp://www.mozilla.org/unix/remote.html\n\n",
HELP_SPACER_1,HELP_SPACER_1,HELP_SPACER_4,NS_STRINGIFY(MOZ_APP_DISPLAYNAME),HELP_SPACER_2);
printf("%s-splash%sEnable splash screen.\n",HELP_SPACER_1,HELP_SPACER_2);
#else
printf("\t-nosplash\t\tDisable splash screen.\n");
printf("%s-nosplash%sDisable splash screen.\n",HELP_SPACER_1,HELP_SPACER_2);
#if defined(XP_WIN) || defined(XP_OS2)
printf("\t-quiet\t\tDisable splash screen.\n");
printf("%s-quiet%sDisable splash screen.\n",HELP_SPACER_1,HELP_SPACER_2);
#endif
#endif
@ -1314,15 +1335,20 @@ static void DumpHelp(char *appname)
}
static inline void DumpVersion()
static nsresult DumpVersion(char *appname)
{
printf("%s %s, Copyright (c) 2003-2006 mozilla.org",
NS_STRINGIFY(MOZ_APP_DISPLAYNAME), NS_STRINGIFY(MOZ_APP_VERSION));
#ifdef NS_BUILD_ID
printf(", build %u\n", (unsigned int)NS_BUILD_ID);
#else
printf(" <developer build>\n");
#endif
nsresult rv = NS_OK;
long buildID = NS_BUILD_ID; // 10-digit number
printf("%s %s, Copyright (c) 2003-2006 mozilla.org", NS_STRINGIFY(MOZ_APP_DISPLAYNAME), NS_STRINGIFY(MOZ_APP_VERSION));
if(buildID) {
printf(", build %u\n", (unsigned int)buildID);
} else {
printf(" <developer build>\n");
}
return rv;
}
#ifdef MOZ_ENABLE_XREMOTE
@ -1458,7 +1484,7 @@ static PRBool HandleDumpArguments(int argc, char* argv[])
|| (PL_strcasecmp(argv[i], "/version") == 0)
#endif /* XP_WIN || XP_OS2 */
) {
DumpVersion();
DumpVersion(argv[0]);
return PR_TRUE;
}
}
@ -1727,7 +1753,7 @@ int main(int argc, char* argv[])
NS_ASSERTION(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");
#endif
return NS_FAILED(rv) ? 1 : 0;
return TranslateReturnValue(mainResult);
}
#if defined( XP_WIN ) && defined( WIN32 ) && !defined(__GNUC__)