Added a "nooutbuf" cmdline param.
This forces that the stdout stream uses no buffer, even when not a TTY. Used for running MCServer under ZeroBraneStudio.
This commit is contained in:
parent
9c6d72a023
commit
a23b5d13bd
@ -42,7 +42,7 @@ cLog::~cLog()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
cLog* cLog::GetInstance()
|
cLog * cLog::GetInstance()
|
||||||
{
|
{
|
||||||
if (s_Log != NULL)
|
if (s_Log != NULL)
|
||||||
{
|
{
|
||||||
@ -92,7 +92,7 @@ void cLog::ClearLog()
|
|||||||
if( m_File )
|
if( m_File )
|
||||||
fclose (m_File);
|
fclose (m_File);
|
||||||
#endif
|
#endif
|
||||||
m_File = 0;
|
m_File = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
27
src/main.cpp
27
src/main.cpp
@ -243,31 +243,36 @@ int main( int argc, char **argv )
|
|||||||
// Check if comm logging is to be enabled:
|
// Check if comm logging is to be enabled:
|
||||||
for (int i = 0; i < argc; i++)
|
for (int i = 0; i < argc; i++)
|
||||||
{
|
{
|
||||||
|
AString Arg(argv[i]);
|
||||||
if (
|
if (
|
||||||
(NoCaseCompare(argv[i], "/commlog") == 0) ||
|
(NoCaseCompare(Arg, "/commlog") == 0) ||
|
||||||
(NoCaseCompare(argv[i], "/logcomm") == 0)
|
(NoCaseCompare(Arg, "/logcomm") == 0)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
g_ShouldLogCommIn = true;
|
g_ShouldLogCommIn = true;
|
||||||
g_ShouldLogCommOut = true;
|
g_ShouldLogCommOut = true;
|
||||||
}
|
}
|
||||||
if (
|
else if (
|
||||||
(NoCaseCompare(argv[i], "/commlogin") == 0) ||
|
(NoCaseCompare(Arg, "/commlogin") == 0) ||
|
||||||
(NoCaseCompare(argv[i], "/comminlog") == 0) ||
|
(NoCaseCompare(Arg, "/comminlog") == 0) ||
|
||||||
(NoCaseCompare(argv[i], "/logcommin") == 0)
|
(NoCaseCompare(Arg, "/logcommin") == 0)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
g_ShouldLogCommIn = true;
|
g_ShouldLogCommIn = true;
|
||||||
}
|
}
|
||||||
if (
|
else if (
|
||||||
(NoCaseCompare(argv[i], "/commlogout") == 0) ||
|
(NoCaseCompare(Arg, "/commlogout") == 0) ||
|
||||||
(NoCaseCompare(argv[i], "/commoutlog") == 0) ||
|
(NoCaseCompare(Arg, "/commoutlog") == 0) ||
|
||||||
(NoCaseCompare(argv[i], "/logcommout") == 0)
|
(NoCaseCompare(Arg, "/logcommout") == 0)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
g_ShouldLogCommOut = true;
|
g_ShouldLogCommOut = true;
|
||||||
}
|
}
|
||||||
}
|
else if (NoCaseCompare(Arg, "nooutbuf") == 0)
|
||||||
|
{
|
||||||
|
setvbuf(stdout, NULL, _IONBF, 0);
|
||||||
|
}
|
||||||
|
} // for i - argv[]
|
||||||
|
|
||||||
#if !defined(ANDROID_NDK)
|
#if !defined(ANDROID_NDK)
|
||||||
try
|
try
|
||||||
|
Loading…
Reference in New Issue
Block a user