Xming: Place logfile in users tempdir

This commit is contained in:
Alexander Gottwald 2004-11-22 14:12:33 +00:00
parent 0f7874cbfc
commit 255c3c0e8c
4 changed files with 31 additions and 7 deletions

View File

@ -1,3 +1,8 @@
2004-11-22 Alexander Gottwald <ago at freedesktop dot org>
* InitOutput.c, winglobals.c, winprocarg.c:
Xming: Place logfile in users tempdir
2004-11-15 Alexander Gottwald <ago at freedesktop dot org> 2004-11-15 Alexander Gottwald <ago at freedesktop dot org>
* Imakefile: * Imakefile:

View File

@ -54,6 +54,7 @@ extern char * g_pszCommandLine;
extern Bool g_fSilentFatalError; extern Bool g_fSilentFatalError;
extern char * g_pszLogFile; extern char * g_pszLogFile;
extern Bool g_fLogFileChanged;
extern int g_iLogVerbose; extern int g_iLogVerbose;
Bool g_fLogInited; Bool g_fLogInited;
@ -604,7 +605,6 @@ winFixupPaths (void)
basedir); basedir);
buffer[sizeof(buffer)-1] = 0; buffer[sizeof(buffer)-1] = 0;
putenv(buffer); putenv(buffer);
winDebug("%s\n", getenv("XKEYSYMDB"));
} }
if (getenv("XLOCALEDIR") == NULL) if (getenv("XLOCALEDIR") == NULL)
{ {
@ -613,7 +613,18 @@ winFixupPaths (void)
basedir); basedir);
buffer[sizeof(buffer)-1] = 0; buffer[sizeof(buffer)-1] = 0;
putenv(buffer); putenv(buffer);
winDebug("%s\n", getenv("XLOCALEDIR")); }
if (!g_fLogFileChanged) {
static char buffer[MAX_PATH];
DWORD size = GetTempPath(sizeof(buffer), buffer);
if (size && size < sizeof(buffer))
{
snprintf(buffer + size, sizeof(buffer) - size,
"XWin.%s.log", display);
buffer[sizeof(buffer)-1] = 0;
g_pszLogFile = buffer;
winMsg (X_DEFAULT, "Logfile set to \"%s\"\n", g_pszLogFile);
}
} }
#ifdef XKB #ifdef XKB
{ {
@ -634,6 +645,11 @@ OsVendorInit (void)
/* Re-initialize global variables on server reset */ /* Re-initialize global variables on server reset */
winInitializeGlobals (); winInitializeGlobals ();
LogInit (NULL, NULL);
LogSetParameter (XLOG_VERBOSITY, g_iLogVerbose);
winFixupPaths();
#ifdef DDXOSVERRORF #ifdef DDXOSVERRORF
if (!OsVendorVErrorFProc) if (!OsVendorVErrorFProc)
OsVendorVErrorFProc = OsVendorVErrorF; OsVendorVErrorFProc = OsVendorVErrorF;
@ -647,7 +663,7 @@ OsVendorInit (void)
*/ */
g_fLogInited = TRUE; g_fLogInited = TRUE;
LogInit (g_pszLogFile, NULL); LogInit (g_pszLogFile, NULL);
} }
LogSetParameter (XLOG_FLUSH, 1); LogSetParameter (XLOG_FLUSH, 1);
LogSetParameter (XLOG_VERBOSITY, g_iLogVerbose); LogSetParameter (XLOG_VERBOSITY, g_iLogVerbose);
LogSetParameter (XLOG_FILE_VERBOSITY, 1); LogSetParameter (XLOG_FILE_VERBOSITY, 1);
@ -681,10 +697,6 @@ OsVendorInit (void)
/* We have to flag this as an explicit screen, even though it isn't */ /* We have to flag this as an explicit screen, even though it isn't */
g_ScreenInfo[0].fExplicitScreen = TRUE; g_ScreenInfo[0].fExplicitScreen = TRUE;
} }
winFixupPaths();
XSupportsLocale();
} }

View File

@ -61,6 +61,7 @@ HICON g_hSmallIconX = NULL;
char * g_pszLogFile = "/tmp/XWin.log"; char * g_pszLogFile = "/tmp/XWin.log";
#else #else
char * g_pszLogFile = "XWin.log"; char * g_pszLogFile = "XWin.log";
Bool g_fLogFileChanged = FALSE;
#endif #endif
int g_iLogVerbose = 2; int g_iLogVerbose = 2;
Bool g_fLogInited = FALSE; Bool g_fLogInited = FALSE;

View File

@ -45,6 +45,9 @@ extern Bool g_fClipboard;
#endif #endif
extern int g_iLogVerbose; extern int g_iLogVerbose;
extern char * g_pszLogFile; extern char * g_pszLogFile;
#ifdef RELOCATE_PROJECTROOT
extern Bool g_fLogFileChanged;
#endif
extern Bool g_fXdmcpEnabled; extern Bool g_fXdmcpEnabled;
extern char * g_pszCommandLine; extern char * g_pszCommandLine;
extern Bool g_fKeyboardHookLL; extern Bool g_fKeyboardHookLL;
@ -1177,6 +1180,9 @@ ddxProcessArgument (int argc, char *argv[], int i)
{ {
CHECK_ARGS (1); CHECK_ARGS (1);
g_pszLogFile = argv[++i]; g_pszLogFile = argv[++i];
#ifdef RELOCATE_PROJECTROOT
g_fLogFileChanged = TRUE;
#endif
return 2; return 2;
} }