home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 1.ddi / CLIBSRC1.ZIP / STRPBRK.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1.5 KB  |  53 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - strpbrk.c
  3.  *
  4.  * function(s)
  5.  *        strpbrk - scans a string for the first occurrence of
  6.  *                  any character a given set
  7.  *-----------------------------------------------------------------------*/
  8.  
  9. /*
  10.  *      C/C++ Run Time Library - Version 5.0
  11.  *
  12.  *      Copyright (c) 1987, 1992 by Borland International
  13.  *      All Rights Reserved.
  14.  *
  15.  */
  16.  
  17.  
  18. #include <string.h>
  19.  
  20. /*---------------------------------------------------------------------*
  21.  
  22. Name            strpbrk - scans a string for the first occurrence of
  23.                           any character a given set
  24.  
  25. Usage           char *strpbrk(const char *str1, const char *str2);
  26.  
  27. Prototype in    string.h
  28.  
  29. Description     strpbrk scans a string, str1, for the first occurrence of any
  30.                 character appearing in str2.
  31.  
  32. Return value    strpbrk returns a pointer to the first occurrence of any of
  33.                 the characters in str2; if none of the str2 characters occurs
  34.                 in str1, it returns NULL.
  35.  
  36. *---------------------------------------------------------------------*/
  37. #if defined(__FARFUNCS__)
  38. #include <_farfunc.h>
  39. #endif
  40.  
  41. char _FAR * _CType _FARFUNC strpbrk(const char _FAR *s1, const char _FAR *s2)
  42. {
  43.         register const char *srchs2;
  44.  
  45.         while (*s1)
  46.         {
  47.                 for (srchs2 = s2; *srchs2; srchs2++)
  48.                         if (*s1 == *srchs2) return((char *)s1);
  49.                 s1++;
  50.         }
  51.         return (0);
  52. }
  53.