diff options
Diffstat (limited to '')
-rw-r--r-- | src/libmdsserver/util.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libmdsserver/util.h b/src/libmdsserver/util.h index da2cb9f..1b533bb 100644 --- a/src/libmdsserver/util.h +++ b/src/libmdsserver/util.h @@ -92,6 +92,18 @@ int full_write(int fd, const char* buffer, size_t length); */ char* full_read(int fd); +/** + * Check whether a string begins with a specific string, + * where neither of the strings are necessarily NUL-terminated + * + * @param haystack The string that should start with the other string + * @param needle The string the first string should start with + * @param haystack_n The length of `haystack` + * @param needle_n The length of `needle` + * @return Whether the `haystack` begins with `needle` + */ +int startswith_n(const char* haystack, const char* needle, size_t haystack_n, size_t needle_n) __attribute__((pure)); + #endif |