strchr.c 345 B

123456789101112131415161718
  1. /*
  2. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3. * See the copyright notice in the ACK home directory, in the file "Copyright".
  4. */
  5. /* $Id$ */
  6. #include <string.h>
  7. char *
  8. strchr(register const char *s, register int c)
  9. {
  10. c = (char) c;
  11. while (c != *s) {
  12. if (*s++ == '\0') return NULL;
  13. }
  14. return (char *)s;
  15. }