17 // =======================================================================
19 // =======================================================================
20 void Sys_Shutdown (void)
23 fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~FNDELAY);
28 void Sys_Error (const char *error, ...)
31 char string[MAX_INPUTLINE];
33 // change stdin to non blocking
35 fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~FNDELAY);
38 va_start (argptr,error);
39 dpvsnprintf (string, sizeof (string), error, argptr);
42 Con_Printf ("Quake Error: %s\n", string);
48 void Sys_PrintToTerminal(const char *text)
51 // BUG: for some reason, NDELAY also affects stdout (1) when used on stdin (0).
52 int origflags = fcntl (1, F_GETFL, 0);
53 fcntl (1, F_SETFL, origflags & ~FNDELAY);
60 fs_offset_t written = (fs_offset_t)write(1, text, strlen(text));
62 break; // sorry, I cannot do anything about this error - without an output
66 fcntl (1, F_SETFL, origflags);
68 //fprintf(stdout, "%s", text);
71 char *Sys_ConsoleInput(void)
73 //if (cls.state == ca_dedicated)
75 static char text[MAX_INPUTLINE];
76 static unsigned int len = 0;
102 if (len < sizeof (text) - 1)
111 struct timeval timeout;
113 FD_SET(0, &fdset); // stdin
116 if (select (1, &fdset, NULL, NULL, &timeout) != -1 && FD_ISSET(0, &fdset))
118 len = read (0, text, sizeof(text) - 1);
121 // rip off the \n and terminate
122 // div0: WHY? console code can deal with \n just fine
123 // this caused problems with pasting stuff into a terminal window
124 // so, not ripping off the \n, but STILL keeping a NUL terminator
134 char *Sys_GetClipboardData (void)
139 void Sys_InitConsole (void)
143 int main (int argc, char **argv)
145 signal(SIGFPE, SIG_IGN);
148 com_argv = (const char **)argv;
151 fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);
159 qboolean sys_supportsdlgetticks = false;
160 unsigned int Sys_SDL_GetTicks (void)
162 Sys_Error("Called Sys_SDL_GetTicks on non-SDL target");
165 void Sys_SDL_Delay (unsigned int milliseconds)
167 Sys_Error("Called Sys_SDL_Delay on non-SDL target");