diff options
| author | perry <perry@NetBSD.org> | 2009-05-01 17:27:01 +0000 |
|---|---|---|
| committer | perry <perry@NetBSD.org> | 2009-05-01 17:27:01 +0000 |
| commit | be11851995d64eb0fdb4138fd10ea6b1b28ffd67 (patch) | |
| tree | 0b2a3633a2e1f335b9a8d2414d40a8dff4c7a97f /lib/libc/string/strlen.3 | |
| parent | bdb0c5fb32d7e4d0c72e7d87864e0b53748bbbaf (diff) | |
Add versions of stpcpy(3), stpncpy(3), strnlen(3), all from FreeBSD.
These are defined in the latest POSIX
Also make related updates to documentation, mostly from FreeBSD,
though I cleaned a few other things up along the way.
Bump shlib_version.
We are still missing strcoll_l, strerror_l, strsignal, strxfrm_l to be
POSIX conformant.
Diffstat (limited to 'lib/libc/string/strlen.3')
| -rw-r--r-- | lib/libc/string/strlen.3 | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/lib/libc/string/strlen.3 b/lib/libc/string/strlen.3 index 41477f6c204..d460f9d3608 100644 --- a/lib/libc/string/strlen.3 +++ b/lib/libc/string/strlen.3 @@ -30,13 +30,14 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)strlen.3 8.1 (Berkeley) 6/4/93 -.\" $NetBSD: strlen.3,v 1.8 2003/08/07 16:43:51 agc Exp $ +.\" $NetBSD: strlen.3,v 1.9 2009/05/01 17:27:01 perry Exp $ .\" -.Dd June 4, 1993 +.Dd May 1, 2009 .Dt STRLEN 3 .Os .Sh NAME -.Nm strlen +.Nm strlen , +.Nm strnlen .Nd find length of string .Sh LIBRARY .Lb libc @@ -44,12 +45,23 @@ .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 . +.Pp +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,11 +71,25 @@ the number of characters that precede the terminating .Dv NUL character. +.Pp +The +.Fn strnlen +function returns either the same result as +.Fn strlen +or +.Fa maxlen , +whichever is smaller. .Sh SEE ALSO -.Xr string 3 +.Xr string 3 , +.Xr wcslen 3 , +.Xr wcswidth 3 .Sh STANDARDS The .Fn strlen function conforms to -.St -ansiC . +.St -isoC . +The +.Fn strnlen +function conforms to +.St -p1003.1-2008 . |
