]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) |
2 | .\" | |
93015253 | 3 | .\" %%%LICENSE_START(VERBATIM) |
fea681da MK |
4 | .\" Permission is granted to make and distribute verbatim copies of this |
5 | .\" manual provided the copyright notice and this permission notice are | |
6 | .\" preserved on all copies. | |
7 | .\" | |
8 | .\" Permission is granted to copy and distribute modified versions of this | |
9 | .\" manual under the conditions for verbatim copying, provided that the | |
10 | .\" entire resulting derived work is distributed under the terms of a | |
11 | .\" permission notice identical to this one. | |
c13182ef | 12 | .\" |
fea681da MK |
13 | .\" Since the Linux kernel and libraries are constantly changing, this |
14 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
15 | .\" responsibility for errors or omissions, or for damages resulting from | |
16 | .\" the use of the information contained herein. The author(s) may not | |
17 | .\" have taken the same level of care in the production of this manual, | |
18 | .\" which is licensed free of charge, as they might when working | |
19 | .\" professionally. | |
c13182ef | 20 | .\" |
fea681da MK |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 23 | .\" %%%LICENSE_END |
fea681da MK |
24 | .\" |
25 | .\" References consulted: | |
26 | .\" Linux libc source code | |
27 | .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) | |
28 | .\" 386BSD man pages | |
29 | .\" Modified Mon Apr 12 12:51:24 1993, David Metcalfe | |
a0bf3577 MK |
30 | .\" 2006-05-19, Justin Pryzby <pryzbyj@justinpryzby.com> |
31 | .\" Document strchrnul(3). | |
c13182ef | 32 | .\" |
4b8c67d9 | 33 | .TH STRCHR 3 2017-09-15 "GNU" "Linux Programmer's Manual" |
fea681da | 34 | .SH NAME |
e9d27e13 | 35 | strchr, strrchr, strchrnul \- locate character in string |
fea681da MK |
36 | .SH SYNOPSIS |
37 | .nf | |
38 | .B #include <string.h> | |
68e4db0a | 39 | .PP |
fea681da | 40 | .BI "char *strchr(const char *" s ", int " c ); |
68e4db0a | 41 | .PP |
fea681da | 42 | .BI "char *strrchr(const char *" s ", int " c ); |
f90f031e | 43 | |
b80f966b | 44 | .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */" |
e9d27e13 | 45 | .B #include <string.h> |
68e4db0a | 46 | .PP |
7145b9a9 | 47 | .BI "char *strchrnul(const char *" s ", int " c ); |
fea681da MK |
48 | .fi |
49 | .SH DESCRIPTION | |
60a90ecd MK |
50 | The |
51 | .BR strchr () | |
52 | function returns a pointer to the first occurrence | |
dc6a909b MK |
53 | of the character |
54 | .I c | |
55 | in the string | |
56 | .IR s . | |
fea681da | 57 | .PP |
60a90ecd MK |
58 | The |
59 | .BR strrchr () | |
60 | function returns a pointer to the last occurrence | |
dc6a909b MK |
61 | of the character |
62 | .I c | |
63 | in the string | |
64 | .IR s . | |
fea681da | 65 | .PP |
60a90ecd MK |
66 | The |
67 | .BR strchrnul () | |
68 | function is like | |
69 | .BR strchr () | |
dc6a909b MK |
70 | except that if |
71 | .I c | |
72 | is not found in | |
73 | .IR s , | |
c13182ef | 74 | then it returns a pointer to the null byte |
dc6a909b MK |
75 | at the end of |
76 | .IR s , | |
77 | rather than NULL. | |
e9d27e13 | 78 | .PP |
c65433e6 | 79 | Here "character" means "byte"; these functions do not work with |
ae03dc66 | 80 | wide or multibyte characters. |
47297adb | 81 | .SH RETURN VALUE |
60a90ecd MK |
82 | The |
83 | .BR strchr () | |
84 | and | |
85 | .BR strrchr () | |
86 | functions return a pointer to | |
fea681da | 87 | the matched character or NULL if the character is not found. |
2c4d293c JH |
88 | The terminating null byte is considered part of the string, |
89 | so that if | |
90 | .I c | |
91 | is specified as \(aq\\0\(aq, | |
92 | these functions return a pointer to the terminator. | |
847e0d88 | 93 | .PP |
60a90ecd MK |
94 | The |
95 | .BR strchrnul () | |
6c22b2c5 MK |
96 | function returns a pointer to the matched character, |
97 | or a pointer to the null byte at the end of | |
46d8df8e | 98 | .I s |
51700fd7 | 99 | (i.e., |
46d8df8e | 100 | .IR "s+strlen(s)" ) |
e9d27e13 | 101 | if the character is not found. |
266b5355 MK |
102 | .SH VERSIONS |
103 | .BR strchrnul () | |
104 | first appeared in glibc in version 2.1.1. | |
5745405b | 105 | .SH ATTRIBUTES |
00713037 PH |
106 | For an explanation of the terms used in this section, see |
107 | .BR attributes (7). | |
108 | .TS | |
109 | allbox; | |
110 | lbw32 lb lb | |
111 | l l l. | |
112 | Interface Attribute Value | |
113 | T{ | |
5745405b PH |
114 | .BR strchr (), |
115 | .BR strrchr (), | |
5745405b | 116 | .BR strchrnul () |
00713037 PH |
117 | T} Thread safety MT-Safe |
118 | .TE | |
47297adb | 119 | .SH CONFORMING TO |
3767e433 MK |
120 | .BR strchr (), |
121 | .BR strrchr (): | |
122 | POSIX.1-2001, POSIX.1-2008, C89, C99, SVr4, 4.3BSD. | |
847e0d88 | 123 | .PP |
60a90ecd MK |
124 | .BR strchrnul () |
125 | is a GNU extension. | |
47297adb | 126 | .SH SEE ALSO |
fea681da MK |
127 | .BR index (3), |
128 | .BR memchr (3), | |
129 | .BR rindex (3), | |
d095200e | 130 | .BR string (3), |
e9d27e13 | 131 | .BR strlen (3), |
fea681da MK |
132 | .BR strpbrk (3), |
133 | .BR strsep (3), | |
134 | .BR strspn (3), | |
135 | .BR strstr (3), | |
136 | .BR strtok (3), | |
137 | .BR wcschr (3), | |
0a4f8b7b | 138 | .BR wcsrchr (3) |