home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / gnu / libg++-2.5.3-src.lha / src / amiga / libg++-2.5.3 / libg++-2.5.3-amiga / libiberty / strchr.c < prev    next >
C/C++ Source or Header  |  1992-09-30  |  1KB  |  58 lines

  1. /* Portable version of strchr()
  2.    Copyright (C) 1991 Free Software Foundation, Inc.
  3.  
  4. This file is part of the libiberty library.
  5. Libiberty is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Library General Public
  7. License as published by the Free Software Foundation; either
  8. version 2 of the License, or (at your option) any later version.
  9.  
  10. Libiberty is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13. Library General Public License for more details.
  14.  
  15. You should have received a copy of the GNU Library General Public
  16. License along with libiberty; see the file COPYING.LIB.  If
  17. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  18. Cambridge, MA 02139, USA.  */
  19.  
  20.  
  21. /*
  22.  
  23. NAME
  24.  
  25.     strchr -- return pointer to first occurance of a character
  26.  
  27. SYNOPSIS
  28.  
  29.     char *strchr (const char *s, int c)
  30.  
  31. DESCRIPTION
  32.  
  33.     Returns a pointer to the first occurance of character C in
  34.     string S, or a NULL pointer if no occurance is found.
  35.     
  36. BUGS
  37.  
  38.     Behavior when character is the null character is implementation
  39.     dependent.
  40.  
  41. */
  42.  
  43. #include <ansidecl.h>
  44.  
  45. char *
  46. strchr (s, c)
  47.   register CONST char *s;
  48.   int c;
  49. {
  50.   do {
  51.     if (*s == c)
  52.       {
  53.     return (s);
  54.       }
  55.   } while (*s++);
  56.   return (0);
  57. }
  58.