Beispiel #1
0
/** Adds text into the command buffer for later execution.
  *
  * \param ptext The text to add.
  * \sa COM_BufInsertText
  */
void COM_BufAddText(const char *ptext)
{
	size_t l;

	l = strlen(ptext);

	if (com_text.cursize + l >= com_text.maxsize)
	{
		CONS_Printf("Command buffer full!\n");
		return;
	}
	VS_Write(&com_text, ptext, l);
}
Beispiel #2
0
/** Adds text into the command buffer for later execution.
  *
  * \param ptext The text to add.
  * \sa COM_BufInsertText
  */
void COM_BufAddText(const char *ptext)
{
	size_t l;

	l = strlen(ptext);

	if (com_text.cursize + l >= com_text.maxsize)
	{
		CONS_Alert(CONS_WARNING, M_GetText("Command buffer full!\n"));
		return;
	}
	VS_Write(&com_text, ptext, l);
}
Beispiel #3
0
/** Adds command text and executes it immediately.
  *
  * \param ptext The text to execute. A newline is automatically added.
  * \sa COM_BufAddText
  */
void COM_BufInsertText(const char *ptext)
{
	char *temp = NULL;
	size_t templen;

	// copy off any commands still remaining in the exec buffer
	templen = com_text.cursize;
	if (templen)
	{
		temp = M_Memcpy(ZZ_Alloc(templen), com_text.data, templen);
		VS_Clear(&com_text);
	}

	// add the entire text of the file (or alias)
	COM_BufAddText(ptext);
	COM_BufExecute(); // do it right away

	// add the copied off data
	if (templen)
	{
		VS_Write(&com_text, temp, templen);
		Z_Free(temp);
	}
}