aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@linux.intel.com>2011-07-25 14:33:00 +0100
committerMatt Fleming <matt.fleming@linux.intel.com>2011-07-28 12:21:55 +0100
commitd070f3d778064e5d128954b81c2afb2dce7cbb8d (patch)
tree73336b4768fa6be0cb1304dd941f06b24b870bed
parentd88a088ff41963ebf4878f5e2a3248f8bd16d0c8 (diff)
downloadefilinux-d070f3d778064e5d128954b81c2afb2dce7cbb8d.tar.gz
stdlib.h: Add implementation of strstr
Signed-off-by: Matt Fleming <matt.fleming@linux.intel.com>
-rw-r--r--stdlib.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/stdlib.h b/stdlib.h
index bd0134d..a4ef517 100644
--- a/stdlib.h
+++ b/stdlib.h
@@ -34,5 +34,25 @@ static inline int strlen(char *str)
return len;
}
+static inline char *strstr(char *haystack, char *needle)
+{
+ char *p;
+ char *word = NULL;
+ int len = strlen(needle);
+
+ if (!len)
+ return NULL;
+
+ p = haystack;
+ while (*p) {
+ word = p;
+ if (!strncmpa((CHAR8 *)p, (CHAR8 *)needle, len))
+ break;
+ p++;
+ word = NULL;
+ }
+
+ return word;
+}
#endif /* __STDLIB_H__ */