1*98b9484cSchristos /* Portable version of strchr() 2*98b9484cSchristos This function is in the public domain. */ 3*98b9484cSchristos 4*98b9484cSchristos /* 5*98b9484cSchristos 6*98b9484cSchristos @deftypefn Supplemental char* strchr (const char *@var{s}, int @var{c}) 7*98b9484cSchristos 8*98b9484cSchristos Returns a pointer to the first occurrence of the character @var{c} in 9*98b9484cSchristos the string @var{s}, or @code{NULL} if not found. If @var{c} is itself the 10*98b9484cSchristos null character, the results are undefined. 11*98b9484cSchristos 12*98b9484cSchristos @end deftypefn 13*98b9484cSchristos 14*98b9484cSchristos */ 15*98b9484cSchristos 16*98b9484cSchristos #include <ansidecl.h> 17*98b9484cSchristos 18*98b9484cSchristos char * strchr(register const char * s,int c)19*98b9484cSchristosstrchr (register const char *s, int c) 20*98b9484cSchristos { 21*98b9484cSchristos do { 22*98b9484cSchristos if (*s == c) 23*98b9484cSchristos { 24*98b9484cSchristos return (char*)s; 25*98b9484cSchristos } 26*98b9484cSchristos } while (*s++); 27*98b9484cSchristos return (0); 28*98b9484cSchristos } 29