summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/strutils.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/strutils.c b/lib/strutils.c
index d3daa369d..74c850bce 100644
--- a/lib/strutils.c
+++ b/lib/strutils.c
@@ -174,21 +174,26 @@ int strtosize(const char *str, uintmax_t *res)
return parse_size(str, res, NULL);
}
-int isdigit_string(const char *str)
+int isdigit_strend(const char *str, const char **end)
{
const char *p;
for (p = str; p && *p && isdigit((unsigned char) *p); p++);
+ if (end)
+ *end = p;
return p && p > str && !*p;
}
-int isxdigit_string(const char *str)
+int isxdigit_strend(const char *str, const char **end)
{
const char *p;
for (p = str; p && *p && isxdigit((unsigned char) *p); p++);
+ if (end)
+ *end = p;
+
return p && p > str && !*p;
}