strchrnul3
String search character or nul
Usage
#define _GNU_SOURCE /* See feature_test_macros(7) */ #include <string.h>
char *strchrnul(const char *s, int c);
Library
Standard C library (libc, -lc)
Overview
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 |
| strchrnul() | Thread safety | MT-Safe |
Releases
11 releases since Debian 4.0 (Etch); the text changed 10 times.