home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 387b.lha / dice_v2.02 / lib / string / strstr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-30  |  357 b   |  26 lines

  1.  
  2. /*
  3.  *  STRSTR.C        find one string in another
  4.  *
  5.  *  (c)Copyright 1990, Matthew Dillon, All Rights Reserved
  6.  */
  7.  
  8. #include <string.h>
  9. #include <errno.h>
  10.  
  11. char *
  12. strstr(s1, s2)
  13. const char *s1;
  14. const char *s2;
  15. {
  16.     short len2 = strlen(s2);
  17.  
  18.     while (*s1) {
  19.     if (*s1 == *s2 && strncmp(s1, s2, len2) == 0)
  20.         return(s1);
  21.     ++s1;
  22.     }
  23.     return(NULL);
  24. }
  25.  
  26.