Deleted Added
full compact
strlen.3 (165903) strlen.3 (189136)
1.\" Copyright (c) 1990, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Chris Torek and the American National Standards Committee X3,
6.\" on Information Processing Systems.
7.\"
8.\" Redistribution and use in source and binary forms, with or without

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)strlen.3 8.1 (Berkeley) 6/4/93
1.\" Copyright (c) 1990, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Chris Torek and the American National Standards Committee X3,
6.\" on Information Processing Systems.
7.\"
8.\" Redistribution and use in source and binary forms, with or without

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)strlen.3 8.1 (Berkeley) 6/4/93
33.\" $FreeBSD: head/lib/libc/string/strlen.3 165903 2007-01-09 00:28:16Z imp $
33.\" $FreeBSD: head/lib/libc/string/strlen.3 189136 2009-02-28 06:00:58Z das $
34.\"
34.\"
35.Dd June 4, 1993
35.Dd February 28, 2009
36.Dt STRLEN 3
37.Os
38.Sh NAME
36.Dt STRLEN 3
37.Os
38.Sh NAME
39.Nm strlen
39.Nm strlen, strnlen
40.Nd find length of string
41.Sh LIBRARY
42.Lb libc
43.Sh SYNOPSIS
44.In string.h
45.Ft size_t
46.Fn strlen "const char *s"
40.Nd find length of string
41.Sh LIBRARY
42.Lb libc
43.Sh SYNOPSIS
44.In string.h
45.Ft size_t
46.Fn strlen "const char *s"
47.Ft size_t
48.Fn strnlen "const char *s" "size_t maxlen"
47.Sh DESCRIPTION
48The
49.Fn strlen
50function
51computes the length of the string
52.Fa s .
49.Sh DESCRIPTION
50The
51.Fn strlen
52function
53computes the length of the string
54.Fa s .
55The
56.Fn strnlen
57function attempts to compute the length of
58.Fa s ,
59but never scans beyond the first
60.Fa maxlen
61bytes of
62.Fa s .
53.Sh RETURN VALUES
54The
55.Fn strlen
56function
57returns
58the number of characters that precede the
59terminating
60.Dv NUL
61character.
63.Sh RETURN VALUES
64The
65.Fn strlen
66function
67returns
68the number of characters that precede the
69terminating
70.Dv NUL
71character.
72The
73.Fn strnlen
74function returns either the same result as
75.Fn strlen
76or
77.Fa maxlen ,
78whichever is smaller.
62.Sh SEE ALSO
63.Xr string 3
64.Sh STANDARDS
65The
66.Fn strlen
67function
68conforms to
69.St -isoC .
79.Sh SEE ALSO
80.Xr string 3
81.Sh STANDARDS
82The
83.Fn strlen
84function
85conforms to
86.St -isoC .
87The
88.Fn strnlen
89function conforms to
90.St -p1003.1-2008 .