home *** CD-ROM | disk | FTP | other *** search
/ linuxmafia.com 2016 / linuxmafia.com.tar / linuxmafia.com / pub / palmos / pippy-0.6beta-src.tar.gz / pippy-0.6beta-src.tar / pippy-0.6beta-src / src / Palm / libc / strstr.c < prev    next >
C/C++ Source or Header  |  2000-12-21  |  430b  |  29 lines

  1. /*
  2.  *  linux/lib/string.c
  3.  *
  4.  *  Copyright (C) 1991, 1992  Linus Torvalds
  5.  */
  6.  
  7. #include <sys/types.h>
  8. #include <string.h>
  9. #include <ctype.h>
  10.  
  11. #ifndef __HAVE_ARCH_STRSTR
  12. char * strstr(const char * s1,const char * s2)
  13. {
  14.   int l1, l2;
  15.   
  16.   l2 = strlen(s2);
  17.   if (!l2)
  18.     return (char *) s1;
  19.   l1 = strlen(s1);
  20.   while (l1 >= l2) {
  21.     l1--;
  22.     if (!memcmp(s1,s2,l2))
  23.       return (char *) s1;
  24.     s1++;
  25.   }
  26.   return NULL;
  27. }
  28. #endif
  29.