File: str_rchr.c

package info (click to toggle)
tinydyndns 0.4.2.debian1-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,432 kB
  • sloc: ansic: 10,256; sh: 291; makefile: 42
file content (20 lines) | stat: -rw-r--r-- 409 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "str.h"

unsigned int str_rchr(register const char *s,int c)
{
  register char ch;
  register const char *t;
  register const char *u;

  ch = c;
  t = s;
  u = 0;
  for (;;) {
    if (!*t) break; if (*t == ch) u = t; ++t;
    if (!*t) break; if (*t == ch) u = t; ++t;
    if (!*t) break; if (*t == ch) u = t; ++t;
    if (!*t) break; if (*t == ch) u = t; ++t;
  }
  if (!u) u = t;
  return u - s;
}