summaryrefslogtreecommitdiff
path: root/lib/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util.c')
-rw-r--r--lib/util.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/util.c b/lib/util.c
index a77e2ff..49f9175 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -28,6 +28,19 @@ char* _bmStrdup(const char *string)
}
/**
+ * Replaces next token in string with '\0' and returns position for the replaced token.
+ *
+ * @param string C "string" where token will be replaced.
+ * @return Position of the replaced token.
+ */
+size_t _bmStripToken(char *string, const char *token)
+{
+ size_t len = strcspn(string, token);
+ string[len] = 0;
+ return len;
+}
+
+/**
* Portable case-insensitive strcmp.
*
* @param hay C "string" to match against.