summaryrefslogtreecommitdiff
path: root/src/string/strnlen_s.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/string/strnlen_s.c')
-rw-r--r--src/string/strnlen_s.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/string/strnlen_s.c b/src/string/strnlen_s.c
new file mode 100644
index 00000000..f1221961
--- /dev/null
+++ b/src/string/strnlen_s.c
@@ -0,0 +1,17 @@
+#include "string.h"
+
+size_t strnlen_s(const char *s, size_t maxsize)
+{
+ __C_EXT(1, 201112L);
+ size_t i = 0;
+ while (i < maxlen) {
+ if (s[i] == '\0')
+ return i;
+ i++;
+ }
+ return i;
+}
+
+/*
+CEXT1(201112)
+*/