Beispiel #1
0
/**
*  @brief
*    Reads memory information from the '/proc/meminfo'-file
*/
bool SystemLinux::GetMemoryInformation(MemoryInformation &sMemoryInformation) const
{
	// Initialize memory information
	sMemoryInformation.nTotalPhysicalMemory	= 0;
	sMemoryInformation.nFreePhysicalMemory	= 0;
	sMemoryInformation.nTotalSwapMemory		= 0;
	sMemoryInformation.nFreeSwapMemory		= 0;

	// Parse kernel information file
	File cFile("/proc/meminfo");
	if (cFile.Open(File::FileRead | File::FileText)) {
		static RegEx cRegEx("^\\s*(MemTotal|MemFree|SwapTotal|SwapFree):\\s*(\\d+).*$");
		while (!cFile.IsEof()) {
			const String sLine = cFile.GetS();
			if (cRegEx.Match(sLine)) {
				const String sName   = cRegEx.GetResult(0);
				const String sResult = cRegEx.GetResult(1);
				if (sName == "MemTotal")
					sMemoryInformation.nTotalPhysicalMemory = sResult.GetInt() * 1024;
				if (sName == "MemFree")
					sMemoryInformation.nFreePhysicalMemory = sResult.GetInt() * 1024;
				if (sName == "SwapTotal")
					sMemoryInformation.nTotalSwapMemory = sResult.GetInt() * 1024;
				if (sName == "SwapFree")
					sMemoryInformation.nFreeSwapMemory = sResult.GetInt() * 1024;
			}
		}

		// Done
		return true;
	}

	// Error!
	return false;
}
Beispiel #2
0
 void extractZip(std::string zipname, std::string target)
 {
     ziputils::unzipper zipFile;
     zipFile.open(zipname.c_str());
     for (std::string filename : zipFile.getFilenames())
     {
         fs::path cDir(target + ((fs::path(filename).parent_path().string() == "") ? "" : "/") + fs::path(filename).parent_path().string());
         fs::path cFile(target + "/" + filename);
         fs::path fillPath;
         for (fs::path pathPart : cDir)
         {
             fillPath /= pathPart;
             if (!exists(fillPath))
             {
                 create_directory(fillPath);
             }
         }
         std::cout << "Opening file : " << filename << std::endl;
         zipFile.openEntry(filename.c_str());
         std::ofstream wFile;
         wFile.open(cFile.string(), std::ios_base::binary | std::ios_base::out);
         std::string dumped = zipFile.dump();
         wFile.write(dumped.c_str(), dumped.size());
         wFile.close();
     }
 }
