diff options
Diffstat (limited to 'src/lib/libc/string/strlen.3')
| -rw-r--r-- | src/lib/libc/string/strlen.3 | 75 |
1 files changed, 54 insertions, 21 deletions
diff --git a/src/lib/libc/string/strlen.3 b/src/lib/libc/string/strlen.3 index f4aff363ee..9187496a00 100644 --- a/src/lib/libc/string/strlen.3 +++ b/src/lib/libc/string/strlen.3 | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | .\" $OpenBSD: strlen.3,v 1.10 2011/07/25 00:38:53 schwarze Exp $ | ||
| 2 | .\" | ||
| 1 | .\" Copyright (c) 1990, 1991 The Regents of the University of California. | 3 | .\" Copyright (c) 1990, 1991 The Regents of the University of California. |
| 2 | .\" All rights reserved. | 4 | .\" All rights reserved. |
| 3 | .\" | 5 | .\" |
| @@ -13,11 +15,7 @@ | |||
| 13 | .\" 2. Redistributions in binary form must reproduce the above copyright | 15 | .\" 2. Redistributions in binary form must reproduce the above copyright |
| 14 | .\" notice, this list of conditions and the following disclaimer in the | 16 | .\" notice, this list of conditions and the following disclaimer in the |
| 15 | .\" documentation and/or other materials provided with the distribution. | 17 | .\" documentation and/or other materials provided with the distribution. |
| 16 | .\" 3. All advertising materials mentioning features or use of this software | 18 | .\" 3. Neither the name of the University nor the names of its contributors |
| 17 | .\" must display the following acknowledgement: | ||
| 18 | .\" This product includes software developed by the University of | ||
| 19 | .\" California, Berkeley and its contributors. | ||
| 20 | .\" 4. Neither the name of the University nor the names of its contributors | ||
| 21 | .\" may be used to endorse or promote products derived from this software | 19 | .\" may be used to endorse or promote products derived from this software |
| 22 | .\" without specific prior written permission. | 20 | .\" without specific prior written permission. |
| 23 | .\" | 21 | .\" |
| @@ -33,39 +31,74 @@ | |||
| 33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 31 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | .\" SUCH DAMAGE. | 32 | .\" SUCH DAMAGE. |
| 35 | .\" | 33 | .\" |
| 36 | .\" from: @(#)strlen.3 5.4 (Berkeley) 6/29/91 | 34 | .Dd $Mdocdate: July 25 2011 $ |
| 37 | .\" $Id: strlen.3,v 1.1.1.1 1995/10/18 08:42:22 deraadt Exp $ | ||
| 38 | .\" | ||
| 39 | .Dd June 29, 1991 | ||
| 40 | .Dt STRLEN 3 | 35 | .Dt STRLEN 3 |
| 41 | .Os | 36 | .Os |
| 42 | .Sh NAME | 37 | .Sh NAME |
| 43 | .Nm strlen | 38 | .Nm strlen , |
| 44 | .Nd find length of string | 39 | .Nm strnlen |
| 40 | .Nd find length of a string | ||
| 45 | .Sh SYNOPSIS | 41 | .Sh SYNOPSIS |
| 46 | .Fd #include <string.h> | 42 | .Fd #include <string.h> |
| 47 | .Ft size_t | 43 | .Ft size_t |
| 48 | .Fn strlen "const char *s" | 44 | .Fn strlen "const char *s" |
| 45 | .Ft size_t | ||
| 46 | .Fn strnlen "const char *s" "size_t maxlen" | ||
| 49 | .Sh DESCRIPTION | 47 | .Sh DESCRIPTION |
| 50 | The | 48 | The |
| 51 | .Fn strlen | 49 | .Fn strlen |
| 52 | function | 50 | function computes the length of the string |
| 53 | computes the length of the string | ||
| 54 | .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. | ||
| 55 | .Sh RETURN VALUES | 66 | .Sh RETURN VALUES |
| 56 | The | 67 | The |
| 57 | .Fn strlen | 68 | .Fn strlen |
| 58 | function | 69 | function returns the number of characters that precede the terminating |
| 59 | returns | 70 | .Tn NUL |
| 60 | the number of characters that precede the | ||
| 61 | terminating | ||
| 62 | .Dv NUL | ||
| 63 | character. | 71 | character. |
| 72 | .Pp | ||
| 73 | The | ||
| 74 | .Fn strnlen | ||
| 75 | function returns the number of characters that precede the terminating | ||
| 76 | .Tn NUL | ||
| 77 | or | ||
| 78 | .Fa maxlen , | ||
| 79 | whichever is smaller. | ||
| 64 | .Sh SEE ALSO | 80 | .Sh SEE ALSO |
| 65 | .Xr string 3 | 81 | .Xr string 3 , |
| 82 | .Xr wcslen 3 | ||
| 66 | .Sh STANDARDS | 83 | .Sh STANDARDS |
| 67 | The | 84 | The |
| 68 | .Fn strlen | 85 | .Fn strlen |
| 69 | function | 86 | function conforms to |
| 70 | conforms to | ||
| 71 | .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 . | ||
| 95 | .Sh HISTORY | ||
| 96 | The | ||
| 97 | .Fn strlen | ||
| 98 | function first appeared in | ||
| 99 | .At v7 . | ||
| 100 | The | ||
| 101 | .Fn strnlen | ||
| 102 | function appeared in glibc 2.0 | ||
| 103 | and was reimplemented for | ||
| 104 | .Ox 4.8 . | ||
