]>
git.proxmox.com Git - mirror_frr.git/blob - lib/command_match.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Input matching routines for CLI backend.
6 * Copyright (C) 2016 Cumulus Networks, Inc.
11 #include "command_match.h"
15 DEFINE_MTYPE_STATIC(LIB
, CMD_MATCHSTACK
, "Command Match Stack");
23 #define trace_matcher(...) \
26 fprintf(stderr, __VA_ARGS__); \
29 /* matcher helper prototypes */
30 static int add_nexthops(struct list
*, struct graph_node
*,
31 struct graph_node
**, size_t, bool);
33 static enum matcher_rv
command_match_r(struct graph_node
*, vector
,
34 unsigned int, struct graph_node
**,
37 static int score_precedence(enum cmd_token_type
);
39 static enum match_type
min_match_level(enum cmd_token_type
);
41 static void del_arglist(struct list
*);
43 static struct cmd_token
*disambiguate_tokens(struct cmd_token
*,
44 struct cmd_token
*, char *);
46 static struct list
*disambiguate(struct list
*, struct list
*, vector
,
49 int compare_completions(const void *, const void *);
51 /* token matcher prototypes */
52 static enum match_type
match_token(struct cmd_token
*, char *);
54 static enum match_type
match_ipv4(const char *);
56 static enum match_type
match_ipv4_prefix(const char *);
58 static enum match_type
match_ipv6_prefix(const char *, bool);
60 static enum match_type
match_range(struct cmd_token
*, const char *);
62 static enum match_type
match_word(struct cmd_token
*, const char *);
64 static enum match_type
match_variable(struct cmd_token
*, const char *);
66 static enum match_type
match_mac(const char *, bool);
68 static bool is_neg(vector vline
, size_t idx
)
70 if (idx
>= vector_active(vline
) || !vector_slot(vline
, idx
))
72 return !strcmp(vector_slot(vline
, idx
), "no");
75 enum matcher_rv
command_match(struct graph
*cmdgraph
, vector vline
,
76 struct list
**argv
, const struct cmd_element
**el
)
78 struct graph_node
*stack
[CMD_ARGC_MAX
];
79 enum matcher_rv status
;
82 // prepend a dummy token to match that pesky start node
83 vector vvline
= vector_init(vline
->alloced
+ 1);
84 vector_set_index(vvline
, 0, XSTRDUP(MTYPE_TMP
, "dummy"));
85 memcpy(vvline
->index
+ 1, vline
->index
,
86 sizeof(void *) * vline
->alloced
);
87 vvline
->active
= vline
->active
+ 1;
89 struct graph_node
*start
= vector_slot(cmdgraph
->nodes
, 0);
90 status
= command_match_r(start
, vvline
, 0, stack
, argv
);
91 if (status
== MATCHER_OK
) { // successful match
92 struct listnode
*head
= listhead(*argv
);
93 struct listnode
*tail
= listtail(*argv
);
98 // delete dummy start node
99 cmd_token_del((struct cmd_token
*)head
->data
);
100 list_delete_node(*argv
, head
);
102 // get cmd_element out of list tail
103 *el
= listgetdata(tail
);
104 list_delete_node(*argv
, tail
);
106 // now argv is an ordered list of cmd_token matching the user
107 // input, with each cmd_token->arg holding the corresponding
116 trace_matcher("No match\n");
118 trace_matcher("Matched command\n->string %s\n->desc %s\n",
119 (*el
)->string
, (*el
)->doc
);
122 // free the leader token we alloc'd
123 XFREE(MTYPE_TMP
, vector_slot(vvline
, 0));
131 * Builds an argument list given a DFA and a matching input line.
133 * First the function determines if the node it is passed matches the first
134 * token of input. If it does not, it returns NULL (MATCHER_NO_MATCH). If it
135 * does match, then it saves the input token as the head of an argument list.
137 * The next step is to see if there is further input in the input line. If
138 * there is not, the current node's children are searched to see if any of them
139 * are leaves (type END_TKN). If this is the case, then the bottom of the
140 * recursion stack has been reached, the leaf is pushed onto the argument list,
141 * the current node is pushed, and the resulting argument list is
142 * returned (MATCHER_OK). If it is not the case, NULL is returned, indicating
143 * that there is no match for the input along this path (MATCHER_INCOMPLETE).
145 * If there is further input, then the function recurses on each of the current
146 * node's children, passing them the input line minus the token that was just
147 * matched. For each child, the return value of the recursive call is
148 * inspected. If it is null, then there is no match for the input along the
149 * subgraph headed by that child. If it is not null, then there is at least one
150 * input match in that subgraph (more on this in a moment).
152 * If a recursive call on a child returns a non-null value, then it has matched
153 * the input given it on the subgraph that starts with that child. However, due
154 * to the flexibility of the grammar, it is sometimes the case that two or more
155 * child graphs match the same input (two or more of the recursive calls have
156 * non-NULL return values). This is not a valid state, since only one true
157 * match is possible. In order to resolve this conflict, the function keeps a
158 * reference to the child node that most specifically matches the input. This
159 * is done by assigning each node type a precedence. If a child is found to
160 * match the remaining input, then the precedence values of the current
161 * best-matching child and this new match are compared. The node with higher
162 * precedence is kept, and the other match is discarded. Due to the recursive
163 * nature of this function, it is only necessary to compare the precedence of
164 * immediate children, since all subsequent children will already have been
165 * disambiguated in this way.
167 * In the event that two children are found to match with the same precedence,
168 * then the input is ambiguous for the passed cmd_element and NULL is returned.
170 * @param[in] start the start node.
171 * @param[in] vline the vectorized input line.
172 * @param[in] n the index of the first input token.
173 * @return A linked list of n elements. The first n-1 elements are pointers to
174 * struct cmd_token and represent the sequence of tokens matched by the input.
175 * The ->arg field of each token points to a copy of the input matched on it.
176 * The final nth element is a pointer to struct cmd_element, which is the
177 * command that was matched.
179 * If no match was found, the return value is NULL.
181 static enum matcher_rv
command_match_r(struct graph_node
*start
, vector vline
,
183 struct graph_node
**stack
,
184 struct list
**currbest
)
186 assert(n
< vector_active(vline
));
188 enum matcher_rv status
= MATCHER_NO_MATCH
;
190 // get the minimum match level that can count as a full match
191 struct cmd_token
*copy
, *token
= start
->data
;
192 enum match_type minmatch
= min_match_level(token
->type
);
194 /* check history/stack of tokens
195 * this disallows matching the same one more than once if there is a
196 * circle in the graph (used for keyword arguments) */
197 if (n
== CMD_ARGC_MAX
)
198 return MATCHER_NO_MATCH
;
199 if (!token
->allowrepeat
)
200 for (size_t s
= 0; s
< n
; s
++)
201 if (stack
[s
] == start
)
202 return MATCHER_NO_MATCH
;
204 // get the current operating input token
205 char *input_token
= vector_slot(vline
, n
);
208 fprintf(stdout
, "\"%-20s\" matches \"%-30s\" ? ", input_token
,
210 enum match_type mt
= match_token(token
, input_token
);
211 fprintf(stdout
, "type: %d ", token
->type
);
212 fprintf(stdout
, "min: %d - ", minmatch
);
215 fprintf(stdout
, "trivial_match ");
218 fprintf(stdout
, "no_match ");
221 fprintf(stdout
, "partly_match ");
224 fprintf(stdout
, "exact_match ");
228 fprintf(stdout
, " MATCH");
229 fprintf(stdout
, "\n");
232 // if we don't match this node, die
233 if (match_token(token
, input_token
) < minmatch
)
234 return MATCHER_NO_MATCH
;
238 // pointers for iterating linklist
240 struct graph_node
*gn
;
242 // get all possible nexthops
243 struct list
*next
= list_new();
244 add_nexthops(next
, start
, NULL
, 0, is_neg(vline
, 1));
246 // determine the best match
247 for (ALL_LIST_ELEMENTS_RO(next
, ln
, gn
)) {
248 // if we've matched all input we're looking for END_TKN
249 if (n
+ 1 == vector_active(vline
)) {
250 struct cmd_token
*tok
= gn
->data
;
251 if (tok
->type
== END_TKN
) {
252 // if more than one END_TKN in the follow set
254 status
= MATCHER_AMBIGUOUS
;
259 *currbest
= list_new();
260 // node should have one child node with the
262 struct graph_node
*leaf
=
263 vector_slot(gn
->to
, 0);
264 // last node in the list will hold the
265 // cmd_element; this is important because
266 // list_delete() expects that all nodes have
267 // the same data type, so when deleting this
268 // list the last node must be manually deleted
269 struct cmd_element
*el
= leaf
->data
;
270 listnode_add(*currbest
, el
);
272 (void (*)(void *)) & cmd_token_del
;
273 // do not break immediately; continue walking
274 // through the follow set to ensure that there
275 // is exactly one END_TKN
280 // else recurse on candidate child node
281 struct list
*result
= NULL
;
282 enum matcher_rv rstat
=
283 command_match_r(gn
, vline
, n
+ 1, stack
, &result
);
285 // save the best match
286 if (result
&& *currbest
) {
287 // pick the best of two matches
288 struct list
*newbest
=
289 disambiguate(*currbest
, result
, vline
, n
+ 1);
291 // current best and result are ambiguous
293 status
= MATCHER_AMBIGUOUS
;
294 // current best is still the best, but ambiguous
295 else if (newbest
== *currbest
296 && status
== MATCHER_AMBIGUOUS
)
297 status
= MATCHER_AMBIGUOUS
;
298 // result is better, but also ambiguous
299 else if (newbest
== result
300 && rstat
== MATCHER_AMBIGUOUS
)
301 status
= MATCHER_AMBIGUOUS
;
302 // one or the other is superior and not ambiguous
306 // delete the unnecessary result
307 struct list
*todelete
=
308 ((newbest
&& newbest
== result
) ? *currbest
310 del_arglist(todelete
);
312 *currbest
= newbest
? newbest
: *currbest
;
316 } else if (!*currbest
) {
317 status
= MAX(rstat
, status
);
321 // copy token, set arg and prepend to currbest
323 copy
= cmd_token_dup(token
);
324 copy
->arg
= XSTRDUP(MTYPE_CMD_ARG
, input_token
);
325 listnode_add_before(*currbest
, (*currbest
)->head
, copy
);
326 } else if (n
+ 1 == vector_active(vline
) && status
== MATCHER_NO_MATCH
)
327 status
= MATCHER_INCOMPLETE
;
335 static void stack_del(void *val
)
337 XFREE(MTYPE_CMD_MATCHSTACK
, val
);
340 enum matcher_rv
command_complete(struct graph
*graph
, vector vline
,
341 struct list
**completions
)
343 // pointer to next input token to match
345 bool neg
= is_neg(vline
, 0);
349 list_new(), // current nodes to match input token against
350 *next
= list_new(); // possible next hops after current input
352 current
->del
= next
->del
= stack_del
;
354 // pointers used for iterating lists
355 struct graph_node
**gstack
, **newstack
;
356 struct listnode
*node
;
358 // add all children of start node to list
359 struct graph_node
*start
= vector_slot(graph
->nodes
, 0);
360 add_nexthops(next
, start
, &start
, 0, neg
);
363 for (idx
= 0; idx
< vector_active(vline
) && next
->count
> 0; idx
++) {
364 list_delete(¤t
);
367 next
->del
= stack_del
;
369 input_token
= vector_slot(vline
, idx
);
371 int exact_match_exists
= 0;
372 for (ALL_LIST_ELEMENTS_RO(current
, node
, gstack
))
373 if (!exact_match_exists
)
375 (match_token(gstack
[0]->data
,
381 for (ALL_LIST_ELEMENTS_RO(current
, node
, gstack
)) {
382 struct cmd_token
*token
= gstack
[0]->data
;
384 if (token
->attr
& CMD_ATTR_HIDDEN
)
387 enum match_type minmatch
= min_match_level(token
->type
);
388 trace_matcher("\"%s\" matches \"%s\" (%d) ? ",
389 input_token
, token
->text
, token
->type
);
391 unsigned int last_token
=
392 (vector_active(vline
) - 1 == idx
);
393 enum match_type matchtype
=
394 match_token(token
, input_token
);
396 // occurs when last token is whitespace
398 trace_matcher("trivial_match\n");
400 newstack
= XMALLOC(MTYPE_CMD_MATCHSTACK
,
401 sizeof(struct graph_node
*));
402 /* we're not recursing here, just the first
404 newstack
[0] = gstack
[0];
405 listnode_add(next
, newstack
);
408 trace_matcher("trivial_match\n");
409 if (exact_match_exists
&& !last_token
)
413 trace_matcher("exact_match\n");
416 MTYPE_CMD_MATCHSTACK
,
417 sizeof(struct graph_node
*));
418 /* same as above, not recursing on this
420 newstack
[0] = gstack
[0];
421 listnode_add(next
, newstack
);
422 } else if (matchtype
>= minmatch
)
423 add_nexthops(next
, gstack
[0], gstack
,
427 trace_matcher("no_match\n");
434 * -----------------------------------------------------------------
435 * token = last input token processed
436 * idx = index in `command` of last token processed
437 * current = set of all transitions from the previous input token
438 * next = set of all nodes reachable from all nodes in `matched`
441 enum matcher_rv mrv
= idx
== vector_active(vline
) && next
->count
446 if (!MATCHER_ERROR(mrv
)) {
447 // extract cmd_token into list
448 *completions
= list_new();
449 for (ALL_LIST_ELEMENTS_RO(next
, node
, gstack
)) {
450 listnode_add(*completions
, gstack
[0]->data
);
454 list_delete(¤t
);
461 * Adds all children that are reachable by one parser hop to the given list.
462 * special tokens except END_TKN are treated as transparent.
464 * @param[in] list to add the nexthops to
465 * @param[in] node to start calculating nexthops from
466 * @param[in] stack listing previously visited nodes, if non-NULL.
467 * @param[in] stackpos how many valid entries are in stack
468 * @return the number of children added to the list
470 * NB: non-null "stack" means that new stacks will be added to "list" as
471 * output, instead of direct node pointers!
473 static int add_nexthops(struct list
*list
, struct graph_node
*node
,
474 struct graph_node
**stack
, size_t stackpos
, bool neg
)
477 struct graph_node
*child
;
478 struct graph_node
**nextstack
;
479 for (unsigned int i
= 0; i
< vector_active(node
->to
); i
++) {
480 child
= vector_slot(node
->to
, i
);
482 struct cmd_token
*token
= child
->data
;
483 if (!token
->allowrepeat
&& stack
) {
484 for (j
= 0; j
< stackpos
; j
++)
485 if (child
== stack
[j
])
491 if (token
->type
== NEG_ONLY_TKN
&& !neg
)
494 if (token
->type
>= SPECIAL_TKN
&& token
->type
!= END_TKN
) {
496 add_nexthops(list
, child
, stack
, stackpos
, neg
);
500 MTYPE_CMD_MATCHSTACK
,
502 * sizeof(struct graph_node
*));
503 nextstack
[0] = child
;
504 memcpy(nextstack
+ 1, stack
,
505 stackpos
* sizeof(struct graph_node
*));
507 listnode_add(list
, nextstack
);
509 listnode_add(list
, child
);
518 * Determines the node types for which a partial match may count as a full
519 * match. Enables command abbrevations.
521 * @param[in] type node type
522 * @return minimum match level needed to for a token to fully match
524 static enum match_type
min_match_level(enum cmd_token_type type
)
527 // anything matches a start node, for the sake of recursion
530 // allowing words to partly match enables command abbreviation
535 case IPV4_PREFIX_TKN
:
537 case IPV6_PREFIX_TKN
:
549 assert(!"Reached end of function we should never hit");
553 * Assigns precedence scores to node types.
555 * @param[in] type node type to score
556 * @return precedence score
558 static int score_precedence(enum cmd_token_type type
)
561 // some of these are mutually exclusive, so they share
562 // the same precedence value
564 case IPV4_PREFIX_TKN
:
566 case IPV6_PREFIX_TKN
:
584 assert(!"Reached end of function we should never hit");
588 * Picks the better of two possible matches for a token.
590 * @param[in] first candidate node matching token
591 * @param[in] second candidate node matching token
592 * @param[in] token the token being matched
593 * @return the best-matching node, or NULL if the two are entirely ambiguous
595 static struct cmd_token
*disambiguate_tokens(struct cmd_token
*first
,
596 struct cmd_token
*second
,
599 // if the types are different, simply go off of type precedence
600 if (first
->type
!= second
->type
) {
601 int firstprec
= score_precedence(first
->type
);
602 int secndprec
= score_precedence(second
->type
);
603 if (firstprec
!= secndprec
)
604 return firstprec
< secndprec
? first
: second
;
609 // if they're the same, return the more exact match
610 enum match_type fmtype
= match_token(first
, input_token
);
611 enum match_type smtype
= match_token(second
, input_token
);
612 if (fmtype
!= smtype
)
613 return fmtype
> smtype
? first
: second
;
619 * Picks the better of two possible matches for an input line.
621 * @param[in] first candidate list of cmd_token matching vline
622 * @param[in] second candidate list of cmd_token matching vline
623 * @param[in] vline the input line being matched
624 * @param[in] n index into vline to start comparing at
625 * @return the best-matching list, or NULL if the two are entirely ambiguous
627 static struct list
*disambiguate(struct list
*first
, struct list
*second
,
628 vector vline
, unsigned int n
)
630 assert(first
!= NULL
);
631 assert(second
!= NULL
);
632 // doesn't make sense for these to be inequal length
633 assert(first
->count
== second
->count
);
634 assert(first
->count
== vector_active(vline
) - n
+ 1);
636 struct listnode
*fnode
= listhead_unchecked(first
),
637 *snode
= listhead_unchecked(second
);
638 struct cmd_token
*ftok
= listgetdata(fnode
), *stok
= listgetdata(snode
),
641 // compare each token, if one matches better use that one
642 for (unsigned int i
= n
; i
< vector_active(vline
); i
++) {
643 char *token
= vector_slot(vline
, i
);
644 if ((best
= disambiguate_tokens(ftok
, stok
, token
)))
645 return best
== ftok
? first
: second
;
646 fnode
= listnextnode(fnode
);
647 snode
= listnextnode(snode
);
648 ftok
= listgetdata(fnode
);
649 stok
= listgetdata(snode
);
656 * Deletion function for arglist.
658 * Since list->del for arglists expects all listnode->data to hold cmd_token,
659 * but arglists have cmd_element as the data for the tail, this function
660 * manually deletes the tail before deleting the rest of the list as usual.
662 * The cmd_element at the end is *not* a copy. It is the one and only.
664 * @param list the arglist to delete
666 static void del_arglist(struct list
*list
)
668 // manually delete last node
669 struct listnode
*tail
= listtail(list
);
671 list_delete_node(list
, tail
);
673 // delete the rest of the list as usual
677 /*---------- token level matching functions ----------*/
679 static enum match_type
match_token(struct cmd_token
*token
, char *input_token
)
681 // nothing trivially matches everything
683 return trivial_match
;
685 switch (token
->type
) {
687 return match_word(token
, input_token
);
689 return match_ipv4(input_token
);
690 case IPV4_PREFIX_TKN
:
691 return match_ipv4_prefix(input_token
);
693 return match_ipv6_prefix(input_token
, false);
694 case IPV6_PREFIX_TKN
:
695 return match_ipv6_prefix(input_token
, true);
697 return match_range(token
, input_token
);
699 return match_variable(token
, input_token
);
701 return match_mac(input_token
, false);
703 return match_mac(input_token
, true);
705 return asn_str2asn_match(input_token
);
714 assert(!"Reached end of function we should never hit");
717 #define IPV4_ADDR_STR "0123456789."
718 #define IPV4_PREFIX_STR "0123456789./"
720 static enum match_type
match_ipv4(const char *str
)
723 int dots
= 0, nums
= 0;
727 memset(buf
, 0, sizeof(buf
));
729 while (*str
!= '\0') {
734 if (*(str
+ 1) == '.')
737 if (*(str
+ 1) == '\0')
743 if (!isdigit((unsigned char)*str
))
752 memcpy(buf
, sp
, str
- sp
);
758 if (v
> 0 && buf
[0] == '0')
775 static enum match_type
match_ipv4_prefix(const char *str
)
782 memset(buf
, 0, sizeof(buf
));
784 while (*str
!= '\0' && *str
!= '/') {
789 if (*(str
+ 1) == '.' || *(str
+ 1) == '/')
792 if (*(str
+ 1) == '\0')
799 if (!isdigit((unsigned char)*str
))
808 memcpy(buf
, sp
, str
- sp
);
814 if (v
> 0 && buf
[0] == '0')
819 if (*(str
+ 1) == '\0')
824 } else if (*str
== '\0')
835 while (*str
!= '\0') {
836 if (!isdigit((unsigned char)*str
))
842 if (atoi(sp
) > IPV4_MAX_BITLEN
)
848 #define IPV6_ADDR_STR "0123456789abcdefABCDEF:."
849 #define IPV6_PREFIX_STR "0123456789abcdefABCDEF:./"
850 #define STATE_START 1
851 #define STATE_COLON 2
852 #define STATE_DOUBLE 3
855 #define STATE_SLASH 6
858 static enum match_type
match_ipv6_prefix(const char *str
, bool prefix
)
860 int state
= STATE_START
;
861 int colons
= 0, nums
= 0, double_colon
= 0;
863 const char *sp
= NULL
, *start
= str
;
869 if (strspn(str
, prefix
? IPV6_PREFIX_STR
: IPV6_ADDR_STR
)
873 while (*str
!= '\0' && state
!= STATE_MASK
) {
877 if (*(str
+ 1) != ':' && *(str
+ 1) != '\0')
889 if (*(str
+ 1) == '/')
891 else if (*(str
+ 1) == ':')
892 state
= STATE_DOUBLE
;
902 if (*(str
+ 1) == ':')
905 if (*(str
+ 1) != '\0' && *(str
+ 1) != '/')
909 if (*(str
+ 1) == '/')
919 if (*(str
+ 1) == ':' || *(str
+ 1) == '.'
920 || *(str
+ 1) == '\0' || *(str
+ 1) == '/') {
924 for (; sp
<= str
; sp
++)
930 if (*(str
+ 1) == ':')
932 else if (*(str
+ 1) == '.') {
933 if (colons
|| double_colon
)
937 } else if (*(str
+ 1) == '/')
945 if (*(str
+ 1) == '\0')
964 struct sockaddr_in6 sin6_dummy
;
965 int ret
= inet_pton(AF_INET6
, start
, &sin6_dummy
.sin6_addr
);
966 return ret
== 1 ? exact_match
: partly_match
;
969 if (state
< STATE_MASK
)
972 mask
= strtol(str
, &endptr
, 10);
976 if (mask
< 0 || mask
> IPV6_MAX_BITLEN
)
982 static enum match_type
match_range(struct cmd_token
*token
, const char *str
)
984 assert(token
->type
== RANGE_TKN
);
989 val
= strtoll(str
, &endptr
, 10);
993 if (val
< token
->min
|| val
> token
->max
)
999 static enum match_type
match_word(struct cmd_token
*token
, const char *word
)
1001 assert(token
->type
== WORD_TKN
);
1003 // if the passed token is 0 length, partly match
1005 return partly_match
;
1007 // if the passed token is strictly a prefix of the full word, partly
1009 if (strlen(word
) < strlen(token
->text
))
1010 return !strncmp(token
->text
, word
, strlen(word
)) ? partly_match
1013 // if they are the same length and exactly equal, exact match
1014 else if (strlen(word
) == strlen(token
->text
))
1015 return !strncmp(token
->text
, word
, strlen(word
)) ? exact_match
1021 static enum match_type
match_variable(struct cmd_token
*token
, const char *word
)
1023 assert(token
->type
== VARIABLE_TKN
);
1027 #define MAC_CHARS "ABCDEFabcdef0123456789:"
1029 static enum match_type
match_mac(const char *word
, bool prefix
)
1031 /* 6 2-digit hex numbers separated by 5 colons */
1032 size_t mac_explen
= 6 * 2 + 5;
1033 /* '/' + 2-digit integer */
1034 size_t mask_len
= 1 + 2;
1037 unsigned int maskval
;
1040 if (strlen(word
) > mac_explen
+ (prefix
? mask_len
: 0))
1044 for (i
= 0; i
< mac_explen
; i
++) {
1045 if (word
[i
] == '\0' || !strchr(MAC_CHARS
, word
[i
]))
1047 if (((i
+ 1) % 3 == 0) != (word
[i
] == ':'))
1051 /* incomplete address */
1052 if (i
< mac_explen
&& word
[i
] == '\0')
1053 return partly_match
;
1054 else if (i
< mac_explen
)
1058 if (prefix
&& word
[i
] == '/') {
1059 if (word
[++i
] == '\0')
1060 return partly_match
;
1062 maskval
= strtoul(&word
[i
], &eptr
, 10);
1063 if (*eptr
!= '\0' || maskval
> 48)
1065 } else if (prefix
&& word
[i
] == '\0') {
1066 return partly_match
;
1067 } else if (prefix
) {