summaryrefslogtreecommitdiff
path: root/src/string/strtok_s.c
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2020-08-16 15:55:19 -0400
committerJakob Kaivo <jkk@ung.org>2020-08-16 15:55:19 -0400
commite223e635cc53fa11e473cdbc864eb69a3da5f290 (patch)
treed481ca6fb0b7f4184f3ec259a6f9c37d76e56a26 /src/string/strtok_s.c
parent700fbd205a1a428677876d322606b9a354221892 (diff)
add skeleton of symbols from C11 LIB_EXT1
Diffstat (limited to 'src/string/strtok_s.c')
-rw-r--r--src/string/strtok_s.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/string/strtok_s.c b/src/string/strtok_s.c
new file mode 100644
index 00000000..9742d09c
--- /dev/null
+++ b/src/string/strtok_s.c
@@ -0,0 +1,26 @@
+#include "string.h"
+#include "stddef.h"
+
+char * strtok_s(char * restrict s1, rsize_t * restrict s1max, const char * restrict s2, char **restrict ptr)
+{
+ __C_EXT(1, 201112L);
+ int i = 0;
+
+ if (s == NULL)
+ s = *lasts;
+
+ while (i < strlen (s)) {
+ if (strchr (sep, s[i]) == NULL) {
+ i++;
+ } else {
+ s[i] = '\0';
+ *lasts = &(s[i+1]);
+ return s;
+ }
+ }
+ return NULL;
+}
+
+/*
+CEXT1(201112)
+*/