1998-01-31 02:37:40 +03:00
|
|
|
.\" Copyright (c) 1990, 1991, 1993
|
|
|
|
.\" The Regents of the University of California. All rights reserved.
|
1993-03-21 12:45:37 +03:00
|
|
|
.\"
|
|
|
|
.\" This code is derived from software contributed to Berkeley by
|
|
|
|
.\" Chris Torek.
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
2003-08-07 20:42:00 +04:00
|
|
|
.\" 3. Neither the name of the University nor the names of its contributors
|
1993-03-21 12:45:37 +03:00
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
1998-01-31 02:37:40 +03:00
|
|
|
.\" from: @(#)index.3 8.1 (Berkeley) 6/4/93
|
2006-10-16 12:48:45 +04:00
|
|
|
.\" $NetBSD: index.3,v 1.12 2006/10/16 08:48:45 wiz Exp $
|
1993-03-21 12:45:37 +03:00
|
|
|
.\"
|
1998-01-31 02:37:40 +03:00
|
|
|
.Dd June 4, 1993
|
1993-03-21 12:45:37 +03:00
|
|
|
.Dt INDEX 3
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm index
|
|
|
|
.Nd locate character in string
|
1998-02-05 21:45:17 +03:00
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libc
|
1993-03-21 12:45:37 +03:00
|
|
|
.Sh SYNOPSIS
|
2003-04-16 17:34:34 +04:00
|
|
|
.In strings.h
|
1993-03-21 12:45:37 +03:00
|
|
|
.Ft char *
|
|
|
|
.Fn index "const char *s" "int c"
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Fn index
|
|
|
|
function
|
|
|
|
locates the first character matching
|
|
|
|
.Fa c
|
|
|
|
(converted to a
|
|
|
|
.Em char )
|
2006-10-16 12:48:45 +04:00
|
|
|
in the nul-terminated string
|
1993-03-21 12:45:37 +03:00
|
|
|
.Fa s .
|
|
|
|
.Sh RETURN VALUES
|
1998-01-31 02:37:40 +03:00
|
|
|
A pointer to the character is returned if it is found; otherwise
|
1993-03-21 12:45:37 +03:00
|
|
|
.Dv NULL
|
|
|
|
is returned.
|
|
|
|
If
|
|
|
|
.Fa c
|
|
|
|
is '\e0',
|
|
|
|
.Fn index
|
|
|
|
locates the terminating '\e0'.
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr memchr 3 ,
|
|
|
|
.Xr rindex 3 ,
|
|
|
|
.Xr strchr 3 ,
|
|
|
|
.Xr strcspn 3 ,
|
|
|
|
.Xr strpbrk 3 ,
|
|
|
|
.Xr strrchr 3 ,
|
|
|
|
.Xr strsep 3 ,
|
|
|
|
.Xr strspn 3 ,
|
|
|
|
.Xr strstr 3 ,
|
|
|
|
.Xr strtok 3
|
|
|
|
.Sh HISTORY
|
1997-12-06 11:47:05 +03:00
|
|
|
An
|
1993-03-21 12:45:37 +03:00
|
|
|
.Fn index
|
2001-09-16 05:41:09 +04:00
|
|
|
function appeared in
|
1993-03-21 12:45:37 +03:00
|
|
|
.At v6 .
|