From: divverent Date: Sun, 12 Jun 2011 19:59:24 +0000 (+0000) Subject: make "exec" accept wildcards X-Git-Tag: xonotic-v0.6.0~163^2~352 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=adbccd5c89a88e85b2a9e8f9e93120c171e01a6e;p=xonotic%2Fdarkplaces.git make "exec" accept wildcards git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11194 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cmd.c b/cmd.c index a395eed6..bbaca649 100644 --- a/cmd.c +++ b/cmd.c @@ -450,24 +450,10 @@ void Cmd_StuffCmds_f (void) Cbuf_InsertText (build); } - -/* -=============== -Cmd_Exec_f -=============== -*/ -static void Cmd_Exec_f (void) +static void Cmd_Exec(const char *filename) { char *f; - const char *filename; - - if (Cmd_Argc () != 2) - { - Con_Print("exec : execute a script file\n"); - return; - } - filename = Cmd_Argv(1); if (!strcmp(filename, "config.cfg")) { filename = CONFIGFILENAME; @@ -514,6 +500,35 @@ static void Cmd_Exec_f (void) Cbuf_InsertText("\nr_shadow_gloss 2\nr_shadow_bumpscale_basetexture 4\n\n"); } +/* +=============== +Cmd_Exec_f +=============== +*/ +static void Cmd_Exec_f (void) +{ + fssearch_t *s; + int i; + + if (Cmd_Argc () != 2) + { + Con_Print("exec : execute a script file\n"); + return; + } + + s = FS_Search(Cmd_Argv(1), true, true); + if(!s || !s->numfilenames) + { + Con_Printf("couldn't exec %s\n",Cmd_Argv(1)); + return; + } + + for(i = 0; i < s->numfilenames; ++i) + Cmd_Exec(s->filenames[i]); + + FS_FreeSearch(s); +} + /* ===============