summaryrefslogtreecommitdiff
path: root/byte_chr.c
diff options
context:
space:
mode:
Diffstat (limited to 'byte_chr.c')
-rw-r--r--byte_chr.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/byte_chr.c b/byte_chr.c
new file mode 100644
index 0000000..fd56056
--- /dev/null
+++ b/byte_chr.c
@@ -0,0 +1,22 @@
1/* Public domain. */
2
3#include "byte.h"
4
5unsigned int byte_chr(s,n,c)
6char *s;
7register unsigned int n;
8int c;
9{
10 register char ch;
11 register char *t;
12
13 ch = c;
14 t = s;
15 for (;;) {
16 if (!n) break; if (*t == ch) break; ++t; --n;
17 if (!n) break; if (*t == ch) break; ++t; --n;
18 if (!n) break; if (*t == ch) break; ++t; --n;
19 if (!n) break; if (*t == ch) break; ++t; --n;
20 }
21 return t - s;
22}