10 qboolean sys_nostdout = false;
12 static char sys_timestring[128];
13 char *Sys_TimeString(const char *timeformat)
15 time_t mytime = time(NULL);
16 strftime(sys_timestring, sizeof(sys_timestring), timeformat, localtime(&mytime));
17 return sys_timestring;
21 extern qboolean host_shuttingdown;
24 host_shuttingdown = true;
29 char engineversion[128];
31 void Sys_Shared_EarlyInit(void)
41 #if defined(__linux__)
45 #elif defined(__FreeBSD__)
47 #elif defined(__NetBSD__)
49 #elif defined(__OpenBSD__)
56 dpsnprintf (engineversion, sizeof (engineversion), "%s %s %s", gamename, os, buildstring);
58 // COMMANDLINEOPTION: Console: -nostdout disables text output to the terminal the game was launched from
59 if (COM_CheckParm("-nostdout"))
62 Con_Printf("%s\n", engineversion);
65 void Sys_Shared_LateInit(void)
70 ===============================================================================
74 ===============================================================================
77 qboolean Sys_LoadLibrary (const char** dllnames, dllhandle_t* handle, const dllfunction_t *fcts)
79 const dllfunction_t *func;
80 dllhandle_t dllhandle = 0;
87 for (func = fcts; func && func->name != NULL; func++)
88 *func->funcvariable = NULL;
90 // Try every possible name
91 for (i = 0; dllnames[i] != NULL; i++)
94 dllhandle = LoadLibrary (dllnames[i]);
96 dllhandle = dlopen (dllnames[i], RTLD_LAZY);
101 Con_Printf ("Can't load \"%s\".\n", dllnames[i]);
108 Con_Printf("\"%s\" loaded.\n", dllnames[i]);
110 // Get the function adresses
111 for (func = fcts; func && func->name != NULL; func++)
112 if (!(*func->funcvariable = (void *) Sys_GetProcAddress (dllhandle, func->name)))
114 Con_Printf ("Missing function \"%s\" - broken library!\n", func->name);
115 Sys_UnloadLibrary (&dllhandle);
123 void Sys_UnloadLibrary (dllhandle_t* handle)
125 if (handle == NULL || *handle == NULL)
129 FreeLibrary (*handle);
137 void* Sys_GetProcAddress (dllhandle_t handle, const char* name)
140 return (void *)GetProcAddress (handle, name);
142 return (void *)dlsym (handle, name);