From: Jeremy Harris Date: Wed, 6 Dec 2023 12:25:14 +0000 (+0000) Subject: Supply strchrnul() for platforms apparently missing it X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/5930166b443390a522f210c2e60ec447a7dbd080 Supply strchrnul() for platforms apparently missing it Broken-by: 2658a023286f --- diff --git a/src/OS/os.h-FreeBSD b/src/OS/os.h-FreeBSD index 6756d42f6..11f8b1ae7 100644 --- a/src/OS/os.h-FreeBSD +++ b/src/OS/os.h-FreeBSD @@ -78,5 +78,7 @@ extern ssize_t os_sendfile(int, int, off_t *, size_t); /*******************/ #define EXIM_HAVE_KEVENT +#define EXIM_HAVE_STRCHRNUL + /* End */ diff --git a/src/OS/os.h-Linux b/src/OS/os.h-Linux index 25a12862b..cebda3367 100644 --- a/src/OS/os.h-Linux +++ b/src/OS/os.h-Linux @@ -102,4 +102,6 @@ then change the 0 to 1 in the next block. */ # define NS_MAXMSG 65535 #endif +#define EXIM_HAVE_STRCHRNUL + /* End */ diff --git a/src/src/os.c b/src/src/os.c index 5c52c6d4d..5e5899eeb 100644 --- a/src/src/os.c +++ b/src/src/os.c @@ -893,6 +893,21 @@ return buffer ? buffer : realloc(b, strlen(b) + 1); #endif /* ----------------------------------------------------------------------- */ +/*********************************************************** +* strchrnul() * +***********************************************************/ + +#if !defined(EXIM_HAVE_STRCHRNUL) +char * +strchrnul(const char * s, int c) +{ +while (*s != c && *s) s++ +return CS s; +} +#endif + + +/* ----------------------------------------------------------------------- */