add m_strchrnul that does what GNU strchrnul does: search for 'c' or
[apps/madmutt.git] / lib-lib / str.h
index 296cd55..603e51b 100644 (file)
@@ -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++;