1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" References consulted:
24 .\" Linux libc source code
25 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
27 .\" Modified Mon Apr 12 12:51:24 1993, David Metcalfe
28 .\" 2006-05-19, Justin Pryzby <pryzbyj@justinpryzby.com>
29 .\" Document strchrnul(3).
31 .TH STRCHR 3 2012-04-24 "GNU" "Linux Programmer's Manual"
33 strchr, strrchr, strchrnul \- locate character in string
36 .B #include <string.h>
38 .BI "char *strchr(const char *" s ", int " c );
40 .BI "char *strrchr(const char *" s ", int " c );
42 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
43 .B #include <string.h>
45 .BI "char *strchrnul(const char *" s ", int " c );
50 function returns a pointer to the first occurrence
58 function returns a pointer to the last occurrence
72 then it returns a pointer to the null byte
77 Here "character" means "byte"; these functions do not work with
78 wide or multibyte characters.
84 functions return a pointer to
85 the matched character or NULL if the character is not found.
86 The terminating null byte is considered part of the string,
89 is specified as \(aq\\0\(aq,
90 these functions return a pointer to the terminator.
94 function returns a pointer to
95 the matched character,
96 or a pointer to the null
97 byte at the end of \fIs\fP (i.e., \fIs+strlen(s)\fP)
98 if the character is not found.
101 first appeared in glibc in version 2.1.1.
106 are in SVr4, 4.3BSD, C89, C99.