void NV_LoadConfig(){ int read, i; int error = 0; char buf[256]; char filename[MAX_QPATH]; *buf = 0; fileHandle_t file; if( nvEntered == qtrue ){ return; } nvEntered = qtrue; Auth_ClearAdminList(); Q_strncpyz(filename, NV_CONFIGFILE, sizeof(filename)); FS_SV_FOpenFileRead(filename, &file); if(!file) { /* Legacy nvconfig fallback */ Q_strncpyz(filename, NV_CONFIGFILEOLD, sizeof(filename)); FS_SV_FOpenFileRead(filename, &file); } if(!file){ Com_DPrintf("Couldn't open %s for reading\n", filename); nvEntered = qfalse; return; } Com_Printf( "loading %s\n", filename); i = 0; while(qtrue){ read = FS_ReadLine(buf,sizeof(buf),file); if(read == 0){ FS_FCloseFile(file); Com_Printf("Loaded %s %i errors\n", filename, error); nvEntered = qfalse; return; } if(read == -1){ Com_Printf("Can not read from %s\n", filename); FS_FCloseFile(file); nvEntered = qfalse; return; } i++;//linecouter if(!*buf || *buf == '/' || *buf == '\n'){ continue; } if(!NV_ParseConfigLine(buf, i)){ error++; } } }
void Auth_Init() { static qboolean initialized; if ( initialized ) { return; } initialized = qtrue; Auth_ClearAdminList(); Cmd_AddCommand ("authUnsetAdmin", Auth_UnsetAdmin_f); Cmd_AddCommand ("authSetAdmin", Auth_SetAdmin_f); Cmd_AddCommand ("authListAdmins", Auth_ListAdmins_f); Cmd_AddCommand ("authLogin", Auth_Login_f); Cmd_AddCommand ("authChangePassword", Auth_ChangePassword_f); }