From d97e2c0591ebf3fa043e4f774fb3c955c707bd9b Mon Sep 17 00:00:00 2001 From: divverent Date: Sun, 12 Jun 2011 19:59:24 +0000 Subject: [PATCH] make "exec" accept wildcards git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11194 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=adbccd5c89a88e85b2a9e8f9e93120c171e01a6e --- cmd.c | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) 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); +} + /* =============== -- 2.39.2