int exactmatch(target, n, token) char **target; int n; char *token; int leadmatch(target, n, token) char **target; int n; char *token; int partmatch(target, n, token) char **target; int n; char *token;
The functions described here match a token string against a list of target strings. n is the number of target strings. The list of target strings is assumed to have no duplicates. This is not checked.
exactmatch looks for the first exact match, i.e.,
leadmatch looks for a unique leading match, i.e.,
partmatch looks for a unique partial match, i.e.,
strncmp(token, target[i] +j, strlen(token)) == 0
for 0 <= j < strlen(target[i])
exactmatch returns the 0-relative index of the first target to match the token exactly. -1 is returned if there are no exact matches.
leadmatch and partmatch return -1 if there are no matches, n if there are multiple matches, or the 0-relative index matching target if there is only one.
None.
Last Update: $Date: 1999/05/10 20:56:54 $