|
@ -33,14 +33,14 @@ |
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
|
.\" SUCH DAMAGE. |
|
|
.\" SUCH DAMAGE. |
|
|
.\" |
|
|
.\" |
|
|
.\" $OpenBSD: strchr.3,v 1.3 1997/12/29 22:31:50 deraadt Exp $ |
|
|
|
|
|
|
|
|
.\" $OpenBSD: strchr.3,v 1.4 1999/06/04 17:26:26 aaron Exp $ |
|
|
.\" |
|
|
.\" |
|
|
.Dd June 29, 1991 |
|
|
.Dd June 29, 1991 |
|
|
.Dt STRCHR 3 |
|
|
.Dt STRCHR 3 |
|
|
.Os |
|
|
.Os |
|
|
.Sh NAME |
|
|
.Sh NAME |
|
|
.Nm strchr |
|
|
.Nm strchr |
|
|
.Nd locate character in string |
|
|
|
|
|
|
|
|
.Nd locate first occurence of a character in a string |
|
|
.Sh SYNOPSIS |
|
|
.Sh SYNOPSIS |
|
|
.Fd #include <string.h> |
|
|
.Fd #include <string.h> |
|
|
.Ft char * |
|
|
.Ft char * |
|
@ -48,13 +48,11 @@ |
|
|
.Sh DESCRIPTION |
|
|
.Sh DESCRIPTION |
|
|
The |
|
|
The |
|
|
.Fn strchr |
|
|
.Fn strchr |
|
|
function locates the first occurrence of |
|
|
|
|
|
.Ar c |
|
|
|
|
|
in the string pointed to by |
|
|
|
|
|
.Ar s . |
|
|
|
|
|
The terminating |
|
|
|
|
|
.Dv NUL |
|
|
|
|
|
character is considered part of the string. |
|
|
|
|
|
|
|
|
function locates the first occurrence of the character |
|
|
|
|
|
.Fa c |
|
|
|
|
|
in the string |
|
|
|
|
|
.Fa s . |
|
|
|
|
|
The terminating NUL character is considered part of the string. |
|
|
If |
|
|
If |
|
|
.Fa c |
|
|
.Fa c |
|
|
is |
|
|
is |
|
@ -63,11 +61,23 @@ is |
|
|
locates the terminating |
|
|
locates the terminating |
|
|
.Ql \e0 . |
|
|
.Ql \e0 . |
|
|
.Sh RETURN VALUES |
|
|
.Sh RETURN VALUES |
|
|
The function |
|
|
|
|
|
|
|
|
The |
|
|
.Fn strchr |
|
|
.Fn strchr |
|
|
returns a pointer to the located character, or |
|
|
|
|
|
|
|
|
function returns a pointer to the located character or |
|
|
.Dv NULL |
|
|
.Dv NULL |
|
|
if the character does not appear in the string. |
|
|
if the character does not appear in the string. |
|
|
|
|
|
.Sh EXAMPLES |
|
|
|
|
|
After the following call to |
|
|
|
|
|
.Fn strchr , |
|
|
|
|
|
.Va p |
|
|
|
|
|
will point to the string |
|
|
|
|
|
.Qq oobar : |
|
|
|
|
|
.Bd -literal -offset indent |
|
|
|
|
|
char *p; |
|
|
|
|
|
char *s = "foobar"; |
|
|
|
|
|
|
|
|
|
|
|
p = strchr(s, 'o'); |
|
|
|
|
|
.Ed |
|
|
.Sh SEE ALSO |
|
|
.Sh SEE ALSO |
|
|
.Xr index 3 , |
|
|
.Xr index 3 , |
|
|
.Xr memchr 3 , |
|
|
.Xr memchr 3 , |
|
|