char *get_config_msg(char *type) { char *got; memset(smbuf, 0, 1024); if (!config_msg.where || !*config_msg.where) { if (!strcasecmp(type, "max_log_size")) /* ouch */ return "5000"; log("error", "Softmsg file for config_msg aint loaded!"); return "error"; } got = lineval(config_msg.where, type); if (!got || !*got) { if (!strcasecmp(type, "logon_prefix") || !strcasecmp(type, "logon_suffix") || !strcasecmp(type, "logoff_prefix") || !strcasecmp(type, "logoff_suffix") || !strcasecmp(type, "site_alias") || !strcasecmp(type, "welcome_msg")) return ""; LOGF("error", "Softmsg in config_msg for '%s' isnt there!", type); return "error"; } strncpy(smbuf, got, 1023); return smbuf; }
char *get_admin_msg(char *type) { char *got; memset(smbuf, 0, 1024); if (!admin_msg.where || !*admin_msg.where) /* file aint loaded */ { log("error", "Softmsg file for admin_msg aint loaded!"); return "-=*> Erg erg erg"; } got = lineval(admin_msg.where, type); if (!got || !*got) { LOGF("error", "Softmsg in admin_msg for '%s' isnt there!", type); return "-=*> Erg erg erg"; } strncpy(smbuf, lineval(admin_msg.where, type), 1023); return smbuf; }
char *get_frog_msg(char *type) { char *got; memset(smbuf, 0, 1024); if (!frogs_msg.where || !*frogs_msg.where) { log("error", "Softmsg file for frogs_msg aint loaded!"); return "I want my rattle"; } got = lineval(frogs_msg.where, type); if (!got || !*got) { LOGF("error", "Softmsg in frogs_msg for '%s' isnt there!", type); return "I want my rattle"; } strncpy(smbuf, lineval(frogs_msg.where, type), 1023); return smbuf; }
char *get_deflog_msg(char *type) { char *got; memset(smbuf, 0, 1024); if (!deflog_msg.where || !*deflog_msg.where) return "non"; got = lineval(deflog_msg.where, type); if (!got || !*got) return "non"; strncpy(smbuf, got, 1023); return smbuf; }
char *get_shutdowns_msg(char *type) { char *got; memset(smbuf, 0, 1024); if (!shutdowns_msg.where || !*shutdowns_msg.where) /* file aint loaded */ { log("error", "Softmsg file for shutdowns_msg aint loaded!"); return ""; } got = lineval(shutdowns_msg.where, type); if (got && *got) strncpy(smbuf, got, 1023); return smbuf; /* its ok to have empty cases here */ }
char *get_rooms_msg(char *type) { char *got; memset(smbuf, 0, 1024); if (!rooms_msg.where || !*rooms_msg.where) { log("error", "Softmsg file for rooms_msg aint loaded!"); return "erg erg erg"; } got = lineval(rooms_msg.where, type); if (!got || !*got) { LOGF("error", "Softmsg in rooms_msg for '%s' isnt there!", type); return "erg erg erg"; } strncpy(smbuf, got, 1023); return smbuf; }
char *get_session_msg(char *type) { char *got; memset(smbuf, 0, 1024); if (!session_msg.where || !*session_msg.where) { log("error", "Softmsg file for session_msg aint loaded!"); return "not set"; } got = lineval(session_msg.where, type); if (!got || !*got) { LOGF("error", "Softmsg in session_msg for '%s' isnt there!", type); return "not set"; } strncpy(smbuf, got, 1023); return smbuf; }
LLCPUInfo::LLCPUInfo() { std::ostringstream out; CProcessor proc; const ProcessorInfo* info = proc.GetCPUInfo(); // proc.WriteInfoTextFile("procInfo.txt"); mHasSSE = info->_Ext.SSE_StreamingSIMD_Extensions; mHasSSE2 = info->_Ext.SSE2_StreamingSIMD2_Extensions; mHasAltivec = info->_Ext.Altivec_Extensions; mCPUMhz = (S32)(proc.GetCPUFrequency(50)/1000000.0); mFamily.assign( info->strFamily ); mCPUString = "Unknown"; #if LL_WINDOWS || LL_DARWIN || LL_SOLARIS out << proc.strCPUName; if (200 < mCPUMhz && mCPUMhz < 10000) // *NOTE: cpu speed is often way wrong, do a sanity check { out << " (" << mCPUMhz << " MHz)"; } mCPUString = out.str(); #elif LL_LINUX std::map< std::string, std::string > cpuinfo; LLFILE* cpuinfo_fp = LLFile::fopen(CPUINFO_FILE, "rb"); if(cpuinfo_fp) { char line[MAX_STRING]; memset(line, 0, MAX_STRING); while(fgets(line, MAX_STRING, cpuinfo_fp)) { // /proc/cpuinfo on Linux looks like: // name\t*: value\n char* tabspot = strchr( line, '\t' ); if (tabspot == NULL) continue; char* colspot = strchr( tabspot, ':' ); if (colspot == NULL) continue; char* spacespot = strchr( colspot, ' ' ); if (spacespot == NULL) continue; char* nlspot = strchr( line, '\n' ); if (nlspot == NULL) nlspot = line + strlen( line ); // Fallback to terminating NUL std::string linename( line, tabspot ); std::string llinename(linename); LLStringUtil::toLower(llinename); std::string lineval( spacespot + 1, nlspot ); cpuinfo[ llinename ] = lineval; } fclose(cpuinfo_fp); } # if LL_X86 std::string flags = " " + cpuinfo["flags"] + " "; LLStringUtil::toLower(flags); mHasSSE = ( flags.find( " sse " ) != std::string::npos ); mHasSSE2 = ( flags.find( " sse2 " ) != std::string::npos ); F64 mhz; if (LLStringUtil::convertToF64(cpuinfo["cpu mhz"], mhz) && 200.0 < mhz && mhz < 10000.0) { mCPUMhz = (S32)llrint(mhz); } if (!cpuinfo["model name"].empty()) mCPUString = cpuinfo["model name"]; # endif // LL_X86 #endif // LL_LINUX }