summaryrefslogtreecommitdiff
path: root/src/qcommon/cmd.c
diff options
context:
space:
mode:
authorZack Middleton <zturtleman@gmail.com>2012-06-18 16:09:14 +0000
committerTim Angus <tim@ngus.net>2013-01-12 20:30:55 +0000
commite31a04fab4978138373601e0fd02e12ea9e5a4d8 (patch)
tree7da87b90839b22ec9e7d4df2e9b1defdab7b2179 /src/qcommon/cmd.c
parent6f0d05eda1a7f89c6297ac15f7fce2f994e71151 (diff)
add the "execq" command, a more quiet version of the "exec" command in exec/execq, always print the extension for the filename
From /dev/humancontroller.
Diffstat (limited to 'src/qcommon/cmd.c')
-rw-r--r--src/qcommon/cmd.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/qcommon/cmd.c b/src/qcommon/cmd.c
index a67108f3..6c96d5ec 100644
--- a/src/qcommon/cmd.c
+++ b/src/qcommon/cmd.c
@@ -266,14 +266,18 @@ Cmd_Exec_f
===============
*/
void Cmd_Exec_f( void ) {
+ qboolean quiet;
union {
char *c;
void *v;
} f;
char filename[MAX_QPATH];
+ quiet = !Q_stricmp(Cmd_Argv(0), "execq");
+
if (Cmd_Argc () != 2) {
- Com_Printf ("exec <filename> : execute a script file\n");
+ Com_Printf ("exec%s <filename> : execute a script file%s\n",
+ quiet ? "q" : "", quiet ? " without notification" : "");
return;
}
@@ -281,10 +285,11 @@ void Cmd_Exec_f( void ) {
COM_DefaultExtension( filename, sizeof( filename ), ".cfg" );
FS_ReadFile( filename, &f.v);
if (!f.c) {
- Com_Printf ("couldn't exec %s\n",Cmd_Argv(1));
+ Com_Printf ("couldn't exec %s\n", filename);
return;
}
- Com_Printf ("execing %s\n",Cmd_Argv(1));
+ if (!quiet)
+ Com_Printf ("execing %s\n", filename);
Cbuf_InsertText (f.c);
@@ -892,7 +897,9 @@ Cmd_Init
void Cmd_Init (void) {
Cmd_AddCommand ("cmdlist",Cmd_List_f);
Cmd_AddCommand ("exec",Cmd_Exec_f);
+ Cmd_AddCommand ("execq",Cmd_Exec_f);
Cmd_SetCommandCompletionFunc( "exec", Cmd_CompleteCfgName );
+ Cmd_SetCommandCompletionFunc( "execq", Cmd_CompleteCfgName );
Cmd_AddCommand ("vstr",Cmd_Vstr_f);
Cmd_SetCommandCompletionFunc( "vstr", Cvar_CompleteCvarName );
Cmd_AddCommand ("echo",Cmd_Echo_f);