From 7ded4a527bdfd0e8b3a9049955f2af89e5f039ee Mon Sep 17 00:00:00 2001 From: Charles Forsyth Date: Thu, 6 Jun 2013 21:01:19 +0000 Subject: sync with Plan 9 --- lib9/runestrchr.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lib9/runestrchr.c (limited to 'lib9/runestrchr.c') 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; +} -- cgit v1.2.3