Make the logfile unbuffered by default on Windows CE.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2886 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
Meep-Eep
2007-12-23 06:11:46 +00:00
parent ccfcddd719
commit 99cefbb5d3
2 changed files with 17 additions and 0 deletions
+14
View File
@@ -498,5 +498,19 @@ typedef unsigned int wint_t;
# define _NORETURN
#endif
// Buffered vs. unbuffered logfile
// stderr is normally unbuffered when connected to a terminal, but it
// will be buffered when connected to a file, when a --logfile argument
// is passed to uqm.
// Buffered output is slower, which can be significant if much debug output
// is requested, but after a crash occurs the logfile will still be up to
// date.
// On platforms where there is no console, having up-to-date log files
// after a crash is valuable enough to make the logfile unbuffered by
// default there.
#if defined(_WIN32_WCE)
# define UNBUFFERED_LOGFILE
#endif
#endif /* _PORT_H */
+3
View File
@@ -154,6 +154,9 @@ main (int argc, char *argv[])
{
int i;
freopen (options.logFile, "w", stderr);
#ifdef UNBUFFERED_LOGFILE
setbuf (stderr, NULL);
#endif
for (i = 0; i < argc; ++i)
log_add (log_User, "argv[%d] = [%s]", i, argv[i]);
}