diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2019-05-18 03:35:38 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2019-05-23 22:52:01 +0200 |
commit | 90cf59eccfd41846fc0fa03a6d5a010a91b46b86 (patch) | |
tree | 870aca85c70e3d73dd2cca8162be4ac301e22ff5 /lib/frrstr.h | |
parent | Merge pull request #4385 from manuhalo/fix_deprecate_retain (diff) | |
download | frr-90cf59eccfd41846fc0fa03a6d5a010a91b46b86.tar.xz frr-90cf59eccfd41846fc0fa03a6d5a010a91b46b86.zip |
lib: replace begins_with, add frrstr_endswith
* Change 'begins_with' to 'frrstr_startswith' for consistency
* Add suffix checker, frrstr_endswith()
* Update vtysh to use the new function
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/frrstr.h')
-rw-r--r-- | lib/frrstr.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/frrstr.h b/lib/frrstr.h index d40ca14ba..3a935c90c 100644 --- a/lib/frrstr.h +++ b/lib/frrstr.h @@ -109,6 +109,7 @@ void frrstr_strvec_free(vector v); * the replacement on 'str'. This must be freed by the caller. */ char *frrstr_replace(const char *str, const char *find, const char *replace); + /* * Prefix match for string. * @@ -119,9 +120,23 @@ char *frrstr_replace(const char *str, const char *find, const char *replace); * prefix to look for * * Returns: - * true str starts with prefix, false otherwise + * true if str starts with prefix, false otherwise + */ +bool frrstr_startswith(const char *str, const char *prefix); + +/* + * Suffix match for string. + * + * str + * string to check for suffix match + * + * suffix + * suffix to look for + * + * Returns: + * true if str ends with suffix, false otherwise */ -bool begins_with(const char *str, const char *prefix); +bool frrstr_endswith(const char *str, const char *suffix); /* * Check the string only contains digit characters. |