summary refs log tree commit diff
path: root/src/str_chr.c
blob: 9b467ebd997834f49773bbb4783622ed36f1ce37 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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;
}