summaryrefslogtreecommitdiff
path: root/lib/libc/string/strlen.3
diff options
context:
space:
mode:
authorDavid Schultz <das@FreeBSD.org>2009-02-28 06:00:58 +0000
committerDavid Schultz <das@FreeBSD.org>2009-02-28 06:00:58 +0000
commit69099ba2ec8b01fe51a5c69b98990cde406c5ab8 (patch)
treef258384b92d5c4bde23e95d4c44fa3547a0364cd /lib/libc/string/strlen.3
parent8bc369a3e122d4e2dd14be8d96eeaf3f4d8573e2 (diff)
Notes
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 29c35158284f..f7aa033ae8b7 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 .