diff options
Diffstat (limited to 'lib/util')
-rw-r--r-- | lib/util/nstring.c | 17 | ||||
-rw-r--r-- | lib/util/nstring.h | 4 |
2 files changed, 21 insertions, 0 deletions
diff --git a/lib/util/nstring.c b/lib/util/nstring.c index 749e9060..58500547 100644 --- a/lib/util/nstring.c +++ b/lib/util/nstring.c @@ -895,3 +895,20 @@ memmemN(const char * const haystack, return NULL; } + + + +bool +strishex(const char * const subject) { + + bool retval; + unsigned int i; + + retval = TRUE; /* initial assumption */ + + for (i = 0; i < strlen(subject); ++i) + if (!ISXDIGIT(subject[i])) + retval = FALSE; + + return retval; +} diff --git a/lib/util/nstring.h b/lib/util/nstring.h index d976e859..70a53f45 100644 --- a/lib/util/nstring.h +++ b/lib/util/nstring.h @@ -5,6 +5,7 @@ #include <string.h> #include <ctype.h> +#include "pm_c_util.h" #include "pm.h" /* For PM_GNU_PRINTF_ATTR, __inline__ */ #ifdef __cplusplus @@ -155,6 +156,9 @@ memmemN(const char * const haystack, const char * const needle, size_t const needlelen); +bool +strishex(const char * const subject); + #ifdef __cplusplus } #endif |