]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
In the apropos command exclude \n from being filtered by wildcards for alias values...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 13 Aug 2010 18:42:44 +0000 (18:42 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 13 Aug 2010 18:42:44 +0000 (18:42 +0000)
For example, apropos ? returned a bunch of aliases with empty definitions

From: terencehill <piuntn@gmail.com>

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10390 d7cf8633-e32d-0410-b094-e92efae38249

cmd.c

diff --git a/cmd.c b/cmd.c
index 80e810a532561e7dfa2431d0c1e8be571dd3f24c..18cb6a13fc366e63cf2ba34bc2e0bbfc17cb2cad 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -1145,10 +1145,11 @@ static void Cmd_Apropos_f(void)
        }
        for (alias = cmd_alias; alias; alias = alias->next)
        {
+               // procede here a bit differently as an alias value always got a final \n
                if (!matchpattern_with_separator(alias->name, partial, true, "", false))
-               if (!matchpattern_with_separator(alias->value, partial, true, "", false))
+               if (!matchpattern_with_separator(alias->value, partial, true, "\n", false)) // when \n is as separator wildcards don't match it
                        continue;
-               Con_Printf("alias ^5%s^7: %s", alias->name, alias->value);
+               Con_Printf("alias ^5%s^7: %s", alias->name, alias->value); // do not print an extra \n
                count++;
        }
        Con_Printf("%i result%s\n\n", count, (count > 1) ? "s" : "");