1 .\"  Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved  Portions Copyright (c) 1992, X/Open Company Limited  All Rights Reserved
   2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
   3 .\" http://www.opengroup.org/bookstore/.
   4 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
   5 .\"  This notice shall appear on any product containing this material.
   6 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
   7 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
   8 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
   9 .Dd "Jul 20, 2014"
  10 .Dt INDEX 3C
  11 .Os
  12 .Sh NAME
  13 .Nm index, rindex
  14 .Nd locate character in string
  15 .Sh SYNOPSIS
  16 .In strings.h
  17 .Ft char *
  18 .Fn index "const char *s" "int c"
  19 .Ft char *
  20 .Fn rindex "const char *s" "int c"
  21 .Sh DESCRIPTION
  22 The
  23 .Fn index
  24 and
  25 .Fn rindex
  26 functions operate on null-terminated strings.
  27 .Lp
  28 The
  29 .Fn index
  30 function returns a pointer to the first occurrence of
  31 character
  32 .Fa c
  33 in string
  34 .Fa s .
  35 .Lp
  36 The
  37 .Fn rindex
  38 function returns a pointer to the last occurrence of
  39 character
  40 .Fa c
  41 in string
  42 .Fa s .
  43 .Lp
  44 Both
  45 .Fn index
  46 and
  47 .Fa rindex
  48 return a null pointer if
  49 .Fa c
  50 does
  51 not occur in the string. The null character terminating a string is considered
  52 to be part of the string.
  53 .Sh USAGE
  54 The
  55 .Xr strchr 3C
  56 and
  57 .Xr strrchr 3C
  58 should be used in portable applications; those functions are specified in
  59 .St -isoC
  60 whereas these are not.
  61 .Sh INTERFACE STABILITY
  62 .Sy Obsolete Standard .
  63 .Sh MT-LEVEL
  64 .Sy Async-Signal-Safe .
  65 .Sh SEE ALSO
  66 .Xr bstring 3C ,
  67 .Xr malloc 3C ,
  68 .Xr string 3C ,
  69 .Xr standards 5
  70 .Sh STANDARDS
  71 These functions were part of
  72 .At v6 ,
  73 were added in
  74 .St -p1003.1-2001 ,
  75 and subsequently removed from
  76 .St -p1003.1-2008 .