summaryrefslogtreecommitdiffstats
path: root/utf8.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2019-05-26 21:02:26 +0100
committerThomas Adam <thomas@xteddy.org>2019-05-26 21:02:26 +0100
commit103e44d936fef961c2117febfa0140bb220ed2be (patch)
tree2c24525b500a2c353a4137e330adbf3b15b86075 /utf8.c
parent2e84d1cf033adf8fe4b562b3d3caf390c15798a5 (diff)
parent097973e3d50c831c020fb0b689c3a2d66ba83b7c (diff)
Merge branch 'obsd-master'
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/utf8.c b/utf8.c
index d3220762..224aa482 100644
--- a/utf8.c
+++ b/utf8.c
@@ -435,3 +435,23 @@ utf8_padcstr(const char *s, u_int width)
out[slen] = '\0';
return (out);
}
+
+int
+utf8_cstrhas(const char *s, const struct utf8_data *ud)
+{
+ struct utf8_data *copy, *loop;
+ int found = 0;
+
+ copy = utf8_fromcstr(s);
+ for (loop = copy; loop->size != 0; loop++) {
+ if (loop->size != ud->size)
+ continue;
+ if (memcmp(loop->data, ud->data, loop->size) == 0) {
+ found = 1;
+ break;
+ }
+ }
+ free(copy);
+
+ return (found);
+}