| 1 |
.\" Copyright, the authors of the Linux man-pages project |
| 2 |
.\" |
| 3 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 4 |
.\" |
| 5 |
.TH index 3 2025-09-21 "Linux man-pages 6.18" |
| 6 |
.SH NAME |
| 7 |
index, rindex \- locate character in string |
| 8 |
.SH LIBRARY |
| 9 |
Standard C library |
| 10 |
.RI ( libc ,\~ \-lc ) |
| 11 |
.SH SYNOPSIS |
| 12 |
.nf |
| 13 |
.B #include <strings.h> |
| 14 |
.P |
| 15 |
.BI "[[deprecated]] char *index(const char *" s ", int " c ); |
| 16 |
.BI "[[deprecated]] char *rindex(const char *" s ", int " c ); |
| 17 |
.fi |
| 18 |
.SH DESCRIPTION |
| 19 |
.BR index () |
| 20 |
is identical to |
| 21 |
.BR strchr (3). |
| 22 |
.P |
| 23 |
.BR rindex () |
| 24 |
is identical to |
| 25 |
.BR strrchr (3). |
| 26 |
.P |
| 27 |
Use |
| 28 |
.BR strchr (3) |
| 29 |
and |
| 30 |
.BR strrchr (3) |
| 31 |
instead of these functions. |
| 32 |
.SH STANDARDS |
| 33 |
None. |
| 34 |
.SH HISTORY |
| 35 |
4.3BSD; |
| 36 |
marked as LEGACY in POSIX.1-2001. |
| 37 |
Removed in POSIX.1-2008, |
| 38 |
recommending |
| 39 |
.BR strchr (3) |
| 40 |
and |
| 41 |
.BR strrchr (3) |
| 42 |
instead. |
| 43 |
.SH SEE ALSO |
| 44 |
.BR strchr (3), |
| 45 |
.BR strrchr (3) |