home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Source / GNU / libg++ / libiberty / strrchr.c < prev    next >
C/C++ Source or Header  |  1993-06-29  |  1KB  |  57 lines

  1. /* Portable version of strrchr().
  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. NAME
  23.  
  24.     strrchr -- return pointer to last occurance of a character
  25.  
  26. SYNOPSIS
  27.  
  28.     char *strrchr (const char *s, int c)
  29.  
  30. DESCRIPTION
  31.  
  32.     Returns a pointer to the last occurance of character C in
  33.     string S, or a NULL pointer if no occurance is found.
  34.     
  35. BUGS
  36.  
  37.     Behavior when character is the null character is implementation
  38.     dependent.
  39.  
  40. */
  41.  
  42. #include <ansidecl.h>
  43.  
  44. char *
  45. strrchr (s, c)
  46.   register CONST char *s;
  47.   int c;
  48. {
  49.   char *rtnval = 0;
  50.  
  51.   do {
  52.     if (*s == c)
  53.       rtnval = s;
  54.   } while (*s++);
  55.   return (rtnval);
  56. }
  57.