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

Function Cbuf_InsertText

codemp/qcommon/cmd.cpp:117–139  ·  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

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

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