Added description of strcasestr().

This commit is contained in:
Michael Kerrisk 2005-04-05 14:01:07 +00:00
parent bbcdba9c19
commit 7257eeb80e
1 changed files with 18 additions and 5 deletions

View File

@ -26,8 +26,9 @@
.\" 386BSD man pages
.\" Modified Sat Jul 24 17:56:43 1993 by Rik Faith (faith@cs.unc.edu)
.\" Added history, aeb, 980113.
.\" 2005-05-05 mtk: added strcasestr()
.\"
.TH STRSTR 3 1993-04-12 "GNU" "Linux Programmer's Manual"
.TH STRSTR 3 2005-04-05 "GNU" "Linux Programmer's Manual"
.SH NAME
strstr \- locate a substring
.SH SYNOPSIS
@ -35,25 +36,37 @@ strstr \- locate a substring
.B #include <string.h>
.sp
.BI "char *strstr(const char *" haystack ", const char *" needle );
.sp
.B #define _GNU_SOURCE
.sp
.B #include <string.h>
.sp
.BI "char *strcasestr(const char *" haystack ", const char *" needle );
.fi
.SH DESCRIPTION
The \fBstrstr()\fP function finds the first occurrence of the substring
\fIneedle\fP in the string \fIhaystack\fP. The terminating `\\0'
\fIneedle\fP in the string \fIhaystack\fP. The terminating \`\\0'
characters are not compared.
The \fBstrcasestr()\fP function is like \fBstrstr()\fP,
but ignores the case of both arguments.
.SH "RETURN VALUE"
The \fBstrstr()\fP function returns a pointer to the beginning of the
These functions return a pointer to the beginning of the
substring, or NULL if the substring is not found.
.SH BUGS
Early versions of Linux libc (like 4.5.26) would not allow
an empty argument. Later versions (like 4.6.27) work correctly,
an empty \fIneedle\fP argument for \fBstrstr()\fP.
Later versions (like 4.6.27) work correctly,
and return \fIhaystack\fP when \fIneedle\fP is empty.
.SH "CONFORMING TO"
ISO 9899
The \fBstrstr()\fP function conforms to ISO 9899.
The \fBstrcasestr()\fP function is a non-standard extension.
.SH "SEE ALSO"
.BR index (3),
.BR memchr (3),
.BR rindex (3),
.BR strchr (3),
.BR strcasecmp (3),
.BR strpbrk (3),
.BR strsep (3),
.BR strspn (3),