Obfuscate RCS ID matching so that CVS doesn't expand it.
[netbsd-mini2440.git] / dist / ntp / libopts / compat / strchr.c
blobedaa63f4e3c8b042c9758755c3c3718761626a59
1 /* $NetBSD$ */
3 /*
4 SYNOPSIS
5 #include <string.h>
7 char *strchr(char const *s, int c);
9 char *strrchr(char const *s, int c);
11 DESCRIPTION
12 The strchr() function returns a pointer to the first occurrence of the
13 character c in the string s.
15 The strrchr() function returns a pointer to the last occurrence of the
16 character c in the string s.
18 Here "character" means "byte" - these functions do not work with wide
19 or multi-byte characters.
21 RETURN VALUE
22 The strchr() and strrchr() functions return a pointer to the matched
23 character or NULL if the character is not found.
25 CONFORMING TO
26 SVID 3, POSIX, BSD 4.3, ISO 9899
29 char*
30 strchr( char const *s, int c)
32 do {
33 if ((unsigned)*s == (unsigned)c)
34 return s;
36 } while (*(++s) != NUL);
38 return NULL;
41 char*
42 strrchr( char const *s, int c)
44 char const *e = s + strlen(s);
46 for (;;) {
47 if (--e < s)
48 break;
50 if ((unsigned)*e == (unsigned)c)
51 return e;
53 return NULL;
57 * Local Variables:
58 * mode: C
59 * c-file-style: "stroustrup"
60 * indent-tabs-mode: nil
61 * End:
62 * end of compat/strsignal.c */