Cygwin/X: Allow the default log location to be configurable

Allow the default log location to be configurable (e.g. /var/log),
and use separate logs for each display instance (e.g. XWin.0.log).

Make the type of g_pszLogFile const char*, per os/log.c:LogInit().

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
This commit is contained in:
Yaakov Selkowitz 2010-02-01 17:11:51 +00:00 committed by Jon TURNEY
parent cca4952d75
commit bf181915e1
7 changed files with 22 additions and 15 deletions

View File

@ -1829,6 +1829,7 @@ AC_MSG_RESULT([$XWIN])
if test "x$XWIN" = xyes; then
PKG_CHECK_EXISTS($WINDOWSWMPROTO, [WINDOWSWM=yes], [WINDOWSWM=no])
AC_DEFINE_DIR(SYSCONFDIR, sysconfdir, [Location of system.XWinrc])
AC_DEFINE_DIR(DEFAULT_LOGDIR, logdir, [Default log location])
AC_DEFINE_UNQUOTED(XORG_VERSION_CURRENT, [$VENDOR_RELEASE], [Current Xorg version])
AC_DEFINE_UNQUOTED(__VENDORDWEBSUPPORT__, ["$VENDOR_WEB"], [Vendor web address for support])
AC_CHECK_TOOL(WINDRES, windres)

View File

@ -69,7 +69,7 @@ extern int g_iLastScreen;
extern char * g_pszCommandLine;
extern Bool g_fSilentFatalError;
extern char * g_pszLogFile;
extern const char * g_pszLogFile;
extern Bool g_fLogFileChanged;
extern int g_iLogVerbose;
Bool g_fLogInited;
@ -244,7 +244,7 @@ ddxGiveUp (void)
#endif
if (!g_fLogInited) {
LogInit (g_pszLogFile, NULL);
g_pszLogFile = LogInit (g_pszLogFile, NULL);
g_fLogInited = TRUE;
}
LogClose ();
@ -689,9 +689,6 @@ OsVendorInit (void)
/* Re-initialize global variables on server reset */
winInitializeGlobals ();
LogInit (NULL, NULL);
LogSetParameter (XLOG_VERBOSITY, g_iLogVerbose);
winFixupPaths();
#ifdef DDXOSVERRORF
@ -706,7 +703,7 @@ OsVendorInit (void)
* avoid the second call
*/
g_fLogInited = TRUE;
LogInit (g_pszLogFile, NULL);
g_pszLogFile = LogInit (g_pszLogFile, NULL);
}
LogSetParameter (XLOG_FLUSH, 1);
LogSetParameter (XLOG_VERBOSITY, g_iLogVerbose);
@ -927,7 +924,7 @@ ddxUseMsg(void)
/* Log file will not be opened for UseMsg unless we open it now */
if (!g_fLogInited) {
LogInit (g_pszLogFile, NULL);
g_pszLogFile = LogInit (g_pszLogFile, NULL);
g_fLogInited = TRUE;
}
LogClose ();
@ -935,9 +932,9 @@ ddxUseMsg(void)
/* Notify user where UseMsg text can be found.*/
if (!g_fNoHelpMessageBox)
winMessageBoxF ("The " PROJECT_NAME " help text has been printed to "
"/tmp/XWin.log.\n"
"Please open /tmp/XWin.log to read the help text.\n",
MB_ICONINFORMATION);
"%s.\n"
"Please open %s to read the help text.\n",
MB_ICONINFORMATION, g_pszLogFile, g_pszLogFile);
}
/* See Porting Layer Definition - p. 20 */

View File

@ -41,8 +41,9 @@
/* References to external symbols */
extern char * g_pszCommandLine;
extern char * g_pszLogFile;
extern const char * g_pszLogFile;
extern Bool g_fSilentFatalError;
extern Bool g_fLogInited;
#ifdef DDXOSVERRORF
@ -87,6 +88,12 @@ OsVendorFatalError (void)
if (g_fSilentFatalError)
return;
if (!g_fLogInited) {
g_fLogInited = TRUE;
g_pszLogFile = LogInit (g_pszLogFile, NULL);
}
LogClose ();
winMessageBoxF (
"A fatal error has occurred and " PROJECT_NAME " will now exit.\n" \
"Please open %s for more information.\n",

View File

@ -69,9 +69,9 @@ Bool g_fAuthEnabled = FALSE;
HICON g_hIconX = NULL;
HICON g_hSmallIconX = NULL;
#ifndef RELOCATE_PROJECTROOT
char * g_pszLogFile = "/tmp/XWin.log";
const char * g_pszLogFile = DEFAULT_LOGDIR "/XWin.%s.log";
#else
char * g_pszLogFile = "XWin.log";
const char * g_pszLogFile = "XWin.log";
Bool g_fLogFileChanged = FALSE;
#endif
int g_iLogVerbose = 2;

View File

@ -53,7 +53,7 @@ extern Bool g_fUnicodeClipboard;
extern Bool g_fClipboard;
#endif
extern int g_iLogVerbose;
extern char * g_pszLogFile;
extern const char * g_pszLogFile;
#ifdef RELOCATE_PROJECTROOT
extern Bool g_fLogFileChanged;
#endif

View File

@ -42,7 +42,7 @@
*/
extern HWND g_hDlgExit;
extern char *g_pszLogFile;
extern const char *g_pszLogFile;
/*
* FIXME: Headers are broken, DEFINE_GUID doesn't work correctly,

View File

@ -32,3 +32,5 @@
/* Location of system.XWinrc */
#undef SYSCONFDIR
/* Default log location */
#undef DEFAULT_LOGDIR