From c88a3c97ff4c5282f689123a0940716a98479888 Mon Sep 17 00:00:00 2001 From: Benjamin Gaignard Date: Thu, 1 Nov 2012 16:47:43 +0100 Subject: modetest: Add internal strchrnul implementation bionic doesn't provide strchrnul(), add an internal implementation to support Android builds. Signed-off-by: Benjamin Gaignard [Add configure check for strchrnul] Signed-off-by: Laurent Pinchart --- configure.ac | 1 + tests/modetest/modetest.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/configure.ac b/configure.ac index 8c28107a..fc53e8c3 100644 --- a/configure.ac +++ b/configure.ac @@ -141,6 +141,7 @@ AC_CHECK_FUNCS([clock_gettime], [CLOCK_LIB=], AC_SUBST([CLOCK_LIB]) AC_CHECK_FUNCS([open_memstream], [HAVE_OPEN_MEMSTREAM=yes]) +AC_CHECK_FUNCS([strchrnul], [HAVE_STRCHRNUL=yes]) dnl Use lots of warning flags with with gcc and compatible compilers diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index c111c791..a8ba076c 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -843,6 +843,15 @@ static char optstr[] = "ecpmfs:P:v"; #define min(a, b) ((a) < (b) ? (a) : (b)) +#ifndef HAVE_STRCHRNUL +static char *strchrnul(const char *s, int c) +{ + while (*s && *s != c) + s++; + return (char *)s; +} +#endif + static int parse_connector(struct connector *c, const char *arg) { unsigned int len; -- cgit v1.2.3