1extern void abort (void); 2extern int inside_main; 3 4__attribute__ ((__noinline__)) 5char * 6strstr(const char *s1, const char *s2) 7{ 8 const char *p, *q; 9 10#ifdef __OPTIMIZE__ 11 if (inside_main) 12 abort (); 13#endif 14 15 /* deliberately dumb algorithm */ 16 for (; *s1; s1++) 17 { 18 p = s1, q = s2; 19 while (*q && *p) 20 { 21 if (*q != *p) 22 break; 23 p++, q++; 24 } 25 if (*q == 0) 26 return (char *)s1; 27 } 28 return 0; 29} 30