diff options
author | tedu <> | 2010-05-18 22:24:55 +0000 |
---|---|---|
committer | tedu <> | 2010-05-18 22:24:55 +0000 |
commit | 84e56ad2cf3f4b33089396bba6483888d54d99a3 (patch) | |
tree | a6c0f4a1cf1cb7596fb9279f0a7ff14d13a1317e /src/lib/libc/string/strlen.3 | |
parent | 5a36fcc1c46490330487900d818ea64d85ac1f1a (diff) | |
download | openbsd-84e56ad2cf3f4b33089396bba6483888d54d99a3.tar.gz openbsd-84e56ad2cf3f4b33089396bba6483888d54d99a3.tar.bz2 openbsd-84e56ad2cf3f4b33089396bba6483888d54d99a3.zip |
add posix_madvise, posix_memalign, strndup, and strnlen. mostly from
brad and millert, with hints from guenther, jmc, and otto I think.
ok previous.
Diffstat (limited to 'src/lib/libc/string/strlen.3')
-rw-r--r-- | src/lib/libc/string/strlen.3 | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/src/lib/libc/string/strlen.3 b/src/lib/libc/string/strlen.3 index f8a4efe9d2..3b5f9a10c1 100644 --- a/src/lib/libc/string/strlen.3 +++ b/src/lib/libc/string/strlen.3 | |||
@@ -29,29 +29,55 @@ | |||
29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
30 | .\" SUCH DAMAGE. | 30 | .\" SUCH DAMAGE. |
31 | .\" | 31 | .\" |
32 | .\" $OpenBSD: strlen.3,v 1.6 2007/05/31 19:19:32 jmc Exp $ | 32 | .\" $OpenBSD: strlen.3,v 1.7 2010/05/18 22:24:55 tedu Exp $ |
33 | .\" | 33 | .\" |
34 | .Dd $Mdocdate: May 31 2007 $ | 34 | .Dd $Mdocdate: May 18 2010 $ |
35 | .Dt STRLEN 3 | 35 | .Dt STRLEN 3 |
36 | .Os | 36 | .Os |
37 | .Sh NAME | 37 | .Sh NAME |
38 | .Nm strlen | 38 | .Nm strlen , |
39 | .Nm strnlen | ||
39 | .Nd find length of a string | 40 | .Nd find length of a string |
40 | .Sh SYNOPSIS | 41 | .Sh SYNOPSIS |
41 | .Fd #include <string.h> | 42 | .Fd #include <string.h> |
42 | .Ft size_t | 43 | .Ft size_t |
43 | .Fn strlen "const char *s" | 44 | .Fn strlen "const char *s" |
45 | .Ft size_t | ||
46 | .Fn strnlen "const char *s" "size_t maxlen" | ||
44 | .Sh DESCRIPTION | 47 | .Sh DESCRIPTION |
45 | The | 48 | The |
46 | .Fn strlen | 49 | .Fn strlen |
47 | function computes the length of the string | 50 | function computes the length of the string |
48 | .Fa s . | 51 | .Fa s . |
52 | .Pp | ||
53 | The | ||
54 | .Fn strnlen | ||
55 | function computes the length of the string | ||
56 | .Fa s , | ||
57 | up to | ||
58 | .Fa maxlen | ||
59 | characters. | ||
60 | The | ||
61 | .Fn strnlen | ||
62 | function will never attempt to address more than | ||
63 | .Fa maxlen | ||
64 | characters, making it suitable for use with character arrays that are | ||
65 | not guaranteed to be NUL-terminated. | ||
66 | .Pp | ||
49 | .Sh RETURN VALUES | 67 | .Sh RETURN VALUES |
50 | The | 68 | The |
51 | .Fn strlen | 69 | .Fn strlen |
52 | function returns the number of characters that precede the terminating | 70 | function returns the number of characters that precede the terminating |
53 | .Tn NUL | 71 | .Tn NUL |
54 | character. | 72 | character. |
73 | .Pp | ||
74 | The | ||
75 | .Fn strnlen | ||
76 | function returns the number of characters that precede the terminating | ||
77 | .Tn NUL | ||
78 | or | ||
79 | .Fa maxlen , | ||
80 | whichever is smaller. | ||
55 | .Sh SEE ALSO | 81 | .Sh SEE ALSO |
56 | .Xr string 3 | 82 | .Xr string 3 |
57 | .Sh STANDARDS | 83 | .Sh STANDARDS |
@@ -59,3 +85,10 @@ The | |||
59 | .Fn strlen | 85 | .Fn strlen |
60 | function conforms to | 86 | function conforms to |
61 | .St -ansiC . | 87 | .St -ansiC . |
88 | .Pp | ||
89 | The | ||
90 | .Fn strlen | ||
91 | and | ||
92 | .Fn strnlen | ||
93 | functions conform to | ||
94 | .St -p1003.1-2008 . | ||