]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/index.3
dist.mk, All pages: .TH: Generate date at 'make dist'
[thirdparty/man-pages.git] / man3 / index.3
CommitLineData
fea681da
MK
1.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2.\"
5fbde956 3.\" SPDX-License-Identifier: Linux-man-pages-copyleft
fea681da
MK
4.\"
5.\" References consulted:
6.\" Linux libc source code
7.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
8.\" 386BSD man pages
9.\" Modified Mon Apr 12 12:54:34 1993, David Metcalfe
10.\" Modified Sat Jul 24 19:13:52 1993, Rik Faith (faith@cs.unc.edu)
ab47278f 11.TH INDEX 3 (date) "Linux man-pages (unreleased)"
fea681da
MK
12.SH NAME
13index, rindex \- locate character in string
4508f8a0
AC
14.SH LIBRARY
15Standard C library
8fc3b2cf 16.RI ( libc ", " \-lc )
fea681da
MK
17.SH SYNOPSIS
18.nf
19.B #include <strings.h>
68e4db0a 20.PP
fea681da 21.BI "char *index(const char *" s ", int " c );
fea681da
MK
22.BI "char *rindex(const char *" s ", int " c );
23.fi
24.SH DESCRIPTION
60a90ecd
MK
25The
26.BR index ()
27function returns a pointer to the first occurrence
fea681da
MK
28of the character \fIc\fP in the string \fIs\fP.
29.PP
60a90ecd
MK
30The
31.BR rindex ()
32function returns a pointer to the last occurrence
fea681da
MK
33of the character \fIc\fP in the string \fIs\fP.
34.PP
d1a71985 35The terminating null byte (\(aq\e0\(aq) is considered to be a part of the
fea681da 36strings.
47297adb 37.SH RETURN VALUE
60a90ecd
MK
38The
39.BR index ()
40and
41.BR rindex ()
42functions return a pointer to
fea681da 43the matched character or NULL if the character is not found.
8cad35ef 44.SH ATTRIBUTES
52274086
MK
45For an explanation of the terms used in this section, see
46.BR attributes (7).
c466875e
MK
47.ad l
48.nh
52274086
MK
49.TS
50allbox;
c466875e 51lbx lb lb
52274086
MK
52l l l.
53Interface Attribute Value
54T{
55.BR index (),
8cad35ef 56.BR rindex ()
52274086
MK
57T} Thread safety MT-Safe
58.TE
c466875e
MK
59.hy
60.ad
61.sp 1
3113c7f3 62.SH STANDARDS
68e1685c 634.3BSD; marked as LEGACY in POSIX.1-2001.
64e082ef 64POSIX.1-2008 removes the specifications of
97c8e181
MK
65.BR index ()
66and
cbf4eee7
MK
67.BR rindex (),
68recommending
69.BR strchr (3)
70and
71.BR strrchr (3)
72instead.
47297adb 73.SH SEE ALSO
fea681da
MK
74.BR memchr (3),
75.BR strchr (3),
d095200e 76.BR string (3),
fea681da
MK
77.BR strpbrk (3),
78.BR strrchr (3),
79.BR strsep (3),
80.BR strspn (3),
81.BR strstr (3),
82.BR strtok (3)