+/*
+============
+Cmd_ExecuteAlias
+
+Called for aliases and fills in the alias into the cbuffer
+============
+*/
+static void Cmd_ExecuteAlias (cmdalias_t *alias)
+{
+ const char *text = alias->value;
+
+ while( COM_ParseTokenConsole( &text ) )
+ {
+ Cbuf_AddText( "\"" );
+
+ if( com_token[0] == '$' )
+ {
+ int argNum;
+ argNum = atoi( &com_token[1] );
+
+ // no number at all?
+ if( argNum == 0 )
+ {
+ Cbuf_AddText( com_token );
+ }
+ else if( argNum >= Cmd_Argc() )
+ {
+ Con_Printf( "Warning: Not enough parameters passed to alias '%s', at least %i expected:\n %s\n", alias->name, argNum, alias->value );
+ Cbuf_AddText( com_token );
+ }
+ else
+ {
+ Cbuf_AddText( Cmd_Argv( argNum ) );
+ }
+ }
+ else
+ {
+ Cbuf_AddText( com_token );
+ }
+
+ Cbuf_AddText( "\"" );
+ }
+ Cbuf_AddText( "\n" );
+}
+