OSDN Git Service

(split) LDP man-pages の original/ を v3.30 に更新。
[linuxjm/LDP_man-pages.git] / original / man3 / strchr.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
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.
6 .\"
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.
11 .\"
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
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" References consulted:
24 .\"     Linux libc source code
25 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
26 .\"     386BSD man pages
27 .\" Modified Mon Apr 12 12:51:24 1993, David Metcalfe
28 .\" 2006-05-19, Justin Pryzby <pryzbyj@justinpryzby.com>
29 .\"     Document strchrnul(3).
30 .\"
31 .TH STRCHR 3  2010-09-20 "GNU" "Linux Programmer's Manual"
32 .SH NAME
33 strchr, strrchr, strchrnul \- locate character in string
34 .SH SYNOPSIS
35 .nf
36 .B #include <string.h>
37 .sp
38 .BI "char *strchr(const char *" s ", int " c );
39 .sp
40 .BI "char *strrchr(const char *" s ", int " c );
41 .sp
42 .BR "#define _GNU_SOURCE" "         /* See feature_test_macros(7) */"
43 .B #include <string.h>
44 .sp
45 .BI "char *strchrnul(const char *" s ", int " c );
46 .fi
47 .SH DESCRIPTION
48 The
49 .BR strchr ()
50 function returns a pointer to the first occurrence
51 of the character \fIc\fP in the string \fIs\fP.
52 .PP
53 The
54 .BR strrchr ()
55 function returns a pointer to the last occurrence
56 of the character \fIc\fP in the string \fIs\fP.
57 .PP
58 The
59 .BR strchrnul ()
60 function is like
61 .BR strchr ()
62 except that if \fIc\fP is not found in \fIs\fP,
63 then it returns a pointer to the null byte
64 at the end of \fIs\fP, rather than NULL.
65 .PP
66 Here "character" means "byte"; these functions do not work with
67 wide or multibyte characters.
68 .SH "RETURN VALUE"
69 The
70 .BR strchr ()
71 and
72 .BR strrchr ()
73 functions return a pointer to
74 the matched character or NULL if the character is not found.
75
76 The
77 .BR strchrnul ()
78 function returns a pointer to
79 the matched character,
80 or a pointer to the null
81 byte at the end of \fIs\fP (i.e., \fIs+strlen(s)\fP)
82 if the character is not found.
83 .SH VERSIONS
84 .BR strchrnul ()
85 first appeared in glibc in version 2.1.1.
86 .SH "CONFORMING TO"
87 .BR strchr ()
88 and
89 .BR strrchr ()
90 are in SVr4, 4.3BSD, C89, C99.
91 .BR strchrnul ()
92 is a GNU extension.
93 .SH "SEE ALSO"
94 .BR index (3),
95 .BR memchr (3),
96 .BR rindex (3),
97 .BR string (3),
98 .BR strlen (3),
99 .BR strpbrk (3),
100 .BR strsep (3),
101 .BR strspn (3),
102 .BR strstr (3),
103 .BR strtok (3),
104 .BR wcschr (3),
105 .BR wcsrchr (3)