home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / ansi / string / strchr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-23  |  390 b   |  21 lines

  1. /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
  2. /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
  3. #include <string.h>
  4. #include <libc/unconst.h>
  5.  
  6. char *
  7. strchr(const char *s, int c)
  8. {
  9.   char cc = c;
  10.   while (*s)
  11.   {
  12.     if (*s == cc)
  13.       return unconst(s, char *);
  14.     s++;
  15.   }
  16.   if (cc == 0)
  17.     return unconst(s, char *);
  18.   return 0;
  19. }
  20.  
  21.