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 snprintf (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* dllname, dllhandle_t* handle, const dllfunction_t *fcts)
79 const dllfunction_t *func;
80 dllhandle_t dllhandle;
86 for (func = fcts; func && func->name != NULL; func++)
87 *func->funcvariable = NULL;
91 dllhandle = LoadLibrary (dllname);
93 dllhandle = dlopen (dllname, RTLD_LAZY);
97 Con_Printf ("Can't load \"%s\".\n", dllname);
101 // Get the function adresses
102 for (func = fcts; func && func->name != NULL; func++)
103 if (!(*func->funcvariable = (void *) Sys_GetProcAddress (dllhandle, func->name)))
105 Con_Printf ("Missing function \"%s\" - broken library!\n", func->name);
106 Sys_UnloadLibrary (&dllhandle);
111 Con_Printf("\"%s\" loaded.\n", dllname);
115 void Sys_UnloadLibrary (dllhandle_t* handle)
117 if (handle == NULL || *handle == NULL)
121 FreeLibrary (*handle);
129 void* Sys_GetProcAddress (dllhandle_t handle, const char* name)
132 return (void *)GetProcAddress (handle, name);
134 return (void *)dlsym (handle, name);