From 8ef3e7052e8e1db869411e9f6fc88491e3f05474 Mon Sep 17 00:00:00 2001 From: Alexander Gottwald Date: Tue, 27 Jul 2004 09:53:14 +0000 Subject: [PATCH] Merge latest changes from CYGWIN branch Use find | xargs combination instead of simple shell globbing to prevent commandline argument overflow --- hw/xwin/ChangeLog | 25 ++++++++++++ hw/xwin/InitOutput.c | 93 +++++++++++++++++++++++++++++++++++++++++++- hw/xwin/winconfig.c | 2 + hw/xwin/winerror.c | 4 +- hw/xwin/winglobals.c | 3 +- hw/xwin/winprocarg.c | 6 +++ 6 files changed, 128 insertions(+), 5 deletions(-) diff --git a/hw/xwin/ChangeLog b/hw/xwin/ChangeLog index 8695f6c0f..9cc35ce6e 100644 --- a/hw/xwin/ChangeLog +++ b/hw/xwin/ChangeLog @@ -1,3 +1,26 @@ +2004-07-09 Alexander Gottwald + + * winconfig.c: Add entry for irish layout (ie) + * InitOutput.c, winerror.c, winglobals.c: rename g_fUseMsg to + g_fSilentFatalError + * InitOutput.c, winglobals.c, winprocarg.c: added commandline option + -silent-dup-error to allow silent termination if another instance of + XWin was found running + +2004-06-27 Alexander Gottwald + + * winconfig.c: Add entry for us layout. This changes not much but + removes a strange error message about the unknown us layout. + +2004-06-24 Alexander Gottwald + + * InitOutput.c: Check for textmode mounted /tmp and print a warning + +2004-06-15 Harold Hunt + + * windialogs.c: Fix path to locally installed changelog for the About + dialog box. + 2004-05-27 Alexander Gottwald * winpriv.c: Create win32 window if not already created @@ -62,3 +85,5 @@ logging api's. Add some additional debug logging. Make best effort to prevent our window appearing twice in the clipboard chain. Also detect loops when they occur and try to behave in a reasonable way. + +# vim:ts=8:noexpandtab diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index c8f92d25a..673a0aa98 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -35,6 +35,7 @@ from The Open Group. #endif #include "winprefs.h" #include "X11/Xlocale.h" +#include /* @@ -45,7 +46,7 @@ extern int g_iNumScreens; extern winScreenInfo g_ScreenInfo[]; extern int g_iLastScreen; extern char * g_pszCommandLine; -extern Bool g_fUseMsg; +extern Bool g_fSilentFatalError; extern char * g_pszLogFile; extern int g_iLogVerbose; @@ -72,6 +73,7 @@ extern FARPROC g_fpDirectDrawCreateClipper; extern HMODULE g_hmodCommonControls; extern FARPROC g_fpTrackMouseEvent; extern Bool g_fNoHelpMessageBox; +extern Bool g_fSilentDupError; /* @@ -267,6 +269,89 @@ AbortDDX (void) ddxGiveUp (); } +/* hasmntopt is currently not implemented for cygwin */ +const char *winCheckMntOpt(const struct mntent *mnt, const char *opt) +{ + const char *s; + size_t len; + if (mnt == NULL) + return NULL; + if (opt == NULL) + return NULL; + if (mnt->mnt_opts == NULL) + return NULL; + + len = strlen(opt); + s = strstr(mnt->mnt_opts, opt); + if (s == NULL) + return NULL; + if ((s == mnt->mnt_opts || *(s-1) == ',') && (s[len] == 0 || s[len] == ',')) + return (char *)opt; + return NULL; +} + +void +winCheckMount(void) +{ + FILE *mnt; + struct mntent *ent; + + enum { none = 0, sys_root, user_root, sys_tmp, user_tmp } + level = none, curlevel; + BOOL binary = TRUE; + + mnt = setmntent("/etc/mtab", "r"); + if (mnt == NULL) + { + ErrorF("setmntent failed"); + return; + } + + while ((ent = getmntent(mnt)) != NULL) + { + BOOL system = (strcmp(ent->mnt_type, "system") == 0); + BOOL root = (strcmp(ent->mnt_dir, "/") == 0); + BOOL tmp = (strcmp(ent->mnt_dir, "/tmp") == 0); + + if (system) + { + if (root) + curlevel = sys_root; + else if (tmp) + curlevel = sys_tmp; + else + continue; + } + else + { + if (root) + curlevel = user_root; + else if (tmp) + curlevel = user_tmp; + else + continue; + } + + if (curlevel <= level) + continue; + level = curlevel; + + if (winCheckMntOpt(ent, "binmode") == NULL) + binary = 0; + else + binary = 1; + } + + if (endmntent(mnt) != 1) + { + ErrorF("endmntent failed"); + return; + } + + if (!binary) + winMsg(X_WARNING, "/tmp mounted int textmode\n"); +} + void OsVendorInit (void) @@ -296,6 +381,8 @@ OsVendorInit (void) if (serverGeneration == 1) winLogVersionInfo (); + winCheckMount(); + /* Add a default screen if no screens were specified */ if (g_iNumScreens == 0) { @@ -472,7 +559,7 @@ void ddxUseMsg(void) { /* Set a flag so that FatalError won't give duplicate warning message */ - g_fUseMsg = TRUE; + g_fSilentFatalError = TRUE; winUseMsg(); @@ -534,6 +621,8 @@ InitOutput (ScreenInfo *screenInfo, int argc, char *argv[]) /* Check for duplicate invocation on same display number.*/ if (serverGeneration == 1 && !winCheckDisplayNumber ()) { + if (g_fSilentDupError) + g_fSilentFatalError = TRUE; FatalError ("InitOutput - Duplicate invocation on display " "number: %s. Exiting.\n", display); } diff --git a/hw/xwin/winconfig.c b/hw/xwin/winconfig.c index c6e8a7873..8660c5ab9 100644 --- a/hw/xwin/winconfig.c +++ b/hw/xwin/winconfig.c @@ -238,9 +238,11 @@ WinKBLayoutRec winKBLayouts[] = { { 0x407, -1, "pc105", "de", NULL, NULL, "German (Germany)"}, {0x10407, -1, "pc105", "de", NULL, NULL, "German (Germany, IBM)"}, { 0x807, -1, "pc105", "de_CH", NULL, NULL, "German (Switzerland)"}, + { 0x409, -1, "pc105", "us", NULL, NULL, "English (USA)"}, {0x10409, -1, "pc105", "dvorak", NULL, NULL, "English (USA, Dvorak)"}, {0x20409, -1, "pc105", "us_intl", NULL, NULL, "English (USA, International)"}, { 0x809, -1, "pc105", "gb", NULL, NULL, "English (United Kingdom)"}, + { 0x1809, -1, "pc105", "ie", NULL, NULL, "Irish"}, { 0x40a, -1, "pc105", "es", NULL, NULL, "Spanish (Spain, Traditional Sort)"}, { 0x40b, -1, "pc105", "fi", NULL, NULL, "Finnish"}, { 0x40c, -1, "pc105", "fr", NULL, NULL, "French (Standard)"}, diff --git a/hw/xwin/winerror.c b/hw/xwin/winerror.c index 968467026..d5836b999 100644 --- a/hw/xwin/winerror.c +++ b/hw/xwin/winerror.c @@ -32,7 +32,7 @@ /* References to external symbols */ extern char * g_pszCommandLine; -extern Bool g_fUseMsg; +extern Bool g_fSilentFatalError; #ifdef DDXOSVERRORF @@ -69,7 +69,7 @@ void OsVendorFatalError (void) { /* Don't give duplicate warning if UseMsg was called */ - if (g_fUseMsg) + if (g_fSilentFatalError) return; winMessageBoxF ("A fatal error has occurred and Cygwin/X will now exit.\n" \ diff --git a/hw/xwin/winglobals.c b/hw/xwin/winglobals.c index da83b171a..f38df68c5 100644 --- a/hw/xwin/winglobals.c +++ b/hw/xwin/winglobals.c @@ -59,13 +59,14 @@ char * g_pszLogFile = "/tmp/XWin.log"; int g_iLogVerbose = 2; Bool g_fLogInited = FALSE; char * g_pszCommandLine = NULL; -Bool g_fUseMsg = FALSE; +Bool g_fSilentFatalError = FALSE; DWORD g_dwCurrentThreadID = 0; Bool g_fKeyboardHookLL = FALSE; HHOOK g_hhookKeyboardLL = NULL; HWND g_hwndKeyboardFocus = NULL; Bool g_fNoHelpMessageBox = FALSE; Bool g_fSoftwareCursor = FALSE; +Bool g_fSilentDupError = FALSE; /* diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c index a7302fe82..0032a9152 100755 --- a/hw/xwin/winprocarg.c +++ b/hw/xwin/winprocarg.c @@ -50,6 +50,7 @@ extern char * g_pszCommandLine; extern Bool g_fKeyboardHookLL; extern Bool g_fNoHelpMessageBox; extern Bool g_fSoftwareCursor; +extern Bool g_fSilentDupError; /* @@ -1154,6 +1155,11 @@ ddxProcessArgument (int argc, char *argv[], int i) return 1; } + if (IS_OPTION ("-silent-dup-error")) + { + g_fSilentDupError = TRUE; + return 1; + } return 0; }