X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=sys_linux.c;h=1edb74ddcf42ed8421f6eb18dfda882372626fab;hb=a53125498eeac71ffa52aa0160c3de455799877b;hp=0515c93445844ad7861580cde94c798a304b07f3;hpb=d159736a199e4043ed98cde48f6d5716ec40845c;p=xonotic%2Fdarkplaces.git diff --git a/sys_linux.c b/sys_linux.c index 0515c934..1edb74dd 100644 --- a/sys_linux.c +++ b/sys_linux.c @@ -1,5 +1,6 @@ #ifdef WIN32 +#include #include "conio.h" #else #include @@ -51,7 +52,22 @@ void Sys_Error (const char *error, ...) void Sys_PrintToTerminal(const char *text) { - fprintf(stdout, "%s", text); +#ifndef WIN32 + // BUG: for some reason, NDELAY also affects stdout (1) when used on stdin (0). + int origflags = fcntl (1, F_GETFL, 0); + fcntl (1, F_SETFL, origflags & ~FNDELAY); +#endif + while(*text) + { + int written = (int)write(1, text, (int)strlen(text)); + if(written <= 0) + break; // sorry, I cannot do anything about this error - without an output + text += written; + } +#ifndef WIN32 + fcntl (1, F_SETFL, origflags); +#endif + //fprintf(stdout, "%s", text); } double Sys_DoubleTime (void)