MCPcopy Create free account
hub / github.com/JACoders/OpenJK / Cbuf_InsertText

Function Cbuf_InsertText

code/qcommon/cmd.cpp:115–137  ·  view source on GitHub ↗

============ Cbuf_InsertText Adds command text immediately after the current command Adds a \n to the text ============ */

Source from the content-addressed store, hash-verified

113============
114*/
115void Cbuf_InsertText( const char *text ) {
116 int len;
117 int i;
118
119 len = strlen( text ) + 1;
120 if ( len + cmd_text.cursize > cmd_text.maxsize ) {
121 Com_Printf( "Cbuf_InsertText overflowed\n" );
122 return;
123 }
124
125 // move the existing command text
126 for ( i = cmd_text.cursize - 1 ; i >= 0 ; i-- ) {
127 cmd_text.data[ i + len ] = cmd_text.data[ i ];
128 }
129
130 // copy the new text in
131 Com_Memcpy( cmd_text.data, text, len - 1 );
132
133 // add a \n
134 cmd_text.data[ len - 1 ] = '\n';
135
136 cmd_text.cursize += len;
137}
138
139
140/*

Callers 3

Cbuf_ExecuteTextFunction · 0.70
Cmd_Exec_fFunction · 0.70
Cmd_Vstr_fFunction · 0.70

Calls 1

Com_PrintfFunction · 0.70

Tested by

no test coverage detected