summaryrefslogtreecommitdiffstats
path: root/lib/libc/string/strlen.3
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2009-02-28 06:00:58 +0000
committerdas <das@FreeBSD.org>2009-02-28 06:00:58 +0000
commita67fbaa46cbdf18a03eefb3f83e2f74f68918753 (patch)
treef258384b92d5c4bde23e95d4c44fa3547a0364cd /lib/libc/string/strlen.3
parentb739b3fb48f28ef6b6e7efeeceb832d3dec3fc9c (diff)
downloadFreeBSD-src-a67fbaa46cbdf18a03eefb3f83e2f74f68918753.zip
FreeBSD-src-a67fbaa46cbdf18a03eefb3f83e2f74f68918753.tar.gz
- Add getdelim(), getline(), stpncpy(), strnlen(), wcsnlen(),
wcscasecmp(), and wcsncasecmp(). - Make some previously non-standard extensions visible if POSIX_VISIBLE >= 200809. - Use restrict qualifiers in stpcpy(). - Declare off_t and size_t in stdio.h. - Bump __FreeBSD_version in case the new symbols (particularly getline()) cause issues with ports. Reviewed by: standards@
Diffstat (limited to 'lib/libc/string/strlen.3')
-rw-r--r--lib/libc/string/strlen.325
1 files changed, 23 insertions, 2 deletions
diff --git a/lib/libc/string/strlen.3 b/lib/libc/string/strlen.3
index 29c3515..f7aa033 100644
--- a/lib/libc/string/strlen.3
+++ b/lib/libc/string/strlen.3
@@ -32,11 +32,11 @@
.\" @(#)strlen.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd June 4, 1993
+.Dd February 28, 2009
.Dt STRLEN 3
.Os
.Sh NAME
-.Nm strlen
+.Nm strlen, strnlen
.Nd find length of string
.Sh LIBRARY
.Lb libc
@@ -44,12 +44,22 @@
.In string.h
.Ft size_t
.Fn strlen "const char *s"
+.Ft size_t
+.Fn strnlen "const char *s" "size_t maxlen"
.Sh DESCRIPTION
The
.Fn strlen
function
computes the length of the string
.Fa s .
+The
+.Fn strnlen
+function attempts to compute the length of
+.Fa s ,
+but never scans beyond the first
+.Fa maxlen
+bytes of
+.Fa s .
.Sh RETURN VALUES
The
.Fn strlen
@@ -59,6 +69,13 @@ the number of characters that precede the
terminating
.Dv NUL
character.
+The
+.Fn strnlen
+function returns either the same result as
+.Fn strlen
+or
+.Fa maxlen ,
+whichever is smaller.
.Sh SEE ALSO
.Xr string 3
.Sh STANDARDS
@@ -67,3 +84,7 @@ The
function
conforms to
.St -isoC .
+The
+.Fn strnlen
+function conforms to
+.St -p1003.1-2008 .
OpenPOWER on IntegriCloud