X-Git-Url: http://rtime.felk.cvut.cz/gitweb/jailhouse.git/blobdiff_plain/4e0ea74420900c7a66d265117b09fddbc3aaa754..f053c948f5b6fe7b9ec5cf6533e177fd42113ba3:/inmates/lib/string.c diff --git a/inmates/lib/string.c b/inmates/lib/string.c new file mode 100644 index 0000000..7816140 --- /dev/null +++ b/inmates/lib/string.c @@ -0,0 +1,48 @@ +/* + * Jailhouse, a Linux-based partitioning hypervisor + * + * Copyright (c) Siemens AG, 2016 + * + * Authors: + * Jan Kiszka + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + */ + +#include + +void *memset(void *s, int c, unsigned long n) +{ + u8 *p = s; + + while (n-- > 0) + *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; +}