9 extern cvar_t timestamps;
10 extern cvar_t timeformat;
12 static int sys_nostdout = false;
14 /* The translation table between the graphical font and plain ASCII --KB */
15 static char qfont_table[256] = {
16 '\0', '#', '#', '#', '#', '.', '#', '#',
17 '#', 9, 10, '#', ' ', 13, '.', '.',
18 '[', ']', '0', '1', '2', '3', '4', '5',
19 '6', '7', '8', '9', '.', '<', '=', '>',
20 ' ', '!', '"', '#', '$', '%', '&', '\'',
21 '(', ')', '*', '+', ',', '-', '.', '/',
22 '0', '1', '2', '3', '4', '5', '6', '7',
23 '8', '9', ':', ';', '<', '=', '>', '?',
24 '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
25 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
26 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
27 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
28 '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
29 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
30 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
31 'x', 'y', 'z', '{', '|', '}', '~', '<',
33 '<', '=', '>', '#', '#', '.', '#', '#',
34 '#', '#', ' ', '#', ' ', '>', '.', '.',
35 '[', ']', '0', '1', '2', '3', '4', '5',
36 '6', '7', '8', '9', '.', '<', '=', '>',
37 ' ', '!', '"', '#', '$', '%', '&', '\'',
38 '(', ')', '*', '+', ',', '-', '.', '/',
39 '0', '1', '2', '3', '4', '5', '6', '7',
40 '8', '9', ':', ';', '<', '=', '>', '?',
41 '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
42 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
43 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
44 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
45 '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
46 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
47 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
48 'x', 'y', 'z', '{', '|', '}', '~', '<'
51 static char sys_timestring[128];
52 char *Sys_TimeString(const char *timeformat)
54 time_t mytime = time(NULL);
55 strftime(sys_timestring, sizeof(sys_timestring), timeformat, localtime(&mytime));
56 return sys_timestring;
60 #define MAXPRINTMSG 16384
62 void Sys_Print(const char *msg)
66 char final[MAXPRINTMSG];
71 if (timestamps.integer)
72 snprintf(final, sizeof(final), "%s%s", Sys_TimeString(timeformat.string), msg);
74 strncpy(final, msg, sizeof(final));
76 // LordHavoc: make sure the string is terminated
77 final[MAXPRINTMSG-1] = 0;
78 for (p = (unsigned char *) final;*p; p++)
80 Sys_PrintToTerminal(final);
83 void Sys_Printf(const char *fmt, ...)
86 char msg[MAXPRINTMSG]; // String we started with
89 vsnprintf(msg,sizeof(msg),fmt,argptr);
96 char engineversion[128];
98 void Sys_Shared_EarlyInit(void)
107 #if defined(__linux__)
111 #elif defined(__NetBSD__)
113 #elif defined(__OpenBSD__)
118 snprintf (engineversion, sizeof (engineversion), "%s %s %s", gamename, os, buildstring);
120 if (COM_CheckParm("-nostdout"))
123 Con_Printf("%s\n", engineversion);
126 void Sys_Shared_LateInit(void)
131 ===============================================================================
135 ===============================================================================
142 dllhandle_t Sys_LoadLibrary (const char* name)
145 return LoadLibrary (name);
147 return dlopen (name, RTLD_LAZY);
151 void Sys_UnloadLibrary (dllhandle_t handle)
154 FreeLibrary (handle);
160 void* Sys_GetProcAddress (dllhandle_t handle, const char* name)
163 return (void *)GetProcAddress (handle, name);
165 return (void *)dlsym (handle, name);