Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Apr 2015 00:24:22 +0000 (UTC)
From:      Allan Jude <allanjude@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r281570 - stable/10/lib/libc/string
Message-ID:  <201504160024.t3G0OMu5088819@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: allanjude (doc committer)
Date: Thu Apr 16 00:24:21 2015
New Revision: 281570
URL: https://svnweb.freebsd.org/changeset/base/281570

Log:
  MFC: r266671, r266725:
  	Merge strcspn.3 into strspn.3 and clarify the explaination
  
  Approved by:	eadler (mentor, implicit)
  Sponsored by:	ScaleEngine Inc.

Deleted:
  stable/10/lib/libc/string/strcspn.3
Modified:
  stable/10/lib/libc/string/Makefile.inc
  stable/10/lib/libc/string/strspn.3
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/string/Makefile.inc
==============================================================================
--- stable/10/lib/libc/string/Makefile.inc	Wed Apr 15 22:17:16 2015	(r281569)
+++ stable/10/lib/libc/string/Makefile.inc	Thu Apr 16 00:24:21 2015	(r281570)
@@ -30,7 +30,7 @@ SYM_MAPS+=	${.CURDIR}/string/Symbol.map
 
 MAN+=	bcmp.3 bcopy.3 bstring.3 bzero.3 ffs.3 index.3 memccpy.3 memchr.3 \
 	memcmp.3 memcpy.3 memmem.3 memmove.3 memset.3 strcasecmp.3 strcat.3 \
-	strchr.3 strcmp.3 strcoll.3 strcpy.3 strcspn.3 strdup.3 strerror.3 \
+	strchr.3 strcmp.3 strcoll.3 strcpy.3 strdup.3 strerror.3 \
 	string.3 strlcpy.3 strlen.3 strmode.3 strpbrk.3 strsep.3 \
 	strspn.3 strstr.3 strtok.3 strxfrm.3 swab.3 wcscoll.3 wcstok.3 \
 	wcswidth.3 wcsxfrm.3 wmemchr.3
@@ -60,6 +60,7 @@ MLINKS+=strerror.3 perror.3 \
 	strerror.3 sys_nerr.3
 MLINKS+=strlcpy.3 strlcat.3
 MLINKS+=strlen.3 strnlen.3
+MLINKS+=strspn.3 strcspn.3
 MLINKS+=strstr.3 strcasestr.3 \
 	strstr.3 strnstr.3 \
 	strstr.3 strcasestr_l.3

Modified: stable/10/lib/libc/string/strspn.3
==============================================================================
--- stable/10/lib/libc/string/strspn.3	Wed Apr 15 22:17:16 2015	(r281569)
+++ stable/10/lib/libc/string/strspn.3	Thu Apr 16 00:24:21 2015	(r281570)
@@ -32,11 +32,12 @@
 .\"     @(#)strspn.3	8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd June 4, 1993
+.Dd May 24, 2014
 .Dt STRSPN 3
 .Os
 .Sh NAME
-.Nm strspn
+.Nm strspn ,
+.Nm strcspn
 .Nd span a string
 .Sh LIBRARY
 .Lb libc
@@ -44,6 +45,8 @@
 .In string.h
 .Ft size_t
 .Fn strspn "const char *s" "const char *charset"
+.Ft size_t
+.Fn strcspn "const char *s" "const char *charset"
 .Sh DESCRIPTION
 The
 .Fn strspn
@@ -54,22 +57,44 @@ as long as the characters from
 .Fa s
 occur in the null-terminated string
 .Fa charset .
-In other words, it computes the string array index in
-.Fa s
+In other words, it computes the string array index
 of the first character of
 .Fa s
 which is not in
 .Fa charset ,
 else the index of the first null character.
+.Pp
+The
+.Fn strcspn
+function
+spans the initial part of the null-terminated string
+.Fa s
+as long as the characters from
+.Fa s
+.Sy do not 
+occur in the null-terminated string
+.Fa charset
+.Po it spans the
+.Sy complement
+of
+.Fa charset
+.Pc .
+In other words, it computes the string array index
+of the first character of
+.Fa s
+which is also in
+.Fa charset ,
+else the index of the first null character.
 .Sh RETURN VALUES
 The
 .Fn strspn
-function
-returns the number of characters spanned.
+and
+.Fn strcspn
+functions
+return the number of characters spanned.
 .Sh SEE ALSO
 .Xr memchr 3 ,
 .Xr strchr 3 ,
-.Xr strcspn 3 ,
 .Xr strpbrk 3 ,
 .Xr strrchr 3 ,
 .Xr strsep 3 ,
@@ -79,6 +104,8 @@ returns the number of characters spanned
 .Sh STANDARDS
 The
 .Fn strspn
-function
-conforms to
+and
+.Fn strcspn
+functions
+conform to
 .St -isoC .



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504160024.t3G0OMu5088819>