aboutsummaryrefslogtreecommitdiffstats
path: root/include/string.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/string.h')
-rw-r--r--include/string.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/include/string.h b/include/string.h
index 676a721..a351e8d 100644
--- a/include/string.h
+++ b/include/string.h
@@ -1013,6 +1013,65 @@ char* stpbrk(const char*, const char*)
__GCC_ONLY(__attribute__((warn_unused_result, nonnull)));
+/**
+ * Tokenise a string.
+ *
+ * @param string The string to tokenise on the first,
+ * `NULL` on subsequent calls.
+ * All bytes found in `delimiters` will
+ * be overriden with NUL bytes.
+ * @param delimiters Delimiting bytes (not characters).
+ * @return The next non-empty string that does not
+ * contain a byte from `delimiters`. The
+ * returned string will be as long as possible.
+ * `NULL` is returned the search as reached
+ * the end of the string, and there therefore
+ * are no more tokens.
+ */
+char* strtok(char* restrict, const char* restrict)
+ __GCC_ONLY(__attribute__((warn_unused_result, nonnull(2))));
+
+/**
+ * Tokenise a string.
+ *
+ * @param string The string to tokenise on the first,
+ * `NULL` on subsequent calls.
+ * All bytes found in `delimiters` will
+ * be overriden with NUL bytes.
+ * @param delimiters Delimiting bytes (not characters).
+ * @param state Pointer to a `char*` that the function
+ * can use to keep track of its state.
+ * It is reasonable to make it point to `NULL`
+ * on the first call.
+ * @return The next non-empty string that does not
+ * contain a byte from `delimiters`. The
+ * returned string will be as long as possible.
+ * `NULL` is returned the search as reached
+ * the end of the string, and there therefore
+ * are no more tokens.
+ */
+char* strtok_r(char* restrict, const char* restrict, char** restrict)
+ __GCC_ONLY(__attribute__((warn_unused_result, nonnull(2, 3))));
+
+/**
+ * Tokenise a string.
+ *
+ * @param string Pointer to the string to tokenise on the first call,
+ * will be updated to keep track of the state.
+ * All bytes found in `delimiters` will
+ * be overriden with NUL bytes.
+ * @param delimiters Delimiting bytes (not characters).
+ * @return The next, possibly empty, string that does
+ * not contain a byte from `delimiters`. The
+ * returned string will be as long as possible.
+ * `NULL` is returned the search as reached
+ * the end of the string, and there therefore
+ * are no more tokens.
+ */
+char* strsep(char** restrict, const char* restrict)
+ __GCC_ONLY(__attribute__((warn_unused_result, nonnull)));
+
+
#endif