}
#endif
+#ifndef HAVE_STRCHRNUL
+const char *openconnect__strchrnul(const char *s, int c)
+{
+ while (*s && *s++ != c);
+ return s;
+}
+#endif
+
#ifndef HAVE_INET_ATON
/* XX: unlike "real" inet_aton(), inet_pton() only accepts dotted-decimal notation, not
* looser/rarer formats like 32-bit decimal values. For example, inet_aton() accepts both
[symver_getline="openconnect__getline;"])
AC_CHECK_FUNC(strcasestr, [AC_DEFINE(HAVE_STRCASESTR, 1, [Have strcasestr() function])], [])
AC_CHECK_FUNC(strndup, [AC_DEFINE(HAVE_STRNDUP, 1, [Have strndup() function])], [])
+AC_CHECK_FUNC(strchrnul, [AC_DEFINE(HAVE_STRCHRNUL, 1, [Have strchrnul() function])], [])
AC_CHECK_FUNC(asprintf, [AC_DEFINE(HAVE_ASPRINTF, 1, [Have asprintf() function])],
[symver_asprintf="openconnect__asprintf;"])
AC_CHECK_FUNC(vasprintf, [AC_DEFINE(HAVE_VASPRINTF, 1, [Have vasprintf() function])],
const char *found, *comma;
for (f = query; *f; f=(*endf) ? endf+1 : endf) {
- endf = strchr(f, '&') ? : f+strlen(f);
+ endf = strchrnul(f, '&');
eq = strchr(f, '=');
if (!eq || eq > endf)
eq = endf;
for (found = incexc; *found; found=(*comma) ? comma+1 : comma) {
- comma = strchr(found, ',') ? : found+strlen(found);
+ comma = strchrnul(found, ',');
if (!strncmp(found, f, MAX(comma-found, eq-f)))
break;
}
#define strndup openconnect__strndup
char *openconnect__strndup(const char *s, size_t n);
#endif
+#ifndef HAVE_STRCHRNUL
+#undef strchrnul
+#define strchrnul openconnect__strchrnul
+const char *openconnect__strchrnul(const char *s, int c);
+#endif
#ifndef HAVE_INET_ATON
#define inet_aton openconnect__inet_aton