aboutsummaryrefslogtreecommitdiff
path: root/str_chr.c
blob: 042dfa2f0770fe9836592c47aae40c3e07c1e1f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#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;
}