summaryrefslogtreecommitdiff
path: root/libgcompat
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2018-06-13 05:45:49 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2018-06-13 05:45:49 -0500
commitb01b4ec70f3e4d4a4648207e414a8f9eef8073e9 (patch)
treef0c9eb7668bcedc94c2fd316502d13a3fab6af73 /libgcompat
parent7435d175f409d3e41f7a0d3365ac725a6a00f2c5 (diff)
downloadgcompat-b01b4ec70f3e4d4a4648207e414a8f9eef8073e9.tar.gz
gcompat-b01b4ec70f3e4d4a4648207e414a8f9eef8073e9.tar.bz2
gcompat-b01b4ec70f3e4d4a4648207e414a8f9eef8073e9.tar.xz
gcompat-b01b4ec70f3e4d4a4648207e414a8f9eef8073e9.zip
string: add __strcspn_c2
Diffstat (limited to 'libgcompat')
-rw-r--r--libgcompat/string.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/libgcompat/string.c b/libgcompat/string.c
index 1d387a8..5a1e558 100644
--- a/libgcompat/string.c
+++ b/libgcompat/string.c
@@ -178,6 +178,23 @@ char *__strcpy_chk(char *dest, const char *src, size_t destlen)
}
/**
+ * Find the substring length of a string that does not have any two characters.
+ *
+ * Not defined in LSB 5.0. Used by spotify-client.
+ */
+size_t __strcspn_c2(const char *str, int bad, int bad2)
+{
+ size_t length = 0;
+ const char *s = str;
+ while(*s != bad && *s != bad2 && *s != '\0')
+ {
+ length++;
+ s++;
+ }
+ return length;
+}
+
+/**
* Concatenate a string with part of another, with buffer overflow checking.
*
* LSB 5.0: LSB-Core-generic/baselib---strncat-chk-1.html