From d40d2e47d8033cbf917d09c3865179870897e773 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Sun, 12 Nov 2006 13:15:44 +0100 Subject: [PATCH] add m_strchrnul that does what GNU strchrnul does: search for 'c' or return a pointer on the NUL char if not found Signed-off-by: Pierre Habouzit --- lib-lib/str.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib-lib/str.h b/lib-lib/str.h index 296cd55..603e51b 100644 --- a/lib-lib/str.h +++ b/lib-lib/str.h @@ -130,6 +130,12 @@ m_strncat(char *dst, ssize_t n, const char *src, ssize_t l) { /* parsing related */ /****************************************************************************/ +static inline const char *m_strchrnul(const char *s, int c) { + while (*s && *s != c) + s++; + return s; +} + static inline const char *skipspaces(const char *s) { while (*s && isspace((unsigned char)*s)) s++; -- 2.20.1