summaryrefslogtreecommitdiff
path: root/Master/tlpkg/lib/C/tlp-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/lib/C/tlp-utils.c')
-rw-r--r--Master/tlpkg/lib/C/tlp-utils.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/Master/tlpkg/lib/C/tlp-utils.c b/Master/tlpkg/lib/C/tlp-utils.c
index 5d24cfa42c9..eda65103584 100644
--- a/Master/tlpkg/lib/C/tlp-utils.c
+++ b/Master/tlpkg/lib/C/tlp-utils.c
@@ -11,6 +11,11 @@
#include <stdio.h>
#include <ctype.h>
+tlp_str tlp_str_from_bytes(const char *bytes)
+{
+ return (tlp_str) strdup(bytes);
+}
+
tlp_str tlp_str_copy(tlp_str str)
{
if (str == NULL)
@@ -67,6 +72,18 @@ int tlp_str_start_with(tlp_str str, tlp_str prefix)
(const char *) prefix, len);
}
+int tlp_str_start_with_bytes(tlp_str str, const char *prefix)
+{
+ tlp_str prefix_str;
+ int ret;
+
+ prefix_str = tlp_str_from_bytes(prefix);
+ ret = tlp_str_start_with(str, prefix_str);
+
+ tlp_str_free(prefix_str);
+ return ret;
+}
+
int tlp_char_is_space(tlp_char ch)
{
return isspace((int) ch);