add new pseudo variable $# containing the number of arguments to the alias
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 12 Jan 2010 10:55:37 +0000 (10:55 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 12 Jan 2010 10:55:37 +0000 (10:55 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9831 d7cf8633-e32d-0410-b094-e92efae38249

cmd.c

diff --git a/cmd.c b/cmd.c
index db6acdb..9e4059e 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -743,6 +743,10 @@ static const char *Cmd_GetDirectCvarValue(const char *varname, cmdalias_t *alias
                                *is_multiple = true;
                        return Cmd_Args();
                }
+               else if(!strcmp(varname, "#"))
+               {
+                       return va("%d", Cmd_Argc());
+               }
                else if(varname[strlen(varname) - 1] == '-')
                {
                        argno = strtol(varname, &endptr, 10);
@@ -992,7 +996,7 @@ static void Cmd_PreprocessString( const char *intext, char *outtext, unsigned ma
                                        eat = varlen + 1;
                                }
                        } else {
-                               varlen = strspn(in, "*0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-");
+                               varlen = strspn(in, "#*0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-");
                                val = Cmd_GetCvarValue(in, varlen, alias);
                                eat = varlen;
                        }