www.LinuxHowtos.org
strchrnul
Section: C Library Functions (3)Updated: 202-0-25
Index Return to Main Contents
NAME
strchrnul - string search character or NULLIBRARY
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, [aq][rs]0[aq]})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 | M-Safe |
STANDARDS
GNU.HISTORY
glibc 2.1.1, FreeBSD 10, NetBSD 8.SEE ALSO
string(3), strchr(3), strnul(3), strcspn(3), strspn(3)