diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index 160efcb61..e14d59d6e 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -71,6 +71,7 @@ extern FARPROC g_fpDirectDrawCreateClipper; extern HMODULE g_hmodCommonControls; extern FARPROC g_fpTrackMouseEvent; +extern Bool g_fNoHelpMessageBox; /* @@ -320,13 +321,9 @@ OsVendorInit (void) } -/* See Porting Layer Definition - p. 57 */ void -ddxUseMsg (void) +winUseMsg (void) { - /* Set a flag so that FatalError won't give duplicate warning message */ - g_fUseMsg = TRUE; - ErrorF ("-depth bits_per_pixel\n" "\tSpecify an optional bitdepth to use in fullscreen mode\n" "\twith a DirectDraw engine.\n"); @@ -463,6 +460,16 @@ ddxUseMsg (void) ErrorF ("-[no]keyhook\n" "\tGrab special windows key combinations like Alt-Tab or the Menu key.\n" "\tThese keys are discarded by default.\n"); +} + +/* See Porting Layer Definition - p. 57 */ +void +ddxUseMsg(void) +{ + /* Set a flag so that FatalError won't give duplicate warning message */ + g_fUseMsg = TRUE; + + winUseMsg(); /* Log file will not be opened for UseMsg unless we open it now */ if (!g_fLogInited) { @@ -472,7 +479,8 @@ ddxUseMsg (void) LogClose (); /* Notify user where UseMsg text can be found.*/ - winMessageBoxF ("The Cygwin/X help text has been printed to " + if (!g_fNoHelpMessageBox) + winMessageBoxF ("The Cygwin/X help text has been printed to " "/tmp/XWin.log.\n" "Please open /tmp/XWin.log to read the help text.\n", MB_ICONINFORMATION); diff --git a/hw/xwin/winglobals.c b/hw/xwin/winglobals.c index e749c9d37..efe53d9f6 100644 --- a/hw/xwin/winglobals.c +++ b/hw/xwin/winglobals.c @@ -63,6 +63,7 @@ DWORD g_dwCurrentThreadID = 0; Bool g_fKeyboardHookLL = FALSE; HHOOK g_hhookKeyboardLL = NULL; HWND g_hwndKeyboardFocus = NULL; +Bool g_fNoHelpMessageBox = FALSE; /* diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c index 55237cf5e..dc7fe811f 100755 --- a/hw/xwin/winprocarg.c +++ b/hw/xwin/winprocarg.c @@ -31,7 +31,6 @@ from The Open Group. #include "winprefs.h" #include "winmsg.h" - /* * References to external symbols */ @@ -49,6 +48,7 @@ extern char * g_pszLogFile; extern Bool g_fXdmcpEnabled; extern char * g_pszCommandLine; extern Bool g_fKeyboardHookLL; +extern Bool g_fNoHelpMessageBox; /* @@ -190,15 +190,17 @@ ddxProcessArgument (int argc, char *argv[], int i) s_fBeenHere = TRUE; - /* Log the version information */ - winLogVersionInfo (); - - /* Log the command line */ - winLogCommandLine (argc, argv); - /* Initialize only if option is not -help */ - if (!IS_OPTION("-help")) + if (!IS_OPTION("-help") && !IS_OPTION("-h") && !IS_OPTION("--help") && + !IS_OPTION("-version") && !IS_OPTION("--version")) { + + /* Log the version information */ + winLogVersionInfo (); + + /* Log the command line */ + winLogCommandLine (argc, argv); + /* * Initialize default screen settings. We have to do this before * OsVendorInit () gets called, otherwise we will overwrite @@ -213,7 +215,29 @@ ddxProcessArgument (int argc, char *argv[], int i) #if CYGDEBUG winErrorFVerb (2, "ddxProcessArgument - arg: %s\n", argv[i]); #endif - + + /* + * Look for the '-help' and similar options + */ + if (IS_OPTION ("-help") || IS_OPTION("-h") || IS_OPTION("--help")) + { + /* Reset logfile. We don't need that helpmessage in the logfile */ + g_pszLogFile = NULL; + g_fNoHelpMessageBox = TRUE; + UseMsg(); + exit (0); + return 1; + } + + if (IS_OPTION ("-version") || IS_OPTION("--version")) + { + /* Reset logfile. We don't need that versioninfo in the logfile */ + g_pszLogFile = NULL; + winLogVersionInfo (); + exit (0); + return 1; + } + /* * Look for the '-screen scr_num [width height]' argument */