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:
@@ -498,5 +498,19 @@ typedef unsigned int wint_t;
|
|||||||
# define _NORETURN
|
# define _NORETURN
|
||||||
#endif
|
#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 */
|
#endif /* _PORT_H */
|
||||||
|
|
||||||
|
|||||||
@@ -154,6 +154,9 @@ main (int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
freopen (options.logFile, "w", stderr);
|
freopen (options.logFile, "w", stderr);
|
||||||
|
#ifdef UNBUFFERED_LOGFILE
|
||||||
|
setbuf (stderr, NULL);
|
||||||
|
#endif
|
||||||
for (i = 0; i < argc; ++i)
|
for (i = 0; i < argc; ++i)
|
||||||
log_add (log_User, "argv[%d] = [%s]", i, argv[i]);
|
log_add (log_User, "argv[%d] = [%s]", i, argv[i]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user