xref: /netbsd-src/lib/libc/string/rindex.3 (revision cf2f172048b0ec98455634d1998367f568fafeac)
15f8a6c06Sperry.\" Copyright (c) 1990, 1991, 1993
25f8a6c06Sperry.\"	The Regents of the University of California.  All rights reserved.
361f28255Scgd.\"
461f28255Scgd.\" This code is derived from software contributed to Berkeley by
561f28255Scgd.\" Chris Torek.
661f28255Scgd.\" Redistribution and use in source and binary forms, with or without
761f28255Scgd.\" modification, are permitted provided that the following conditions
861f28255Scgd.\" are met:
961f28255Scgd.\" 1. Redistributions of source code must retain the above copyright
1061f28255Scgd.\"    notice, this list of conditions and the following disclaimer.
1161f28255Scgd.\" 2. Redistributions in binary form must reproduce the above copyright
1261f28255Scgd.\"    notice, this list of conditions and the following disclaimer in the
1361f28255Scgd.\"    documentation and/or other materials provided with the distribution.
14eb7c1594Sagc.\" 3. Neither the name of the University nor the names of its contributors
1561f28255Scgd.\"    may be used to endorse or promote products derived from this software
1661f28255Scgd.\"    without specific prior written permission.
1761f28255Scgd.\"
1861f28255Scgd.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1961f28255Scgd.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2061f28255Scgd.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2161f28255Scgd.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2261f28255Scgd.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2361f28255Scgd.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2461f28255Scgd.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2561f28255Scgd.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2661f28255Scgd.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2761f28255Scgd.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2861f28255Scgd.\" SUCH DAMAGE.
2961f28255Scgd.\"
305f8a6c06Sperry.\"     from: @(#)rindex.3	8.1 (Berkeley) 6/4/93
31*cf2f1720Sdholland.\"	$NetBSD: rindex.3,v 1.14 2012/05/05 21:18:43 dholland Exp $
3261f28255Scgd.\"
33*cf2f1720Sdholland.Dd May 5, 2012
3461f28255Scgd.Dt RINDEX 3
3561f28255Scgd.Os
3661f28255Scgd.Sh NAME
3761f28255Scgd.Nm rindex
3861f28255Scgd.Nd locate character in string
39312aca53Sperry.Sh LIBRARY
40312aca53Sperry.Lb libc
4161f28255Scgd.Sh SYNOPSIS
42472351e1Swiz.In strings.h
4361f28255Scgd.Ft char *
4461f28255Scgd.Fn rindex "const char *s" "int c"
4561f28255Scgd.Sh DESCRIPTION
4661f28255ScgdThe
4761f28255Scgd.Fn rindex
4861f28255Scgdfunction
4961f28255Scgdlocates the last character
5061f28255Scgdmatching
5161f28255Scgd.Fa c
5261f28255Scgd(converted to a
5361f28255Scgd.Em char )
541a64d82dSwizin the nul-terminated string
5561f28255Scgd.Fa s .
56aa368b88Sdholland.Pp
57aa368b88SdhollandThis function is obsolete.
58aa368b88SdhollandThe equivalent function
59aa368b88Sdholland.Xr strrchr 3
60aa368b88Sdhollandshould be used instead.
615f8a6c06Sperry.Sh RETURN VALUES
625f8a6c06SperryA pointer to the character is returned if it is found; otherwise
631a64d82dSwiz.Dv NULL
641a64d82dSwizis returned.
6561f28255ScgdIf
6661f28255Scgd.Fa c
6761f28255Scgdis
6861f28255Scgd.Ql \e0 ,
6961f28255Scgd.Fn rindex
7061f28255Scgdlocates the terminating
7161f28255Scgd.Ql \e0 .
7261f28255Scgd.Sh SEE ALSO
7361f28255Scgd.Xr index 3 ,
7461f28255Scgd.Xr memchr 3 ,
7561f28255Scgd.Xr strchr 3 ,
7661f28255Scgd.Xr strcspn 3 ,
7761f28255Scgd.Xr strpbrk 3 ,
7861f28255Scgd.Xr strrchr 3 ,
7961f28255Scgd.Xr strsep 3 ,
8061f28255Scgd.Xr strspn 3 ,
8161f28255Scgd.Xr strstr 3 ,
8261f28255Scgd.Xr strtok 3
83157d0c3eSjruoho.Sh STANDARDS
84157d0c3eSjruohoThe
85157d0c3eSjruoho.Fn rindex
86157d0c3eSjruohofunction conforms to
87157d0c3eSjruoho.St -p1003.1-2001 .
88157d0c3eSjruohoThe
89157d0c3eSjruoho.St -p1003.1-2004
90157d0c3eSjruohorevision marked it as legacy and recommended the use of
91157d0c3eSjruoho.Xr strrchr 3
92157d0c3eSjruohoinstead.
93157d0c3eSjruohoThe
94157d0c3eSjruoho.St -p1003.1-2008
95157d0c3eSjruohorevision removed
96157d0c3eSjruoho.Fn rindex
97157d0c3eSjruohofrom the specification.
9861f28255Scgd.Sh HISTORY
9961f28255ScgdA
10061f28255Scgd.Fn rindex
10161f28255Scgdfunction appeared in
10261f28255Scgd.At v6 .
103