diff options
author | allanjude <allanjude@FreeBSD.org> | 2015-04-16 00:24:21 +0000 |
---|---|---|
committer | allanjude <allanjude@FreeBSD.org> | 2015-04-16 00:24:21 +0000 |
commit | 8c0a1c61dbe6ed8885a003f2227099fc8398ad47 (patch) | |
tree | 9c7b495086f3b62025c2fc7faa23fb166e35963b /lib/libc/string | |
parent | 489ab0737e2b05f1aae06dd82ce25b9f94e8d195 (diff) | |
download | FreeBSD-src-8c0a1c61dbe6ed8885a003f2227099fc8398ad47.zip FreeBSD-src-8c0a1c61dbe6ed8885a003f2227099fc8398ad47.tar.gz |
MFC: r266671, r266725:
Merge strcspn.3 into strspn.3 and clarify the explaination
Approved by: eadler (mentor, implicit)
Sponsored by: ScaleEngine Inc.
Diffstat (limited to 'lib/libc/string')
-rw-r--r-- | lib/libc/string/Makefile.inc | 3 | ||||
-rw-r--r-- | lib/libc/string/strcspn.3 | 88 | ||||
-rw-r--r-- | lib/libc/string/strspn.3 | 45 |
3 files changed, 38 insertions, 98 deletions
diff --git a/lib/libc/string/Makefile.inc b/lib/libc/string/Makefile.inc index b997b7b..cc25c25 100644 --- a/lib/libc/string/Makefile.inc +++ b/lib/libc/string/Makefile.inc @@ -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 diff --git a/lib/libc/string/strcspn.3 b/lib/libc/string/strcspn.3 deleted file mode 100644 index 0331ca1..0000000 --- a/lib/libc/string/strcspn.3 +++ /dev/null @@ -1,88 +0,0 @@ -.\" Copyright (c) 1990, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Chris Torek and the American National Standards Committee X3, -.\" on Information Processing Systems. -.\" -.\" 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. -.\" 3. Neither the name of the University nor the names of its contributors -.\" 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. -.\" -.\" @(#)strcspn.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD$ -.\" -.Dd June 4, 1993 -.Dt STRCSPN 3 -.Os -.Sh NAME -.Nm strcspn -.Nd span the complement of a string -.Sh LIBRARY -.Lb libc -.Sh SYNOPSIS -.In string.h -.Ft size_t -.Fn strcspn "const char *s" "const char *charset" -.Sh DESCRIPTION -The -.Fn strcspn -function -spans the initial part of the null-terminated string -.Fa s -as long as the characters from -.Fa s -do not occur in string -.Fa charset -(it -spans the -.Em complement -of -.Fa charset ) . -In other words, it computes the string array index in -.Fa s -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 strcspn -function -returns the number of characters spanned. -.Sh SEE ALSO -.Xr memchr 3 , -.Xr strchr 3 , -.Xr strpbrk 3 , -.Xr strrchr 3 , -.Xr strsep 3 , -.Xr strspn 3 , -.Xr strstr 3 , -.Xr strtok 3 -.Sh STANDARDS -The -.Fn strcspn -function -conforms to -.St -isoC . diff --git a/lib/libc/string/strspn.3 b/lib/libc/string/strspn.3 index 2ba6a6b..542b190 100644 --- a/lib/libc/string/strspn.3 +++ b/lib/libc/string/strspn.3 @@ -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 . |