]> rtime.felk.cvut.cz Git - jailhouse.git/blobdiff - inmates/lib/string.c
Merge remote-tracking branch 'kiszka/master'
[jailhouse.git] / inmates / lib / string.c
index af80517a4c83abf252933cc47dedb5e86f78f340..781614089efee08d5b87eb4cab3d648ff85ac552 100644 (file)
@@ -20,3 +20,29 @@ void *memset(void *s, int c, unsigned long n)
                *p++ = c;
        return s;
 }
+
+unsigned long strlen(const char *s1)
+{
+       unsigned long len = 0;
+
+       while (*s1++)
+               len++;
+
+       return len;
+}
+
+int strncmp(const char *s1, const char *s2, unsigned long n)
+{
+       int diff;
+
+       while (n-- > 0) {
+               diff = *s1 - *s2;
+               if (diff)
+                       return diff;
+               if (*s1 == 0)
+                       break;
+               s1++;
+               s2++;
+       }
+       return 0;
+}