Loading...
string/index.3 Libc-262 Libc-583
--- Libc/Libc-262/string/index.3
+++ Libc/Libc-583/string/index.3
@@ -32,42 +32,56 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)index.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/string/index.3,v 1.6 2001/10/01 16:09:00 ru Exp $
+.\" $FreeBSD: src/lib/libc/string/index.3,v 1.11 2003/09/08 19:57:15 ru Exp $
 .\"
 .Dd June 4, 1993
 .Dt INDEX 3
 .Os
 .Sh NAME
-.Nm index
+.Nm index , rindex
 .Nd locate character in string
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In string.h
-.Ft char *
+.In strings.h
+.Ft "char *"
 .Fn index "const char *s" "int c"
+.Ft "char *"
+.Fn rindex "const char *s" "int c"
 .Sh DESCRIPTION
 The
 .Fn index
 function
-locates the first character matching
+locates the first occurrence of
 .Fa c
 (converted to a
-.Em char )
-in the null-terminated string
+.Vt char )
+in the string pointed to by
 .Fa s .
+The terminating null character is considered to be part of the string;
+therefore, if
+.Fa c
+is
+.Ql \e0 ,
+the functions locate the terminating
+.Ql \e0 .
+.Pp
+The
+.Fn rindex
+function is identical to
+.Fn index ,
+except that it locates the last occurrence of
+.Fa c .
 .Sh RETURN VALUES
-A pointer to the character is returned if it is found; otherwise
+The functions
+.Fn index
+and
+.Fn rindex
+return a pointer to the located character, or
 .Dv NULL
-is returned.
-If
-.Fa c
-is '\e0',
-.Fn index
-locates the terminating '\e0'.
+if the character does not appear in the string.
 .Sh SEE ALSO
 .Xr memchr 3 ,
-.Xr rindex 3 ,
 .Xr strchr 3 ,
 .Xr strcspn 3 ,
 .Xr strpbrk 3 ,
@@ -77,7 +91,16 @@
 .Xr strstr 3 ,
 .Xr strtok 3
 .Sh HISTORY
-A
+The
 .Fn index
-function appeared in
+and
+.Fn rindex
+functions appeared in
 .At v6 .
+Their prototypes existed previously in
+.In string.h
+before they were moved to
+.In strings.h
+for
+.St -p1003.1-2001
+compliance.