2 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\" References consulted:
7 .\" Linux libc source code
8 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
10 .\" Modified Mon Apr 12 12:51:24 1993, David Metcalfe
11 .\" 2006-05-19, Justin Pryzby <pryzbyj@justinpryzby.com>
12 .\" Document strchrnul(3).
14 .TH strchr 3 (date) "Linux man-pages (unreleased)"
16 strchr, strrchr, strchrnul \- locate character in string
19 .RI ( libc ", " \-lc )
22 .B #include <string.h>
24 .BI "char *strchr(const char *" s ", int " c );
25 .BI "char *strrchr(const char *" s ", int " c );
27 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
28 .B #include <string.h>
30 .BI "char *strchrnul(const char *" s ", int " c );
35 function returns a pointer to the first occurrence
43 function returns a pointer to the last occurrence
57 then it returns a pointer to the null byte
62 Here "character" means "byte"; these functions do not work with
63 wide or multibyte characters.
69 functions return a pointer to
70 the matched character or NULL if the character is not found.
71 The terminating null byte is considered part of the string,
74 is specified as \[aq]\e0\[aq],
75 these functions return a pointer to the terminator.
79 function returns a pointer to the matched character,
80 or a pointer to the null byte at the end of
84 if the character is not found.
86 For an explanation of the terms used in this section, see
92 Interface Attribute Value
99 T} Thread safety MT-Safe
115 POSIX.1-2001, C89, SVr4, 4.3BSD.