home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d110 / pdc.lha / Pdc / lib / strchr.c < prev    next >
Text File  |  1987-10-28  |  547b  |  22 lines

  1. /*
  2.  * strchr - find first occurrence of a character in a string
  3.  */
  4.  
  5. #define  NULL      0
  6.  
  7. char *                                 /* found char, or NULL if none */
  8. strchr(s, charwanted)
  9. CONST char *s;
  10. register char charwanted;
  11. {
  12.          register CONST char *scan;
  13.  
  14.          /*
  15.           * The odd placement of the two tests is so NUL is findable.
  16.           */
  17.          for (scan = s; *scan != charwanted;)    /* ++ moved down for opt. */
  18.                    if (*scan++ == '\0')
  19.                              return(NULL);
  20.          return(scan);
  21. }
  22.