Пример #1
0
static void Key_History_Push(void)
{
	if(key_line[1]) // empty?
	if(strcmp(key_line, "]quit")) // putting these into the history just sucks
	if(strncmp(key_line, "]quit ", 6)) // putting these into the history just sucks
		ConBuffer_AddLine(&history, key_line + 1, strlen(key_line) - 1, 0);
	Con_Printf("%s\n", key_line); // don't mark empty lines as history
	history_line = -1;
}
Пример #2
0
static void Key_History_Push(void)
{
	if(key_line[1]) // empty?
	if(strcmp(key_line, "]quit")) // putting these into the history just sucks
	if(strncmp(key_line, "]quit ", 6)) // putting these into the history just sucks
	if(strcmp(key_line, "]rcon_password")) // putting these into the history just sucks
	if(strncmp(key_line, "]rcon_password ", 15)) // putting these into the history just sucks
		ConBuffer_AddLine(&history, key_line + 1, (int)strlen(key_line) - 1, 0);
	Con_Printf("%s\n", key_line); // don't mark empty lines as history
	history_line = -1;
	if (history_matchfound)
		history_matchfound = false;
}
Пример #3
0
static void Key_History_Init(void)
{
	qfile_t *historyfile;
	ConBuffer_Init(&history, HIST_TEXTSIZE, HIST_MAXLINES, zonemempool);

// not necessary for mobile
#ifndef DP_MOBILETOUCH
	historyfile = FS_OpenRealFile("darkplaces_history.txt", "rb", false); // rb to handle unix line endings on windows too
	if(historyfile)
	{
		char buf[MAX_INPUTLINE];
		int bufpos;
		int c;

		bufpos = 0;
		for(;;)
		{
			c = FS_Getc(historyfile);
			if(c < 0 || c == 0 || c == '\r' || c == '\n')
			{
				if(bufpos > 0)
				{
					buf[bufpos] = 0;
					ConBuffer_AddLine(&history, buf, bufpos, 0);
					bufpos = 0;
				}
				if(c < 0)
					break;
			}
			else
			{
				if(bufpos < MAX_INPUTLINE - 1)
					buf[bufpos++] = c;
			}
		}

		FS_Close(historyfile);
	}
#endif

	history_line = -1;
}