void Configuration::read() {
	try {
		ConfigFile cFile(m_fileUtility->getFullPath(
			FileUtility::user, "config"
		));

		cFile.readInto(Screen.Width, "screenWidth");
		cFile.readInto(Screen.Height, "screenHeight");
		cFile.readInto(Screen.Color, "screenColor");
		cFile.readInto(Screen.Full, "fullScreen");
		cFile.readInto(FrameDelay, "frameDelay");
		cFile.readInto(ShowFps, "showFps");
		cFile.readInto(AutoReload, "autoReload");
		cFile.readInto(SoundVolume, "soundVolume");
		cFile.readInto(MusicVolume, "musicVolume");
		cFile.readInto(AimColorA, "aimColorA");
		cFile.readInto(AimColorB, "aimColorB");
		cFile.readInto(AutoWeaponPickup, "autoWeaponPickup");
		cFile.readInto(FriendlyFire, "friendlyFire");

		int controlStyle = 0;
		cFile.readInto(controlStyle, "controlStyle");
		Control = violetland::ControlStyleFromInt(controlStyle);

		for (int i = 0; i < InputHandler::GameInputEventsCount; i++) {
			ReadPlayerBinding(&cFile, &PlayerInputBinding[i],
					InputHandler::getEventIdentifier(i));
		}

	} catch (...) {
		std::cout << "Can't open config file." << std::endl;
	}
}
Beispiel #4
0
bool Thread::copyFile(QString sPath,QString tPath)
{

    while(sPath == tPath)
    {
        tPath = changeFileName(tPath);
    }
   QFileInfo fileInfo(sPath);
   QFile cFile(tPath);
   if(cFile.exists())
   {
               cFile.remove();
   }

   if(fileInfo.isDir())
   {
        if(!copyDirectoryFiles(sPath,tPath))
        {
            return false;
        }
   }
   else
   {
        if(!copy(sPath,tPath))
        {
            return false;
        }
   }

   return true;
}
Beispiel #5
0
void CSourceDataGenerator::SaveCharmap(const CharMap &charmap, bool compress, enum OutputFormat format, const wxString &fileName)
{
	wxFileName fileNameInfo(fileName, wxPATH_NATIVE);
	wxString hFilePath, cFilePath;
	if (fileNameInfo.GetExt() == "h") {
		hFilePath = fileName;
		fileNameInfo.SetExt("c");
		if (fileNameInfo.Exists() && wxMessageBox(_("Also the file \"") + fileNameInfo.GetFullName() + 
			_("\" will be generated. Do you want to overwrite it?"), _("Confirm"), wxYES_NO) == wxNO) {
			return;
		}
		cFilePath = fileNameInfo.GetFullPath();
	}
	else if (fileNameInfo.GetExt() == "c") {
		cFilePath = fileName;
		fileNameInfo.SetExt("h");
		if (fileNameInfo.Exists() && wxMessageBox(_("The file \"") + fileNameInfo.GetFullName() +
			_("\" will be generated. Do you want to overwrite it?"), _("Confirm"), wxYES_NO) == wxNO) {
			return;
		}
		hFilePath = fileNameInfo.GetFullPath();
	}
	wxFFileOutputStream hFile(hFilePath);
	wxFFileOutputStream cFile(cFilePath);
	wxTextOutputStream hOut(hFile);
	wxTextOutputStream cOut(cFile);

	EMGL_font_t *font = LoadEMGLFont(charmap, compress, format);

	hOut << GetHeaderFile(fileNameInfo.GetName());
	cOut << GetSourceFile(font, fileNameInfo.GetName());

	DeleteEMGLFont(font);
}
/**
*  @brief
*    Send a file to the client
*/
void HttpServerConnection::SendFile(EHttpStatus nStatus, const String &sFilename)
{
	// Open file
	File cFile(sFilename);
	if (cFile.Open(File::FileRead)) {
		// Send header
		SendHeader(nStatus, MimeTypeManager::GetMimeType(sFilename), cFile.GetSize());

		// Read in chunks of 256 bytes
		char szBuffer[256];
		while (!cFile.IsEof()) {
			// Read from file
			const uint32 nSize = cFile.Read(szBuffer, 1, 255);

			// Send
			if (nSize > 0)
				Send(szBuffer, nSize);
		}

		// Close file
		cFile.Close();

		// Close connection
		Disconnect();
	} else {
		// Error: File not found
		SendError(Http_404_NotFound);
	}
}
Beispiel #7
0
bool OSDImageCache::InFileCache(const QString &key) const
{
    // check if cache file exists
    QDir dir(MythContext::GetConfDir() + "/osdcache/");
    QFileInfo cFile(dir.path() + "/" + key);
    if (!cFile.exists() || !cFile.isReadable())
        return false;

    // check if backing file exists
    QString orig = ExtractOriginal(key);
    if (orig.isEmpty())
        return false;

    QFileInfo oFile(orig);
    if (!oFile.exists())
    {
        VERBOSE(VB_IMPORTANT, LOC + QString("Can't find '%1'").arg(orig));
        return false;
    }

    // if cache file is older than backing file, delete cache file
    if (cFile.lastModified() < oFile.lastModified())
    {
        cFile.dir().remove(cFile.baseName(true));
        return false;
    } 

    return true;
}
Beispiel #8
0
char * findPath(char * command)
{
    int i=0;
    int j=0;
    int pos;
    char * result= "";
    char current[128]= "";
    char * cmd = command;
    char * paths = getenv("PATH");
    //printf("PATHS IS : %s", paths);
    while( paths[i] != '\0')
    {
        if(paths[i] == ':')
        {
            // check current
            current[j] = '/';
            current[j+1] = '\0';
            strcat(current, cmd);
            printf("Checking %s\n", current);
            if( cFile(current) )
            {
                return current;
            }
            j = 0;
            ++i;
        }
        current[j] = paths[i];
        ++j;
        ++i;
    }
}
Beispiel #9
0
void Thread::run()
{
    stopped = false;
    inputFlag = 1;
    stop = true;
    totalSize = 0;
    QStringList text = content.split("\n");
     for(int i = 0;i < text.length(); i++)
     {
         QFile cFile(text[i]);
         QString toPath;
         if(toDirecory[0] != "/")
             toPath = toDirecory[0] + "/" +  text[i].split("/")[text[i].split("/").length() - 1] ;
         else
             toPath = toDirecory[0] +  text[i].split("/")[text[i].split("/").length() - 1] ;

         if(!cFile.exists())
         {
             inputFlag = -2;
             stopped = true;
             return;
         }
        if(!copyFile(text[i],toPath))
        {
            inputFlag = -1;
            stopped = true;
            return;
        }
     }
    stopped = true;
}
Beispiel #10
0
void CBranch_patcherDlg::displayFile( const CString& filename )
{
	CFile cFile( filename, CFile::modeRead );
	EDITSTREAM es;
	es.dwCookie = (DWORD_PTR) &cFile;
	es.pfnCallback = MyStreamInCallback;
	m_Display->StreamIn( SF_TEXT, es );
}
Beispiel #11
0
void CBranch_patcherDlg::saveFile( const CString& filename )
{
	CFile cFile( filename, CFile::modeCreate | CFile::modeWrite );
	EDITSTREAM es;
	es.dwCookie = (DWORD_PTR) &cFile;
	es.pfnCallback = MyStreamOutCallback; 
	m_Display->StreamOut( SF_TEXT, es );
}
Beispiel #12
0
LRESULT CXTPRichRender::SetText(LPCTSTR lpszText)
{
	if (!m_pTextService)
		return 0;

	if (lpszText == 0 || lpszText[0] == 0)
	{
		m_pTextService->TxSetText(L"");
		return 0;
	}

	LRESULT nResult = 0;

	EDITSTREAM es;
	es.pfnCallback = &CXTPRichRender::RichTextCtrlCallbackIn;

	if (lpszText[0] == _T('{'))
	{
	#ifdef _UNICODE
		CXTPResourceManager::CXTPW2A _lpa(lpszText);
		LPSTR lpBuffer = (LPSTR)(LPCSTR)_lpa;
	#else
		LPSTR lpBuffer = (LPSTR)lpszText;
	#endif

		CMemFile cFile((BYTE*)lpBuffer, (UINT)strlen(lpBuffer));
		es.dwCookie = (DWORD_PTR)&cFile;

		m_pTextService->TxSendMessage(EM_STREAMIN, SF_RTF, (LPARAM)&es, &nResult);
		if (nResult > 0)
		{
			return nResult;
		}
	}

	CMemFile cFile((BYTE*)lpszText, (UINT)_tcslen(lpszText) * sizeof(TCHAR));
	es.dwCookie = (DWORD_PTR)&cFile;

	m_pTextService->TxSendMessage(EM_STREAMIN, SF_TEXT | (sizeof(TCHAR) > 1 ? SF_UNICODE : 0), (LPARAM)&es, &nResult);

	return nResult;
}
void Encoder::WriteFile()
{
	CFile cFile(m_strFileName, CFile::modeCreate|CFile::modeReadWrite);
	if(cFile.m_hFile)
	{
		cFile.Write((const void*)m_pBuffer, m_dwBufferOffset);
		cFile.Close();
	}
	else
		AfxMessageBox(_T("Error writing file to disk"), MB_OK|MB_ICONEXCLAMATION);
}
Beispiel #14
0
bool Config::create(QString path)
{
    QDir makeDir;
    makeDir.mkpath(QFileInfo (path).absolutePath());
    QFile cFile(path);
    if (!(cFile.open(QFile::WriteOnly | QFile::Text))) {
        return false;
    }
    configFile = new QFile(QFileInfo(cFile).absoluteFilePath());
    cFile.close();
    return true;
}
	virtual void OnClientLogin() {
		CString sFile = GetArgs();
		CString sBuffer;
		CFile cFile(sFile);
		if (!cFile.Open(O_RDONLY)) {
			m_pClient->PutStatusNotice("Could not open MOTD file");
			return;
		}
		while (cFile.ReadLine(sBuffer))
			m_pClient->PutStatusNotice(sBuffer);
		cFile.Close();
	}
 void CQTOpenGLLuaMainWindow::OpenFile(const QString& str_path) {
    QFile cFile(str_path);
    if(! cFile.open(QFile::ReadOnly | QFile::Text)) {
       QMessageBox::warning(this, tr("ARGoS v" ARGOS_VERSION "-" ARGOS_RELEASE " - Lua Editor"),
                            tr("Cannot read file %1:\n%2.")
                            .arg(str_path)
                            .arg(cFile.errorString()));
       return;
    }
    QApplication::setOverrideCursor(Qt::WaitCursor);
    m_pcCodeEditor->setPlainText(cFile.readAll());
    QApplication::restoreOverrideCursor();
    SetCurrentFile(str_path);
    statusBar()->showMessage(tr("File loaded"), 2000);
 }
 bool CQTOpenGLLuaMainWindow::SaveFile(const QString& str_path) {
    QFile cFile(str_path);
    if(! cFile.open(QFile::WriteOnly | QFile::Text)) {
       QMessageBox::warning(this, tr("ARGoS v" ARGOS_VERSION "-" ARGOS_RELEASE " - Lua Editor"),
                            tr("Cannot write file %1:\n%2.")
                            .arg(str_path)
                            .arg(cFile.errorString()));
       return false;
    }
    QTextStream cOut(&cFile);
    QApplication::setOverrideCursor(Qt::WaitCursor);
    cOut << m_pcCodeEditor->toPlainText();
    QApplication::restoreOverrideCursor();
    SetCurrentFile(str_path);
    statusBar()->showMessage(tr("File saved"), 2000);
    return true;
 }
