strlcpy.3 (108037) | strlcpy.3 (131504) |
---|---|
1.\" $OpenBSD: strlcpy.3,v 1.5 1999/06/06 15:17:32 aaron Exp $ 2.\" 3.\" Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: --- 11 unchanged lines hidden (view full) --- 20.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 23.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 25.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 26.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27.\" | 1.\" $OpenBSD: strlcpy.3,v 1.5 1999/06/06 15:17:32 aaron Exp $ 2.\" 3.\" Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: --- 11 unchanged lines hidden (view full) --- 20.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 23.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 25.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 26.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27.\" |
28.\" $FreeBSD: head/lib/libc/string/strlcpy.3 108037 2002-12-18 12:45:11Z ru $ | 28.\" $FreeBSD: head/lib/libc/string/strlcpy.3 131504 2004-07-02 23:52:20Z ru $ |
29.\" 30.Dd June 22, 1998 31.Dt STRLCPY 3 32.Os 33.Sh NAME 34.Nm strlcpy , 35.Nm strlcat 36.Nd size-bounded string copying and concatenation --- 5 unchanged lines hidden (view full) --- 42.Fn strlcpy "char *dst" "const char *src" "size_t size" 43.Ft size_t 44.Fn strlcat "char *dst" "const char *src" "size_t size" 45.Sh DESCRIPTION 46The 47.Fn strlcpy 48and 49.Fn strlcat | 29.\" 30.Dd June 22, 1998 31.Dt STRLCPY 3 32.Os 33.Sh NAME 34.Nm strlcpy , 35.Nm strlcat 36.Nd size-bounded string copying and concatenation --- 5 unchanged lines hidden (view full) --- 42.Fn strlcpy "char *dst" "const char *src" "size_t size" 43.Ft size_t 44.Fn strlcat "char *dst" "const char *src" "size_t size" 45.Sh DESCRIPTION 46The 47.Fn strlcpy 48and 49.Fn strlcat |
50functions copy and concatenate strings respectively. They are designed | 50functions copy and concatenate strings respectively. 51They are designed |
51to be safer, more consistent, and less error prone replacements for 52.Xr strncpy 3 53and 54.Xr strncat 3 . 55Unlike those functions, 56.Fn strlcpy 57and 58.Fn strlcat --- 44 unchanged lines hidden (view full) --- 103.Fa size 104- strlen(dst) - 1 bytes, NUL-terminating the result. 105.Sh RETURN VALUES 106The 107.Fn strlcpy 108and 109.Fn strlcat 110functions return the total length of the string they tried to | 52to be safer, more consistent, and less error prone replacements for 53.Xr strncpy 3 54and 55.Xr strncat 3 . 56Unlike those functions, 57.Fn strlcpy 58and 59.Fn strlcat --- 44 unchanged lines hidden (view full) --- 104.Fa size 105- strlen(dst) - 1 bytes, NUL-terminating the result. 106.Sh RETURN VALUES 107The 108.Fn strlcpy 109and 110.Fn strlcat 111functions return the total length of the string they tried to |
111create. For | 112create. 113For |
112.Fn strlcpy 113that means the length of 114.Fa src . 115For 116.Fn strlcat 117that means the initial length of 118.Fa dst 119plus --- 83 unchanged lines hidden --- | 114.Fn strlcpy 115that means the length of 116.Fa src . 117For 118.Fn strlcat 119that means the initial length of 120.Fa dst 121plus --- 83 unchanged lines hidden --- |