@@ -56,6 +56,17 @@ int (strcmp)(const char *_s1, const char *_s2)
return (s1 < s2) ? -1 : (s1 > s2);
}
+int (strncmp)(const char *_s1, const char *_s2, size_t n)
+{
+ size_t ctr;
+ for (ctr = 0; ctr < n; ctr++) {
+ if (_s1[ctr] != _s2[ctr])
+ return (int)(_s1[ctr] - _s2[ctr]);
+ }
+
+ return 0;
+}
+
void *(memset)(void *s, int c, size_t n)
{
char *p = s;
@@ -26,6 +26,9 @@ char *strncpy(char *dst, const char *src, size_t n);
int strcmp(const char *s1, const char *s2);
#define strcmp(s1, s2) __builtin_strcmp(s1, s2)
+int strncmp(const char *s1, const char *s2, size_t n);
+#define strncmp(s1, s2, n) __builtin_strncmp(s1, s2, n)
+
void *memset(void *s, int c, size_t n);
#define memset(d, c, n) __builtin_memset(d, c, n)
Signed-off-by: Pawel Wieczorkiewicz <wipawel@amazon.de> --- common/libc/string.c | 11 +++++++++++ include/xtf/libc.h | 3 +++ 2 files changed, 14 insertions(+)