-static int Cmd_Compare(const char *s1, const char *s2, size_t len, qbool casesensitive)
-{
- if(len)
- return (casesensitive ? strncmp(s1, s2, len) : strncasecmp(s1, s2, len));
- else
- return (casesensitive ? strcmp(s1, s2) : strcasecmp(s1, s2));
-}
-
-cmd_function_t *Cmd_GetCommand(cmd_state_t *cmd, const char *partial, size_t len, qbool casesensitive)
-{
- cmd_function_t *func = NULL;
-
- // check functions
- for (func = cmd->userdefined->csqc_functions; func; func = func->next)
- if (!Cmd_Compare(partial, func->name, len, casesensitive))
- break;
-
- for (func=cmd->engine_functions ; func ; func=func->next)
- if (!Cmd_Compare(partial, func->name, len, casesensitive))
- break;
-
- return func;
-}
-