X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/f2e710b193928f3e70f48580276498a2debe809b..2878a6afb068ee13945aec07cc73a2202e97a86a:/sbr/utils.c diff --git a/sbr/utils.c b/sbr/utils.c index 59ab7c72..4405f4c9 100644 --- a/sbr/utils.c +++ b/sbr/utils.c @@ -365,3 +365,24 @@ upcase (const char *str) { return up; } + + +/* + * Scan for any 8-bit characters. Return 1 if they exist. + * + * Scan up until the given endpoint (but not the actual endpoint itself). + * If the endpoint is NULL, scan until a '\0' is reached. + */ + +int +contains8bit(const char *start, const char *end) +{ + if (! start) + return 0; + + while (*start != '\0' && (!end || (start < end))) + if (! isascii((unsigned char) *start++)) + return 1; + + return 0; +}