From 220534453eecc2c07ad710d72268aafd20b83138 Mon Sep 17 00:00:00 2001 From: joe Date: Fri, 8 May 2015 23:07:47 -0400 Subject: initial commit --- str_chr.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 str_chr.c (limited to 'str_chr.c') diff --git a/str_chr.c b/str_chr.c new file mode 100644 index 0000000..9b467eb --- /dev/null +++ b/str_chr.c @@ -0,0 +1,19 @@ +/* Public domain. */ + +#include "str.h" + +unsigned int str_chr(register const char *s,int c) +{ + register char ch; + register const char *t; + + ch = c; + t = s; + for (;;) { + if (!*t) break; if (*t == ch) break; ++t; + if (!*t) break; if (*t == ch) break; ++t; + if (!*t) break; if (*t == ch) break; ++t; + if (!*t) break; if (*t == ch) break; ++t; + } + return t - s; +} -- cgit v1.2.3