summaryrefslogtreecommitdiff
path: root/src/wchar/wcscmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wchar/wcscmp.c')
-rw-r--r--src/wchar/wcscmp.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/wchar/wcscmp.c b/src/wchar/wcscmp.c
new file mode 100644
index 00000000..d07d9a10
--- /dev/null
+++ b/src/wchar/wcscmp.c
@@ -0,0 +1,25 @@
+#include <wchar.h>
+#include "nonstd/assert.h"
+
+int wcscmp(const wchar_t * s1, const wchar_t * s2)
+{
+ ASSERT_NONNULL(s1);
+ ASSERT_NONNULL(s2);
+
+ while (*s1 == *s2 && *s1 != L'\0') {
+ s1++;
+ s2++;
+ }
+
+ if (*s1 > *s2) {
+ return 1;
+ } else if (*s1 < *s2) {
+ return -1;
+ }
+
+ return 0;
+}
+
+/*
+STDC(199409)
+*/