2002-02-04 Jeff Johnston <jjohnstn@redhat.com>
[binutils.git] / libiberty / strchr.c
blob1f71c5143d08814b675d80e01a886e6741a4276c
1 /* Portable version of strchr()
2 This function is in the public domain. */
4 /*
6 @deftypefn Supplemental char* strchr (const char *@var{s}, int @var{c})
8 Returns a pointer to the first occurrence of the character @var{c} in
9 the string @var{s}, or @code{NULL} if not found. If @var{c} is itself the
10 null character, the results are undefined.
12 @end deftypefn
16 #include <ansidecl.h>
18 char *
19 strchr (s, c)
20 register const char *s;
21 int c;
23 do {
24 if (*s == c)
26 return (char*)s;
28 } while (*s++);
29 return (0);