diff options
author | Yaakov Selkowitz <yselkowitz@users.sourceforge.net> | 2010-02-01 17:11:51 +0000 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2010-03-16 14:02:17 +0000 |
commit | bf181915e103b0659c5a0bc3b2f6bccb18c9ec36 (patch) | |
tree | 97baaa289584be87ffc5f438d3e2c58896d19d1b /hw | |
parent | cca4952d750779a4c58a11fe08a53336042930bb (diff) |
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>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xwin/InitOutput.c | 17 | ||||
-rw-r--r-- | hw/xwin/winerror.c | 9 | ||||
-rw-r--r-- | hw/xwin/winglobals.c | 4 | ||||
-rwxr-xr-x | hw/xwin/winprocarg.c | 2 | ||||
-rw-r--r-- | hw/xwin/winshaddd.c | 2 |
5 files changed, 19 insertions, 15 deletions
diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index d8fd59f6c..175cd9d81 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -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 */ diff --git a/hw/xwin/winerror.c b/hw/xwin/winerror.c index 9ed27c3d0..191b9a921 100644 --- a/hw/xwin/winerror.c +++ b/hw/xwin/winerror.c @@ -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", diff --git a/hw/xwin/winglobals.c b/hw/xwin/winglobals.c index 7bb4a602d..926ce69b8 100644 --- a/hw/xwin/winglobals.c +++ b/hw/xwin/winglobals.c @@ -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; diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c index 159e53333..66da76f6c 100755 --- a/hw/xwin/winprocarg.c +++ b/hw/xwin/winprocarg.c @@ -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 diff --git a/hw/xwin/winshaddd.c b/hw/xwin/winshaddd.c index 4f3e89501..85dc10f53 100644 --- a/hw/xwin/winshaddd.c +++ b/hw/xwin/winshaddd.c @@ -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, |