Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
  2. #include <string.h>
  3. #include <libc/unconst.h>
  4.  
  5. char *
  6. strstr(const char *s, const char *find)
  7. {
  8.   char c, sc;
  9.   size_t len;
  10.  
  11.   if ((c = *find++) != 0)
  12.   {
  13.     len = strlen(find);
  14.     do {
  15.       do {
  16.         if ((sc = *s++) == 0)
  17.           return 0;
  18.       } while (sc != c);
  19.     } while (strncmp(s, find, len) != 0);
  20.     s--;
  21.   }
  22.   return unconst(s, char *);
  23. }
  24.