summaryrefslogtreecommitdiff
path: root/common.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-07-09 00:10:06 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-07-09 00:10:06 +0200
commitf907f1e3dcf7d6922cee4433297c3b4249d899e6 (patch)
tree35d431a76d0ac53cc9f3dd6647858ec8c724529b /common.c
parentd3b1754e14b6508bddfda674edecbffdafe3d4f8 (diff)
downloadxK-f907f1e3dcf7d6922cee4433297c3b4249d899e6.tar.gz
xK-f907f1e3dcf7d6922cee4433297c3b4249d899e6.tar.xz
xK-f907f1e3dcf7d6922cee4433297c3b4249d899e6.zip
Add str_cut_until()
Diffstat (limited to 'common.c')
-rw-r--r--common.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/common.c b/common.c
index 94d5aa4..12e1eff 100644
--- a/common.c
+++ b/common.c
@@ -65,6 +65,12 @@ transform_str (char *s, int (*tolower) (int c))
*s = tolower (*s);
}
+static char *
+str_cut_until (const char *s, const char *alphabet)
+{
+ return xstrndup (s, strcspn (s, alphabet));
+}
+
static void
split_str (const char *s, char delimiter, struct str_vector *out)
{