strchrnul(3)

NAME
strchrnul - string search character or NUL

LIBRARY
Standard C library (libc, -lc)

SYNOPSIS
#define _GNU_SOURCE  /* See feature_test_macros(7) */
#include <string.h>

char *strchrnul(const char *s, int c);

DESCRIPTION
The strchrnul() function is like strchr(3) except that if c is not found in s, then it returns a pointer to the null byte at the end of s.

It is equivalent to both of the following expressions:

    strchr(s, c) ?: strnul(s)
    s + strcspn(s, (char [2]){c, '\0'})

RETURN VALUE
The strchrnul() function returns a pointer to the matched character, or a pointer to the null byte at the end of s if the character is not found.

ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7).
Interface | Attribute | Value
 | Thread safety | MT-Safe

STANDARDS
GNU.

HISTORY
glibc 2.1.1, FreeBSD 10, NetBSD 8.

SEE ALSO
string(3), strchr(3), strnul(3), strcspn(3), strspn(3)