mirror of https://gerrit.osmocom.org/libosmocore
vty: make function cmd_range_match() public
Certain control interface commands also may require to verfy a range in their verify function. cmd_range_match() from the VTY does exactly that and the range can be specified as string, the same way as we would specify it in the VTY. Change-Id: I53fc207677f52b1dc748b01d58424839cdba807c related: SYS#5369
This commit is contained in:
parent
ac49bda4d4
commit
eabc6fd4b1
|
@ -483,4 +483,6 @@ extern const struct value_string vty_ref_gen_mode_desc[];
|
|||
int vty_dump_xml_ref_mode(FILE *stream, enum vty_ref_gen_mode mode);
|
||||
int vty_dump_xml_ref(FILE *stream) OSMO_DEPRECATED("Use vty_dump_xml_ref_mode() instead");
|
||||
|
||||
int vty_cmd_range_match(const char *range, const char *str);
|
||||
|
||||
/*! @} */
|
||||
|
|
|
@ -1477,7 +1477,7 @@ static enum match_type cmd_ipv6_prefix_match(const char *str)
|
|||
#error "LONG_MAX not defined!"
|
||||
#endif
|
||||
|
||||
static int cmd_range_match(const char *range, const char *str)
|
||||
int vty_cmd_range_match(const char *range, const char *str)
|
||||
{
|
||||
char *p;
|
||||
char buf[DECIMAL_STRLEN_MAX_UNSIGNED + 1];
|
||||
|
@ -1600,7 +1600,7 @@ cmd_match(const char *str, const char *command,
|
|||
return VARARG_MATCH;
|
||||
else if (CMD_RANGE(str))
|
||||
{
|
||||
if (cmd_range_match(str, command))
|
||||
if (vty_cmd_range_match(str, command))
|
||||
return RANGE_MATCH;
|
||||
}
|
||||
#ifdef HAVE_IPV6
|
||||
|
@ -1797,7 +1797,7 @@ is_cmd_ambiguous(char *command, vector v, int index, enum match_type type)
|
|||
}
|
||||
break;
|
||||
case RANGE_MATCH:
|
||||
if (cmd_range_match
|
||||
if (vty_cmd_range_match
|
||||
(str, command)) {
|
||||
if (matched
|
||||
&& strcmp(matched,
|
||||
|
@ -1890,7 +1890,7 @@ static const char *cmd_entry_function_desc(const char *src, const char *dst)
|
|||
return dst;
|
||||
|
||||
if (CMD_RANGE(dst)) {
|
||||
if (cmd_range_match(dst, src))
|
||||
if (vty_cmd_range_match(dst, src))
|
||||
return dst;
|
||||
else
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in New Issue