+/*
+ * Chops a substring from an existing string by creating a
+ * copy of it and null terminating it at the required position.
+ */
+char *util_strchp(const char *s, const char *e) {
+ if (!s || !e)
+ return NULL;
+
+ size_t m = 0;
+ char *c = util_strdup(s);
+ while (s != e)
+ s++,c++,m++;
+
+ *c = '\0';
+ return c-m;
+}
+