diff options
Diffstat (limited to 'utils/host_strcspn.c')
-rw-r--r-- | utils/host_strcspn.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/utils/host_strcspn.c b/utils/host_strcspn.c new file mode 100644 index 00000000..958f47f8 --- /dev/null +++ b/utils/host_strcspn.c @@ -0,0 +1,19 @@ +/* + * strcspn-like wrapper around host_strchr_internal. + */ + +#include <stdbool.h> +#include <string.h> + +#include "defs.h" +#include "misc.h" +#include "utils/utils.h" + +size_t host_strcspn(const char *s, const char *set) +{ + const char *answer = host_strchr_internal(s, set, true); + if (answer) + return answer - s; + else + return strlen(s); +} |