home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / compiler / clib / strpbrk.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-09  |  1.1 KB  |  65 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: strpbrk.c,v 1.1 1996/12/11 11:18:28 aros Exp $
  4.  
  5.     Desc: ANSI C function strpbrk()
  6.     Lang: english
  7. */
  8.  
  9. /*****************************************************************************
  10.  
  11.     NAME */
  12. #include <string.h>
  13.  
  14.     char * strpbrk (
  15.  
  16. /*  SYNOPSIS */
  17.     const char * str,
  18.     const char * accept)
  19.  
  20. /*  FUNCTION
  21.     Locate the first occurrence of any character in accept in str.
  22.  
  23.     INPUTS
  24.     str - Search this string
  25.     accept - Look for these characters
  26.  
  27.     RESULT
  28.     A pointer to the first occurence of any character in accept in str
  29.     or NULL if no character of accept is not found in str.
  30.  
  31.     NOTES
  32.  
  33.     EXAMPLE
  34.     char buffer[64];
  35.  
  36.     strcpy (buffer, "Hello ");
  37.  
  38.     // This returns a pointer to the first l in buffer.
  39.     strpbrk (buffer, "lo");
  40.  
  41.     // This returns NULL
  42.     strpbrk (buffer, "xyz");
  43.  
  44.     BUGS
  45.  
  46.     SEE ALSO
  47.     strchr(), strrchr()
  48.  
  49.     INTERNALS
  50.  
  51.     HISTORY
  52.  
  53. ******************************************************************************/
  54. {
  55.     while (*str)
  56.     {
  57.     if (strchr (accept, *str))
  58.         return ((char *)str);
  59.  
  60.     str ++;
  61.     }
  62.  
  63.     return(0);
  64. } /* strpbrk */
  65.