Beispiel #18
0
uint32 SystemLinux::GetCPUMhz() const
{
	// Initialize
	uint32 nMhz = 0;

	// Parse kernel information file
	File cFile("/proc/cpuinfo");
	if (cFile.Open(File::FileRead | File::FileText)) {
		static RegEx cRegEx("^\\s*cpu MHz\\s*:\\s*(\\d+(\\.\\d+)).*$");
		while (!cFile.IsEof()) {
			const String sLine = cFile.GetS();
			if (cRegEx.Match(sLine)) {
				const String sResult = cRegEx.GetResult(0);
				nMhz = sResult.GetInt();
			}
		}
	}

	// Done
	return nMhz;
}
Beispiel #19
0
QString Thread::changeFileName(QString name)
{
    QFile cFile(name);
    QString baseName;
    QString suffixName;
    QString absolutePath;
    int i = 0;
    while(cFile.exists())
    {
        QFileInfo fileInfo(name);
        baseName = fileInfo.baseName();
        suffixName = fileInfo.completeSuffix();   // return name + fileSuffix;
        absolutePath = fileInfo.absolutePath();
        if(i == 0)
        {
                baseName += "(副本)";
        }
        else if(i == 1)
        {
            baseName = baseName.replace("副本" ,"副本" + QString::number(i));
        }
        else
        {
            baseName = baseName.replace("副本" + QString::number(i -1),"副本" + QString::number(i));
        }
        if(suffixName.isEmpty())
        {
                 name = absolutePath +"/" + baseName;
        }
        else
        {
            name = absolutePath +"/" + baseName + "." +suffixName;
        }
        i++; 
        cFile.setFileName(name);
    }
    return name ;
}
ECallbackResult CLoadAgent::OnCheckLoad(SLoadInfo* pLoadInfo)
{
	CEditDoc* pcDoc = GetListeningDoc();

	// リロード要求の場合は、継続。
	if(pLoadInfo->bRequestReload)goto next;

	//フォルダが指定された場合は「ファイルを開く」ダイアログを表示し、実際のファイル入力を促す
	if( IsDirectory(pLoadInfo->cFilePath) ){
		std::vector<std::tstring> files;
		SLoadInfo sLoadInfo(_T(""), CODE_AUTODETECT, false);
		bool bDlgResult = pcDoc->m_cDocFileOperation.OpenFileDialog(
			CEditWnd::getInstance()->GetHwnd(),
			pLoadInfo->cFilePath,	//指定されたフォルダ
			&sLoadInfo,
			files
		);
		if( !bDlgResult ){
			return CALLBACK_INTERRUPT; //キャンセルされた場合は中断
		}
		size_t nSize = files.size();
		if( 0 < nSize ){
			sLoadInfo.cFilePath = files[0].c_str();
			// 他のファイルは新規ウィンドウ
			for( size_t i = 1; i < nSize; i++ ){
				SLoadInfo sFilesLoadInfo = sLoadInfo;
				sFilesLoadInfo.cFilePath = files[i].c_str();
				CControlTray::OpenNewEditor(
					G_AppInstance(),
					CEditWnd::getInstance()->GetHwnd(),
					sFilesLoadInfo,
					NULL,
					true
				);
			}
		}
		*pLoadInfo = sLoadInfo;
	}

	// 他のウィンドウで既に開かれている場合は、それをアクティブにする
	HWND	hWndOwner;
	if( CShareData::getInstance()->ActiveAlreadyOpenedWindow(pLoadInfo->cFilePath, &hWndOwner, pLoadInfo->eCharCode) ){
		pLoadInfo->bOpened = true;
		return CALLBACK_INTERRUPT;
	}

	// 現在のウィンドウに対してファイルを読み込めない場合は、新たなウィンドウを開き、そこにファイルを読み込ませる
	if(!pcDoc->IsAcceptLoad()){
		CControlTray::OpenNewEditor(
			G_AppInstance(),
			CEditWnd::getInstance()->GetHwnd(),
			*pLoadInfo
		);
		return CALLBACK_INTERRUPT;
	}

next:
	// オプション:開こうとしたファイルが存在しないとき警告する
	if( GetDllShareData().m_Common.m_sFile.GetAlertIfFileNotExist() ){
		if(!fexist(pLoadInfo->cFilePath)){
			InfoBeep();
			//	Feb. 15, 2003 genta Popupウィンドウを表示しないように.
			//	ここでステータスメッセージを使っても画面に表示されない.
			TopInfoMessage(
				CEditWnd::getInstance()->GetHwnd(),
				LS(STR_NOT_EXSIST_SAVE),	//Mar. 24, 2001 jepro 若干修正
				pLoadInfo->cFilePath.GetBufferPointer()
			);
		}
	}

	// 読み取り可能チェック
	do{
		CFile cFile(pLoadInfo->cFilePath.c_str());

		//ファイルが存在しない場合はチェック省略
		if(!cFile.IsFileExist())break;

		// ロックは一時的に解除してチェックする(チェックせずに後戻りできないところまで進めるより安全)
		// ※ ロックしていてもアクセス許可の変更によって読み取れなくなっていることもある
		bool bLock = (pLoadInfo->IsSamePath(pcDoc->m_cDocFile.GetFilePath()) && pcDoc->m_cDocFile.IsFileLocking());
		if( bLock ) pcDoc->m_cDocFileOperation.DoFileUnlock();

		//チェック
		if(!cFile.IsFileReadable()){
			if( bLock ) pcDoc->m_cDocFileOperation.DoFileLock(false);
			ErrorMessage(
				CEditWnd::getInstance()->GetHwnd(),
				LS(STR_LOADAGENT_ERR_OPEN),
				pLoadInfo->cFilePath.c_str()
			);
			return CALLBACK_INTERRUPT; //ファイルが存在しているのに読み取れない場合は中断
		}
		if( bLock ) pcDoc->m_cDocFileOperation.DoFileLock(false);
	}
	while(false);	//	1回しか通らない. breakでここまで飛ぶ

	// ファイルサイズチェック
	if( GetDllShareData().m_Common.m_sFile.m_bAlertIfLargeFile ){
		WIN32_FIND_DATA wfd;
		HANDLE nFind = ::FindFirstFile( pLoadInfo->cFilePath.c_str(), &wfd );
		if( nFind != INVALID_HANDLE_VALUE ){
			::FindClose( nFind );
			LARGE_INTEGER nFileSize;
			nFileSize.HighPart = wfd.nFileSizeHigh;
			nFileSize.LowPart = wfd.nFileSizeLow;
			// GetDllShareData().m_Common.m_sFile.m_nAlertFileSize はMB単位
			if( (nFileSize.QuadPart>>20) >= (GetDllShareData().m_Common.m_sFile.m_nAlertFileSize) ){
				int nRet = MYMESSAGEBOX( CEditWnd::getInstance()->GetHwnd(),
					MB_ICONQUESTION | MB_YESNO | MB_TOPMOST,
					GSTR_APPNAME,
					LS(STR_LOADAGENT_BIG_FILE),
					GetDllShareData().m_Common.m_sFile.m_nAlertFileSize );
				if( nRet != IDYES ){
					return CALLBACK_INTERRUPT;
				}
			}
		}
Beispiel #21
0
int main(int argc, char *argv[], char *env[])
{
    int pid=0;
    int status=0;
    char * file = NULL;
    char * cmd= NULL;
    char * current = NULL;
    int i=0;

    current = getenv("PWD");
    while(1)
    {
        getcwd(current, 128);
        printf("~%s~: ", current );
        //freeMyPeople();
        getInput();
        if(myargv == NULL || myargv[0] == '\0')
        {

        }else{
        //printf("After get input argc is: %d", argc);
        cmd = myargv[0];

        if( strcmp(cmd, "cd") == 0)
        {
            cd();
        }else if ( strcmp(cmd, "exit") == 0 )
        {
            exit(EXIT_SUCCESS);
        }else
        {
            // Creating a child
            pid = fork();

            if( pid != 0) // parent
            {
                pid = wait(&status);
                printf("\nDEAD CHILD=%d, HOW=%d\n\n", pid, status);
            }
            else
            {
                // Searching for command
                if( cmd[0] == '/')
                {
                    myargv[0] = strrchr(myargv[0] , '/') + 1;
                    if( cFile(cmd) )
                    {
                        file = &cmd[0];
                    }else
                    {
                        file = findPath(myargv[0]);
                    }
                }else{
                    file = findPath(cmd);
                }
                // Outputs
                printf("\nThis is child!\nI'm gonna run %s\t#ARGS: %d\n\n", file, argc);
                i = 0;

                while(myargv[i] != NULL)
                {
                    printf("arguement %d %s \n", i ,myargv[i]);
                    ++i;
                }

                // Checking for IO Redirects
                if( OUT[0] != 0 )
                {   // Redirect Out
                    strcat(current, "/");
                    strcat(current, OUT);
                    printf("OUT: %s Current: %s\n", OUT ,current);
                    close(1);   // close stdOut
                    //fclose(stdout);
                    open( current, O_WRONLY | O_CREAT, 0644 );
                }else if( APP[0] != 0)
                {
                    strcat(current, "/");
                    strcat(current, APP);
                    printf("APPENDING: %s Current: %s\n", APP ,current);
                    close(1);   // close stdOut
                    //fclose(stdout);
                    open( current, O_WRONLY| O_APPEND, 0644 );
                }

                if( IN[0] != 0 )
                {   // Redirect In
                    strcat(current, "/");
                    strcat(current, IN);
                    printf("Changing input to file: %s", IN);
                    //close(0);   // close stdin
                    fclose(stdin);
                    open( current, O_RDONLY );
                }
                execve( file , myargv , env );
            }
        }

        // Free the variables
        freeMyPeople();
        }
    }
    return 0;
}
Beispiel #22
0
int main (int argc, char* argv[]) {
	// int 	oldtime, newtime; // bk001204 - unused
	int   len, i;
	char  *cmdline;
	//jens	void Sys_SetDefaultCDPath(const char *path);

	thread_id cThread;
	cThread = spawn_thread(appthread, "q3appthread", B_LOW_PRIORITY, 0);
	resume_thread(cThread);
	snooze(100000); //Todo

	app_info cInfo;
	be_app->GetAppInfo(&cInfo);
	BEntry cFile(&cInfo.ref);
	BEntry cDir;
	cFile.GetParent(&cDir);
	BPath cPath;
	cDir.GetPath(&cPath);
	chdir(cPath.Path());

	be_app->HideCursor();
	// go back to real user for config loads
	//jens	saved_euid = geteuid();
	//jens	seteuid(getuid());

	Sys_ParseArgs(argc, argv);  // bk010104 - added this for support

	Sys_SetDefaultCDPath(argv[0]);

	// merge the command line, this is kinda silly
	for (len = 1, i = 1; i < argc; i++)
		len += strlen(argv[i]) + 1;
	cmdline = (char*)malloc(len);
	*cmdline = 0;
	for (i = 1; i < argc; i++) {
		if (i > 1)
			strcat(cmdline, " ");
		strcat(cmdline, argv[i]);
	}

	// bk000306 - clear queues
	memset(&eventQue[0], 0, MAX_QUED_EVENTS*sizeof(sysEvent_t) ); 
	memset(&sys_packetReceived[0], 0, MAX_MSGLEN*sizeof(byte) );

	Com_Init(cmdline);
	NET_Init();

	Sys_ConsoleInputInit();

//	int fd = 0;
//	fd = fileno(stdin);
//	int on = 1;
//	setsockopt(fd, SOL_SOCKET, SO_NONBLOCK, &on, sizeof(int));
//	setsockopt(STDIN_FILENO, SOL_SOCKET, SO_NONBLOCK, &on, sizeof(int));

	//jensfcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);

#ifdef DEDICATED
	// init here for dedicated, as we don't have GLimp_Init
	//jens	InitSig();
#endif

	while (1) {
#ifdef __linux__
		Sys_ConfigureFPU();
#endif
		Com_Frame ();
	}
}