diff options
| author | Charles Forsyth <charles.forsyth@gmail.com> | 2013-06-06 21:01:19 +0000 |
|---|---|---|
| committer | Charles Forsyth <charles.forsyth@gmail.com> | 2013-06-06 21:01:19 +0000 |
| commit | 7ded4a527bdfd0e8b3a9049955f2af89e5f039ee (patch) | |
| tree | 7ee0f03dd4e5cad072bc0c816468ebfd0dd17c67 /lib9/runestrchr.c | |
| parent | 8bdf904b6a23b93336ae2837772110bcdad234ce (diff) | |
sync with Plan 9
Diffstat (limited to 'lib9/runestrchr.c')
| -rw-r--r-- | lib9/runestrchr.c | 19 |
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; +} |
