struct cmd_token *token = gn->data;
switch (match_token (token, input_token))
{
+ case trivial_match:
case partly_match:
if (idx == vector_active (vline) - 1)
{
static enum match_type
match_token (struct cmd_token *token, char *input_token)
{
+ // nothing trivially matches everything
+ if (!input_token)
+ return trivial_match;
+
switch (token->type) {
case WORD_TKN:
return match_word (token, input_token);
int dots = 0, nums = 0;
char buf[4];
- if (str == NULL)
- return partly_match;
-
for (;;)
{
memset (buf, 0, sizeof (buf));
int dots = 0;
char buf[4];
- if (str == NULL)
- return partly_match;
-
for (;;)
{
memset (buf, 0, sizeof (buf));
struct sockaddr_in6 sin6_dummy;
int ret;
- if (str == NULL)
- return partly_match;
-
if (strspn (str, IPV6_ADDR_STR) != strlen (str))
return no_match;
char *tofree, *dupe, *prefix, *mask, *endptr;
int nmask = -1;
- if (str == NULL)
- return partly_match;
-
if (strspn (str, IPV6_PREFIX_STR) != strlen (str))
return no_match;
char *endptr = NULL;
long long val;
- if (str == NULL)
- return 1;
-
val = strtoll (str, &endptr, 10);
if (*endptr != '\0')
return 0;
{
assert (token->type == WORD_TKN);
- // if the passed token is null or 0 length, partly match
- if (!word || !strlen(word))
+ // if the passed token is 0 length, partly match
+ if (!strlen(word))
return partly_match;
// if the passed token is strictly a prefix of the full word, partly match
/* completion match types */
enum match_type
{
- no_match,
- partly_match,
- exact_match
+ trivial_match, // the input is null
+ no_match, // the input does not match
+ partly_match, // the input matches but is incomplete
+ exact_match // the input matches and is complete
};
/* Defines which matcher_rv values constitute an error. Should be used with