/* =============== Cmd_Vstr_f Inserts the current value of a variable as command text =============== */ void Cmd_Vstr_f( void ) { char *v; if (Cmd_Argc () != 2) { Com_Printf ("vstr <variablename> : execute a variable command\n"); return; } v = Cvar_VariableString( Cmd_Argv( 1 ) ); Cbuf_InsertText( va("%s\n", v ) ); }
/* ============ Cmd_ExecuteString A complete command line has been parsed, so try to execute it FIXME: lookupnoadd the token to speed search? ============ */ void Cmd_ExecuteString(const char * text) { extern void Cmd_ForwardToServer(void); cmd_function_t * cmd; cmdalias_t * a; Cmd_TokenizeString(text, true); // execute the command line if (!Cmd_Argc()) return; // no tokens // check functions for (cmd = cmd_functions; cmd; cmd = cmd->next) { if (!Q_strcasecmp(cmd_argv[0], cmd->name)) { if (!cmd->function) { // forward to server command Cmd_ExecuteString(va("cmd %s", text)); } else { cmd->function(); } return; } } // check alias for (a = cmd_alias; a; a = a->next) { if (!Q_strcasecmp(cmd_argv[0], a->name)) { if (++alias_count == ALIAS_LOOP_COUNT) { Com_Printf("ALIAS_LOOP_COUNT\n"); return; } Cbuf_InsertText(a->value); return; } } // check cvars if (Cvar_Command()) return; // send it as a server command if we are connected Cmd_ForwardToServer(); }
/* ============ Cmd_ExecuteString A complete command line has been parsed, so try to execute it ============ */ void Cmd_ExecuteString( char *text, cmd_source_t src ) { qboolean isServerCommand = false; qboolean isDLLCommand = false; cmd_function_t *cmd; cmdalias_t *a; // set cmd source cmd_source = src; // execute the command line Cmd_TokenizeString( text ); if( !Cmd_Argc()) return; // no tokens // check alias for( a = cmd_alias; a; a = a->next ) { if( !Q_stricmp( cmd_argv[0], a->name )) { Cbuf_InsertText( a->value ); return; } } // check functions for( cmd = cmd_functions; cmd; cmd = cmd->next ) { if( cmd && !Q_stricmp( cmd_argv[0], cmd->name ) && cmd->function ) { cmd->function(); return; } } // check cvars if( Cvar_Command( )) return; // forward the command line to the server, so the entity DLL can parse it if( cmd_source == src_command && host.type == HOST_NORMAL ) { if( cls.state >= ca_connected ) { Cmd_ForwardToServer(); return; } } else if( text[0] != '@' && host.type == HOST_NORMAL ) { // commands with leading '@' are hidden system commands MsgDev( D_INFO, "Unknown command \"%s\"\n", text ); } }
/** * @brief A complete command line has been parsed, so try to execute it * @todo lookupnoadd the token to speed search? */ void Cmd_ExecuteString (const char *text) { const cmd_function_t *cmd; const cmd_alias_t *a; const char *str; unsigned int hash; Com_DPrintf(DEBUG_COMMANDS, "ExecuteString: '%s'\n", text); Cmd_TokenizeString(text, qtrue); /* execute the command line */ if (!Cmd_Argc()) /* no tokens */ return; str = Cmd_Argv(0); /* check functions */ hash = Com_HashKey(str, CMD_HASH_SIZE); for (cmd = cmd_functions_hash[hash]; cmd; cmd = cmd->hash_next) { if (!Q_strcasecmp(str, cmd->name)) { if (!cmd->function) { /* forward to server command */ Cmd_ExecuteString(va("cmd %s", text)); } else { cmd_userdata = cmd->userdata; cmd->function(); } return; } } /* check alias */ hash = Com_HashKey(str, ALIAS_HASH_SIZE); for (a = cmd_alias_hash[hash]; a; a = a->hash_next) { if (!Q_strcasecmp(str, a->name)) { if (++alias_count == ALIAS_LOOP_COUNT) { Com_Printf("ALIAS_LOOP_COUNT\n"); return; } Cbuf_InsertText(a->value); return; } } /* check cvars */ if (Cvar_Command()) return; /* send it as a server command if we are connected */ Cmd_ForwardToServer(); }
/* =============== Cmd_Vstr_f Inserts the current value of a variable as command text =============== */ void Cmd_Vstr_f( void ) { char *v; char buf[MAX_STRING_CHARS]; if (Cmd_Argc () != 2) { Com_Printf ("vstr <variablename> : execute a variable command\n"); return; } v = Cvar_VariableString( Cmd_Argv( 1 ) ); Com_sprintf(buf, sizeof(buf), "%s", v); Cbuf_InsertText( buf ); }
/* =============== Cmd_If_f Compares two values, if true executes the third argument, if false executes the forth =============== */ void Cmd_If_f( void ) { char *v; int v1; int v2; char *vt; char *vf; char *op; if ( (Cmd_Argc () == 6 ) || (Cmd_Argc () == 5) ) { v1 = atoi( Cmd_Argv( 1 ) ); op = Cmd_Argv( 2 ); v2 = atoi( Cmd_Argv( 3 ) ); vt = Cmd_Argv( 4 ); if ( ( !strcmp( op, "=" ) && v1 == v2 ) || ( !strcmp( op, "!=" ) && v1 != v2 ) || ( !strcmp( op, "<" ) && v1 < v2 ) || ( !strcmp( op, "<=" ) && v1 <= v2 ) || ( !strcmp( op, ">" ) && v1 > v2 ) || ( !strcmp( op, ">=" ) && v1 >= v2 ) ) { v = vt; } else if ( ( !strcmp( op, "=" ) && v1 != v2 ) || ( !strcmp( op, "!=" ) && v1 == v2 ) || ( !strcmp( op, "<" ) && v1 >= v2 ) || ( !strcmp( op, "<=" ) && v1 > v2 ) || ( !strcmp( op, ">" ) && v1 <= v2 ) || ( !strcmp( op, ">=" ) && v1 < v2 ) ) { if ( Cmd_Argc () == 6 ) { vf = Cmd_Argv( 5 ); v = vf; } else { return; } } else { Com_Printf ("invalid operator in if command. valid operators are = != < > >= <=\n"); return; } } else { Com_Printf ("if <value1> <operator> <value2> <cmdthen> (<cmdelse>) : compares the first two values and executes <cmdthen> if true, <cmdelse> if false\n"); return; } Cbuf_InsertText( va("vstr %s\n", v ) ); }
/* =============== Cmd_Vstr_f Inserts the current value of a variable as command text =============== */ void Cmd_Vstr_f( void ) { const char *v; char buf[MAX_CMD_LINE]; char c_str[1024]; if (Cmd_Argc () != 2) { Com_Printf ("vstr <variablename> : execute a variable command\n"); return; } v = Cvar_VariableStringBuffer( Cmd_Argv( 1 ), c_str, sizeof(c_str) ); Com_sprintf(buf, sizeof(buf), "%s", v); Cbuf_InsertText( buf ); }
/* =============== Host_Exec_f =============== */ void Host_Exec_f( void ) { string cfgpath; char *f; if( Cmd_Argc() != 2 ) { Msg( "Usage: exec <filename>\n" ); return; } // HACKHACK: don't execute listenserver.cfg in singleplayer if( !Q_stricmp( Cvar_VariableString( "lservercfgfile" ), Cmd_Argv( 1 ))) { if( Cvar_VariableValue( "maxplayers" ) == 1.0f ) return; } Q_strncpy( cfgpath, Cmd_Argv( 1 ), sizeof( cfgpath )); FS_DefaultExtension( cfgpath, ".cfg" ); // append as default f = (char *)FS_LoadFile( cfgpath, NULL, false ); if( !f ) { MsgDev( D_NOTE, "couldn't exec %s\n", Cmd_Argv( 1 )); return; } MsgDev( D_INFO, "execing %s\n", Cmd_Argv( 1 )); // terminate the string with newline just in case it's missing // insertion order is backwards from execution order Cbuf_InsertText( "\n" ); Cbuf_InsertText( f ); Mem_Free( f ); }
static void Cmd_Runalias_f (void) { cmdalias_t *a; a = (cmdalias_t *) Hash_Find (cmd_alias_hash, Cmd_Argv (0)); if (a) { Cbuf_InsertText (cbuf_active, a->value); return; } else { Sys_Printf ("BUG: No alias found for registered command. Please report this to the QuakeForge development team."); } }
/* ============ Cmd_ExecuteString A complete command line has been parsed, so try to execute it FIXME: lookupnoadd the token to speed search? ============ */ void Cmd_ExecuteString (char *text) { cmd_function_t *cmd; cmdalias_t *a; Cmd_TokenizeString (text); // execute the command line if (!Cmd_Argc()) return; // no tokens // check functions for (cmd=cmd_functions ; cmd ; cmd=cmd->next) { if (!Q_strcasecmp (cmd_argv[0],cmd->name)) { if (!strcmp(cmd->name, "kill")) { if ((trace_state == read_trace || trace_state == write_trace)) { trace_state = stop_trace; printf("GAJA: command = kill\n"); } } if (!cmd->function) Cmd_ForwardToServer (); else cmd->function (); return; } } // check alias for (a=cmd_alias ; a ; a=a->next) { if (!Q_strcasecmp (cmd_argv[0], a->name)) { Cbuf_InsertText (a->value); return; } } // check cvars if (!Cvar_Command () && (cl_warncmd.value || developer.value)) Con_Printf ("Unknown command \"%s\"\n", Cmd_Argv(0)); }
/* =============== Cmd_StuffCmds_f Adds command line parameters as script statements Commands lead with a +, and continue until a - or another + xash +prog jctest.qp +cmd amlev1 xash -nosound +cmd amlev1 =============== */ void Cmd_StuffCmds_f( void ) { int i, j, l = 0; char build[MAX_MSGLEN]; // this is for all commandline options combined (and is bounds checked) if(Cmd_Argc() != 1) { Msg( "stuffcmds : execute command line parameters\n"); return; } // no reason to run the commandline arguments twice if(Sys.stuffcmdsrun) return; Sys.stuffcmdsrun = true; build[0] = 0; for (i = 0; i < fs_argc; i++) { if (fs_argv[i] && fs_argv[i][0] == '+' && (fs_argv[i][1] < '0' || fs_argv[i][1] > '9') && l + strlen(fs_argv[i]) - 1 <= sizeof(build) - 1) { j = 1; while (fs_argv[i][j]) build[l++] = fs_argv[i][j++]; i++; for ( ; i < fs_argc; i++) { if (!fs_argv[i]) continue; if ((fs_argv[i][0] == '+' || fs_argv[i][0] == '-') && (fs_argv[i][1] < '0' || fs_argv[i][1] > '9')) break; if (l + strlen(fs_argv[i]) + 4 > sizeof(build) - 1) break; build[l++] = ' '; if (strchr(fs_argv[i], ' ')) build[l++] = '\"'; for (j = 0; fs_argv[i][j]; j++) build[l++] = fs_argv[i][j]; if (strchr(fs_argv[i], ' ')) build[l++] = '\"'; } build[l++] = '\n'; i--; } } // now terminate the combined string and prepend it to the command buffer // we already reserved space for the terminator build[l++] = 0; Cbuf_InsertText( build ); }
/* ============ Cbuf_ExecuteText ============ */ void Cbuf_ExecuteText (int exec_when, char *text) { switch (exec_when) { case EXEC_NOW: Cmd_ExecuteString (text); break; case EXEC_INSERT: Cbuf_InsertText (text); break; case EXEC_APPEND: Cbuf_AddText (text); break; default: Com_Error (ERR_FATAL, "Cbuf_ExecuteText: bad exec_when"); } }
/* ============ Cmd_RunAlias_f ============ */ void Cmd_RunAlias_f(void) { cmd_alias_t *alias; char *name = Cmd_Argv(0); char *args = Cmd_ArgsFrom(1); // Find existing alias for (alias = cmd_aliases; alias; alias=alias->next) { if (!Q_stricmp( name, alias->name )) break; } if (!alias) Com_Error(ERR_FATAL, "Alias: Alias %s doesn't exist", name); Cbuf_InsertText(va("%s %s", alias->exec, args)); }
static const char *Keys_MenuKey( int key ) { menuaction_s *item = ( menuaction_s * ) Menu_ItemAtCursor( &s_keys_menu ); //pressing mouse1 to pick a new bind wont force bind/unbind itself - spaz if ( bind_grab && !(cursor.buttonused[MOUSEBUTTON1]&&key==K_MOUSE1)) { if ( key != K_ESCAPE && key != '`' ) { char cmd[1024]; Com_sprintf (cmd, sizeof(cmd), "bind \"%s\" \"%s\"\n", Key_KeynumToString(key), bindnames[item->generic.localdata[0]][0]); Cbuf_InsertText (cmd); } // Knightmare- added Psychospaz's mouse support //dont let selecting with mouse buttons screw everything up UI_RefreshCursorButtons(); if (key==K_MOUSE1) cursor.buttonclicks[MOUSEBUTTON1] = -1; //Menu_SetStatusBar( &s_keys_menu, "enter to change, backspace to clear" ); Menu_SetStatusBar( &s_keys_menu, "Press ENTER or LEFT CLICK to change the key. Press BACKSPACE to clear." ); bind_grab = false; return menu_out_sound; } switch ( key ) { case K_KP_ENTER: case K_ENTER: if (item == &s_keys_back_action) { // back action hack UI_BackMenu(item); return NULL; } KeyBindingFunc( item ); return menu_in_sound; case K_BACKSPACE: // delete bindings case K_DEL: // delete bindings case K_KP_DEL: M_UnbindCommand( bindnames[item->generic.localdata[0]][0] ); return menu_out_sound; default: return Default_MenuKey( &s_keys_menu, key ); } }
/* =============== Cmd_ExecFile =============== */ static void Cmd_ExecFile( char *f ) { int i; COM_Compress (f); Cvar_Get( "arg_all", Cmd_ArgsFrom(2), CVAR_TEMP | CVAR_ROM | CVAR_USER_CREATED, "" ); Cvar_Set( "arg_all", Cmd_ArgsFrom(2) ); Cvar_Get( "arg_count", va( "%i", Cmd_Argc() - 2 ), CVAR_TEMP | CVAR_ROM | CVAR_USER_CREATED, "" ); Cvar_Set( "arg_count", va( "%i", Cmd_Argc() - 2 ) ); for (i = Cmd_Argc() - 2; i; i--) { Cvar_Get( va("arg_%i", i), Cmd_Argv( i + 1 ), CVAR_TEMP | CVAR_ROM | CVAR_USER_CREATED, "" ); Cvar_Set( va("arg_%i", i), Cmd_Argv( i + 1 ) ); } Cbuf_InsertText (f); }
/* =============== Cmd_Strcmp_f Compares two strings, if true executes the third argument, if false executes the forth =============== */ void Cmd_Strcmp_f( void ) { char *v; char *v1; char *v2; char *vt; char *vf; char *op; if ( (Cmd_Argc () == 6 ) || (Cmd_Argc () == 5) ) { v1 = Cmd_Argv( 1 ); op = Cmd_Argv( 2 ); v2 = Cmd_Argv( 3 ); vt = Cmd_Argv( 4 ); if ( ( !strcmp( op, "=" ) && !strcmp( v1, v2 ) ) || ( !strcmp( op, "!=" ) && strcmp( v1, v2 ) ) ) { v = vt; } else if ( ( !strcmp( op, "=" ) && strcmp( v1, v2 ) ) || ( !strcmp( op, "!=" ) && !strcmp( v1, v2 ) ) ) { if ( Cmd_Argc () == 6 ) { vf = Cmd_Argv( 5 ); v = vf; } else { return; } } else { Com_Printf ("invalid operator in strcmp command. valid operators are = != \n"); return; } } else { Com_Printf ("strcmp <string1> <operator> <string2> <cmdthen> (<cmdelse>) : compares the first two strings and executes <cmdthen> if true, <cmdelse> if false\n"); return; } Cbuf_InsertText( va("%s\n", v ) ); }
/* ================== SV_ParseStringCommand Client command string ================== */ void SV_ParseStringCommand(client_t *cl) { char *s; int ret; s = MSG_ReadString(); // Determine whether the command is appropriate ret = SV_ValidateClientCommand( s ); switch ( ret ) { case 2: Cbuf_InsertText (s); break; case 1: Cmd_ExecuteString (s, src_client); break; default: Cmd_TokenizeString(s); ConCommandBase const *pCommand = ConCommandBase::FindCommand( Cmd_Argv( 0 ) ); if ( pCommand && pCommand->IsCommand() && pCommand->IsBitSet( FCVAR_EXTDLL ) ) { // Allow cheat commands in singleplayer, debug, or multiplayer with sv_cheats on #ifndef _DEBUG if ( pCommand->IsBitSet( FCVAR_CHEAT ) ) { if ( svs.maxclients > 1 && sv_cheats.GetInt() == 0 ) break; } #endif serverGameClients->SetCommandClient( host_client - svs.clients ); ( ( ConCommand * )pCommand )->Dispatch(); } else { serverGameClients->ClientCommand( sv_player ); } break; } }
/* ==================== SV_Init ==================== */ void SV_Init (void) { Sys_Printf ("Host_Init\n"); Memory_Init (host_parms->membase, host_parms->memsize); Cbuf_Init (); Cmd_Init (); COM_Init (); FS_Init (); PR_Init (); Mod_Init (); SV_InitNet (); SV_InitLocal (); Pmove_Init (); Hunk_AllocName (0, "-HOST_HUNKLEVEL-"); host_hunklevel = Hunk_LowMark (); Cbuf_InsertText ("exec server.cfg\n"); Cbuf_Execute (); // unlock the early-set cvars after init Cvar_UnlockAll (); host_initialized = true; Con_Printf ("Exe: "__TIME__" "__DATE__"\n"); Con_Printf ("%4.1f megabyte heap\n", host_parms->memsize/(1024*1024.0)); Con_Printf ("======== HexenWorld Initialized ========\n"); // process command line arguments Cmd_StuffCmds_f (); Cbuf_Execute (); // if a map wasn't specified on the command line, spawn demo1.map if (sv.state == ss_dead) Cmd_ExecuteString ("map demo1", src_command); if (sv.state == ss_dead) SV_Error ("Couldn't spawn a server"); }
/* ============ Cbuf_ExecuteText ============ */ void Cbuf_ExecuteText( int exec_when, const char *text ) { switch ( exec_when ) { case EXEC_NOW: if ( text && strlen( text ) > 0 ) { Cmd_ExecuteString( text ); } else { Cbuf_Execute(); } break; case EXEC_INSERT: Cbuf_InsertText( text ); break; case EXEC_APPEND: Cbuf_AddText( text ); break; default: Com_Error( ERR_FATAL, "Cbuf_ExecuteText: bad exec_when" ); } }
/* ============ Cbuf_ExecuteText ============ */ void Cbuf_ExecuteText( int exec_when, const char *text ) { switch( exec_when ) { case EXEC_NOW: if( text && com.strlen( text )) Cmd_ExecuteString( text ); else Cbuf_Execute(); break; case EXEC_INSERT: Cbuf_InsertText( text ); break; case EXEC_APPEND: Cbuf_AddText( text ); break; default: MsgDev( D_ERROR, "Cbuf_ExecuteText: bad execute target\n" ); break; } }
/* ----------------------------------------------------------------------------- Function: Cbuf_ExecuteText -Execute string. Parameters: exec_when -[in] see execwhen_t definition. text -[in] string with command to execute. Returns: Notes: ----------------------------------------------------------------------------- */ PUBLIC void Cbuf_ExecuteText( execwhen_t exec_when, char *text ) { switch( exec_when ) { case EXEC_NOW: Cmd_ExecuteString( text ); break; case EXEC_INSERT: Cbuf_InsertText( text ); break; case EXEC_APPEND: Cbuf_AddText( text ); break; default: Com_DPrintf( "Cbuf_ExecuteText: bad exec_when" ); } }
/* ** Start next demo in loop */ void CL_NextDemo (void) { if (!cls.playdemos) return; cls.demonum++; if (cls.demonum >= MAX_DEMOS || !cls.demos[cls.demonum][0]) { if (cls.playdemos == 2) cls.demonum = 0; // start again else { // stop demo loop cls.playdemos = 0; return; } } SCR_BeginLoadingPlaque (); // ok to call here? Cbuf_InsertText (va("playdemo \"%s\"\n", cls.demos[cls.demonum])); }
//cbase //These last few functions are the highest level wrappers. int Init(char * path, char * argv) { char temp[0x100]; if(TestStructureAlignment() == 0) { return(0); } Sys_InitArgv(argv); if(FileSystem_Init(path) == 0) { return(0); } if(Sys_InitGame() == 0) { return(0); } Q_snprintf(temp, sizeof(temp)-1, "exec %s\n", cvar_servercfgfile.string); temp[sizeof(temp)-1] = '\0'; Cbuf_InsertText(temp); #ifdef USE_timeGetTime timeBeginPeriod(1); #endif return(1); }
void EXT_FUNC Cmd_ExecuteString_internal(const char* cmdName, cmd_source_t src, IGameClient* client) { // Search in functions cmd_function_t *cmd = cmd_functions; while (cmd) { if (!Q_stricmp(cmd_argv[0], cmd->name)) { cmd->function(); if (g_pcls.demorecording && (cmd->flags & FCMD_HUD_COMMAND) && !g_pcls.spectator) { CL_RecordHUDCommand(cmd->name); } return; } cmd = cmd->next; } // Search in aliases cmdalias_t *a = cmd_alias; while (a) { if (!Q_stricmp(cmd_argv[0], a->name)) { Cbuf_InsertText(a->value); return; } a = a->next; } // Search in cvars if (!Cvar_Command() && g_pcls.state >= ca_connected) { // Send to a server if nothing processed locally and connected Cmd_ForwardToServer(); } }
// don't forward the first argument static void CL_Cmd_ForwardToServer_f (void) { if (cls.state == ca_disconnected) { Sys_Printf ("Can't \"%s\", not connected\n", Cmd_Argv (0)); return; } if (strcasecmp (Cmd_Argv (1), "snap") == 0) { Cbuf_InsertText (cl_cbuf, "snap\n"); return; } if (cls.demoplayback) return; // not really connected if (Cmd_Argc () > 1) { MSG_WriteByte (&cls.netchan.message, clc_stringcmd); SZ_Print (&cls.netchan.message, Cmd_Args (1)); } }
/* ============== SV_Save_f ============== */ void SV_Save_f( void ) { const char *name; switch( Cmd_Argc() ) { case 1: name = "new"; break; case 2: name = Cmd_Argv( 1 ); break; default: Msg( "Usage: save <savename>\n" ); return; } if( host_xashds_hacks->value ) { Cbuf_InsertText(va("rcon save %s\n", Cmd_Argv( 1 ))); return; } SV_SaveGame( name ); }
/** * Called to play the next demo in the demo loop */ void CL_NextDemo(void) { char str[1024]; if (cls.demonum == -1) return; // don't play demos SCR_BeginLoadingPlaque(); if (!cls.demos[cls.demonum][0] || cls.demonum == MAX_DEMOS) { cls.demonum = 0; if (!cls.demos[cls.demonum][0]) { Con_Printf("No demos listed with startdemos\n"); cls.demonum = -1; return; } } sprintf(str, "playdemo %s\n", cls.demos[cls.demonum]); Cbuf_InsertText(str); cls.demonum++; }
/* ===================== CL_NextDemo Called to play the next demo in the demo loop ===================== */ void CL_NextDemo (void) { char str[MAX_INPUTLINE]; if (cls.demonum == -1) return; // don't play demos if (!cls.demos[cls.demonum][0] || cls.demonum == MAX_DEMOS) { cls.demonum = 0; if (!cls.demos[cls.demonum][0]) { Con_Print("No demos listed with startdemos\n"); cls.demonum = -1; return; } } dpsnprintf (str, sizeof(str), "playdemo %s\n", cls.demos[cls.demonum]); Cbuf_InsertText (str); cls.demonum++; }
void Cmd_Exec_f( void ) { char *f; char filename[MAX_QPATH]; if ( Cmd_Argc() != 2 ) { Com_Printf( "exec <filename> : execute a script file\n" ); return; } Q_strncpyz( filename, Cmd_Argv( 1 ), sizeof( filename ) ); COM_DefaultExtension( filename, sizeof( filename ), ".cfg" ); FS_ReadFile( filename, (void **)&f ); if ( !f ) { Com_Printf( "couldn't exec %s\n",Cmd_Argv( 1 ) ); return; } Com_Printf( "execing %s\n",Cmd_Argv( 1 ) ); Cbuf_InsertText( f ); FS_FreeFile( f ); }
/* ============ Cmd_ExecuteString A complete command line has been parsed, so try to execute it FIXME: lookupnoadd the token to speed search? ============ */ void Cmd_ExecuteString (char *text, cmd_source_t src) { cmd_function_t *cmd; cmdalias_t *a; cmd_source = src; Cmd_TokenizeString (text); // execute the command line if (!Cmd_Argc()) return; // no tokens // check functions for (cmd=cmd_functions ; cmd ; cmd=cmd->next) { if (!Q_strcasecmp (cmd_argv[0],cmd->name)) { cmd->function (); return; } } // check alias for (a=cmd_alias ; a ; a=a->next) { if (!Q_strcasecmp (cmd_argv[0], a->name)) { Cbuf_InsertText (a->value); return; } } // check cvars if (!Cvar_Command ()) Con_Printf ("Unknown command \"%s\"\n", Cmd_Argv(0)); }