summaryrefslogtreecommitdiff
path: root/lib9/runestrchr.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib9/runestrchr.c')
-rw-r--r--lib9/runestrchr.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib9/runestrchr.c b/lib9/runestrchr.c
new file mode 100644
index 00000000..f7bc4198
--- /dev/null
+++ b/lib9/runestrchr.c
@@ -0,0 +1,19 @@
+#include "lib9.h"
+
+Rune*
+runestrchr(Rune *s, Rune c)
+{
+ Rune c0 = c;
+ Rune c1;
+
+ if(c == 0) {
+ while(*s++)
+ ;
+ return s-1;
+ }
+
+ while(c1 = *s++)
+ if(c1 == c0)
+ return s-1;
+ return 0;
+}