'\" t .\" Copyright, the authors of the Linux man-pages project .\" .\" SPDX-License-Identifier: Linux-man-pages-copyleft .\" .TH strchrnul 3 2026-02-25 "Linux man-pages 6.19" .SH NAME strchrnul \- string search character or NUL .SH LIBRARY Standard C library .RI ( libc ,\~ \-lc ) .SH SYNOPSIS .nf .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */" .B #include .P .BI "char *strchrnul(const char *" s ", int " c ); .fi .SH DESCRIPTION The .BR strchrnul () function is like .BR strchr (3) except that if .I c is not found in .IR s , then it returns a pointer to the null byte at the end of .IR s . .P It is equivalent to both of the following expressions: .P .in +4n .EX strchr(s, c) ?: strnul(s) s + strcspn(s, (char [2]){c, \[aq]\[rs]0\[aq]}) .EE .in .SH RETURN VALUE The .BR strchrnul () function returns a pointer to the matched character, or a pointer to the null byte at the end of .I s if the character is not found. .SH ATTRIBUTES For an explanation of the terms used in this section, see .BR attributes (7). .TS allbox; lbx lb lb l l l. Interface Attribute Value T{ .na .nh .BR strchrnul () T} Thread safety MT-Safe .TE .SH STANDARDS GNU. .SH HISTORY glibc 2.1.1, FreeBSD 10, NetBSD 8. .SH SEE ALSO .BR string (3), .BR strchr (3), .BR strnul (3), .BR strcspn (3), .BR strspn (3)