diff --git a/py/objstr.c b/py/objstr.c
index be1f00e686b98563884ecc4d62f796a01a3f8711..48a21c9caf67085229b213ec99626f9c978bdf91 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -3,6 +3,7 @@
 #include <stdarg.h>
 #include <string.h>
 #include <assert.h>
+#include <sys/types.h>
 
 #include "nlr.h"
 #include "misc.h"
diff --git a/stm/std.h b/stm/std.h
index 587b9f88802b85404fb65ea25bf1257598970a3f..95c606e0584d38fd77a208e87b2f1cc7117ca075 100644
--- a/stm/std.h
+++ b/stm/std.h
@@ -17,6 +17,8 @@ int strncmp(const char *s1, const char *s2, size_t n);
 char *strndup(const char *s, size_t n);
 char *strcpy(char *dest, const char *src);
 char *strcat(char *dest, const char *src);
+char *strchr(const char *s, int c);
+char *strstr(const char *haystack, const char *needle);
 
 int printf(const char *fmt, ...);
 int snprintf(char *str, size_t size, const char *fmt, ...);
diff --git a/stm/string0.c b/stm/string0.c
index 2a5f255971bca2e833cff87251605673c65592d0..d67c5f2b172572acf638e6e788c46a121fe5d2b2 100644
--- a/stm/string0.c
+++ b/stm/string0.c
@@ -108,3 +108,31 @@ char *strcat(char *dest, const char *src) {
     *d = '\0';
     return dest;
 }
+
+// Public Domain implementation of strchr from:
+// http://en.wikibooks.org/wiki/C_Programming/Strings#The_strchr_function
+char *strchr(const char *s, int c)
+{
+    /* Scan s for the character.  When this loop is finished,
+       s will either point to the end of the string or the
+       character we were looking for.  */
+    while (*s != '\0' && *s != (char)c)
+        s++;
+    return ((*s == c) ? (char *) s : 0);
+}
+
+
+// Public Domain implementation of strstr from:
+// http://en.wikibooks.org/wiki/C_Programming/Strings#The_strstr_function
+char *strstr(const char *haystack, const char *needle)
+{
+    size_t needlelen;
+    /* Check for the null needle case.  */
+    if (*needle == '\0')
+        return (char *) haystack;
+    needlelen = strlen(needle);
+    for (; (haystack = strchr(haystack, *needle)) != 0; haystack++)
+        if (strncmp(haystack, needle, needlelen) == 0)
+            return (char *) haystack;
+    return 0;
+}