home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 6 / FreshFish_September1994.bin / bbs / gnu / pdksh-4.9-src.lha / GNU / src / amiga / pdksh-4.9 / std / stdc / strchr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-04  |  477 b   |  23 lines

  1. #include <string.h>
  2. /* $Id: strchr.c,v 1.3 93/05/05 21:18:33 sjg Exp $ */
  3.  
  4. /*
  5.  * strchr - find first occurrence of a character in a string
  6.  */
  7.  
  8. char *                /* found char, or NULL if none */
  9. strchr(s, charwanted)
  10. const char *s;
  11. register char charwanted;
  12. {
  13.     register const char *scan;
  14.  
  15.     /*
  16.      * The odd placement of the two tests is so NUL is findable.
  17.      */
  18.     for (scan = s; *scan != charwanted;)    /* ++ moved down for opt. */
  19.         if (*scan++ == '\0')
  20.             return(NULL);
  21.     return(scan);
  22. }
  23.