URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 149 |
Rev 154 |
extern void abort (void);
|
extern void abort (void);
|
extern int inside_main;
|
extern int inside_main;
|
|
|
char *
|
char *
|
strstr(const char *s1, const char *s2)
|
strstr(const char *s1, const char *s2)
|
{
|
{
|
const char *p, *q;
|
const char *p, *q;
|
|
|
#ifdef __OPTIMIZE__
|
#ifdef __OPTIMIZE__
|
if (inside_main)
|
if (inside_main)
|
abort ();
|
abort ();
|
#endif
|
#endif
|
|
|
/* deliberately dumb algorithm */
|
/* deliberately dumb algorithm */
|
for (; *s1; s1++)
|
for (; *s1; s1++)
|
{
|
{
|
p = s1, q = s2;
|
p = s1, q = s2;
|
while (*q && *p)
|
while (*q && *p)
|
{
|
{
|
if (*q != *p)
|
if (*q != *p)
|
break;
|
break;
|
p++, q++;
|
p++, q++;
|
}
|
}
|
if (*q == 0)
|
if (*q == 0)
|
return (char *)s1;
|
return (char *)s1;
|
}
|
}
|
return 0;
|
return 0;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.