From 195b26986e3c19e916bf0991a1af7ae87d43010b Mon Sep 17 00:00:00 2001 From: Robert Mustacchi Date: Fri, 19 Dec 2014 23:04:08 +0000 Subject: [PATCH] 3841 strnstr() needs a man page Reviewed by: Jerry Jelinek Approved by: Richard Lowe --- usr/src/man/man3c/Makefile | 2 ++ usr/src/man/man3c/string.3c | 15 ++++++++++----- usr/src/man/man3lib/libc.3lib | 8 ++++---- usr/src/pkg/manifests/system-library.man3c.inc | 1 + 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/usr/src/man/man3c/Makefile b/usr/src/man/man3c/Makefile index 856cf5e168..3aa6291375 100644 --- a/usr/src/man/man3c/Makefile +++ b/usr/src/man/man3c/Makefile @@ -1141,6 +1141,7 @@ MANLINKS= FD_CLR.3c \ strncmp.3c \ strncpy.3c \ strnlen.3c \ + strnstr.3c \ strpbrk.3c \ strptime_l.3c \ strrchr.3c \ @@ -2125,6 +2126,7 @@ strncat.3c := LINKSRC = string.3c strncmp.3c := LINKSRC = string.3c strncpy.3c := LINKSRC = string.3c strnlen.3c := LINKSRC = string.3c +strnstr.3c := LINKSRC = string.3c strpbrk.3c := LINKSRC = string.3c strrchr.3c := LINKSRC = string.3c strsep.3c := LINKSRC = string.3c diff --git a/usr/src/man/man3c/string.3c b/usr/src/man/man3c/string.3c index 4c31ca5f81..145fc54ea1 100644 --- a/usr/src/man/man3c/string.3c +++ b/usr/src/man/man3c/string.3c @@ -1,5 +1,6 @@ '\" te .\" Copyright 2014 Garrett D'Amore +.\" Copyright (c) 2014, Joyent, Inc. .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved. .\" Copyright 1989 AT&T .\" Portions Copyright (c) 1994 Man-cgi 1.15, Panagiotis Christias (christia@softlab.ntua.gr) @@ -17,7 +18,7 @@ string, strcasecmp, strcasecmp_l, strncasecmp, strncasecmp_l, strcat, strncat, strlcat, strchr, strrchr, strcmp, strncmp, strcpy, strncpy, strlcpy, strcspn, strspn, strdup, strlen, -strnlen, strpbrk, strsep, strstr, strtok, strtok_r \- string operations +strnlen, strpbrk, strsep, strstr, strnstr, strtok, strtok_r \- string operations .SH SYNOPSIS .LP .nf @@ -113,6 +114,10 @@ strnlen, strpbrk, strsep, strstr, strtok, strtok_r \- string operations .fi .LP .nf +\fBchar *\fR\fBstrnstr\fR(\fBconst char *\fR\fIs1\fR, \fBconst char *\fR\fIs2\fR, \fBsize_t\fR \fIn\fR); +.fi +.LP +.nf \fBchar *\fR\fBstrtok\fR(\fBchar *restrict\fR \fIs1\fR, \fBconst char *restrict\fR \fIs2\fR); .fi .LP @@ -166,7 +171,6 @@ characters terminated by a null character). The \fBstrcat()\fR, all alter their first argument. Additionally, the \fBstrcat()\fR and \fBstrcpy()\fR functions do not check for overflow of the array. .SS "\fBstrcasecmp()\fR, \fBstrncasecmp()\fR" -.sp .LP The \fBstrcasecmp()\fR and \fBstrncasecmp()\fR functions are case-insensitive versions of \fBstrcmp()\fR and \fBstrncmp()\fR respectively, described below. @@ -276,7 +280,6 @@ passed to \fBfree()\fR. The space for the new string is obtained using returned and \fBerrno\fR may be set to \fBENOMEM\fR to indicate that the storage space available is insufficient. .SS "\fBstrlen()\fR, \fBstrnlen()\fR" -.sp The \fBstrlen()\fR function returns the number of bytes in \fIs\fR, not including the terminating null character. .LP @@ -303,13 +306,15 @@ detected by comparing the location referenced by the pointer returned by \fBstrsep()\fR to `\e0'. .LP If *\fIstringp\fR is initially \fINULL\fR, \fBstrsep()\fR returns \fINULL\fR. -.SS "\fBstrstr()\fR" +.SS "\fBstrstr()\fR, \fBstrnstr()\fR" .LP The \fBstrstr()\fR function locates the first occurrence of the string \fIs2\fR (excluding the terminating null character) in string \fIs1\fR and returns a pointer to the located string, or a null pointer if the string is not found. If \fIs2\fR points to a string with zero length (that is, the string \fB""\fR), -the function returns \fIs1\fR. +the function returns \fIs1\fR. The \fBstrnstr()\fR function performs the same +search as \fBstrstr()\fR, but only considers up to \fIn\fR bytes of \fIs1\fR. +Bytes following a null byte are not compared. .SS "\fBstrtok()\fR" .LP A sequence of calls to \fBstrtok()\fR breaks the string pointed to by \fIs1\fR diff --git a/usr/src/man/man3lib/libc.3lib b/usr/src/man/man3lib/libc.3lib index c5784825d1..d4065bda51 100644 --- a/usr/src/man/man3lib/libc.3lib +++ b/usr/src/man/man3lib/libc.3lib @@ -671,10 +671,10 @@ l l . \fBstrftime\fR \fBstrftime_l\fR \fBstring_to_decimal\fR \fBstrlcat\fR \fBstrlcpy\fR -\fBstrlen\fR -\fBstrncasecmp\fR \fBstrncasecmp_l\fR -\fBstrncat\fR \fBstrncmp\fR -\fBstrncpy\fR \fBstrpbrk\fR +\fBstrlen\fR \fBstrncasecmp\fR +\fBstrncasecmp_l\fR \fBstrncat\fR +\fBstrncmp\fR \fBstrncpy\fR +\fBstrnstr\fR \fBstrpbrk\fR \fBstrptime\fR \fBstrptime_l\fR \fBstrrchr\fR \fBstrsep\fR \fBstrsignal\fR \fBstrspn\fR diff --git a/usr/src/pkg/manifests/system-library.man3c.inc b/usr/src/pkg/manifests/system-library.man3c.inc index 9f7475a8d4..a00e4e1d79 100644 --- a/usr/src/pkg/manifests/system-library.man3c.inc +++ b/usr/src/pkg/manifests/system-library.man3c.inc @@ -1210,6 +1210,7 @@ link path=usr/share/man/man3c/strncat.3c target=string.3c link path=usr/share/man/man3c/strncmp.3c target=string.3c link path=usr/share/man/man3c/strncpy.3c target=string.3c link path=usr/share/man/man3c/strnlen.3c target=string.3c +link path=usr/share/man/man3c/strnstr.3c target=string.3c link path=usr/share/man/man3c/strpbrk.3c target=string.3c link path=usr/share/man/man3c/strptime_l.3c target=strptime.3c link path=usr/share/man/man3c/strrchr.3c target=string.3c -- 2.11.4.GIT