Module Name: src Committed By: riastradh Date: Fri Aug 11 21:17:16 UTC 2023
Modified Files: src/lib/libc/string: strcpy.3 strlcpy.3 strncpy.3 Log Message: strcpy(3), strlcpy(3), strncpy(3): Just say `byte', not `character'. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/lib/libc/string/strcpy.3 cvs rdiff -u -r1.18 -r1.19 src/lib/libc/string/strlcpy.3 cvs rdiff -u -r1.12 -r1.13 src/lib/libc/string/strncpy.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/string/strcpy.3 diff -u src/lib/libc/string/strcpy.3:1.26 src/lib/libc/string/strcpy.3:1.27 --- src/lib/libc/string/strcpy.3:1.26 Fri Aug 11 16:05:56 2023 +++ src/lib/libc/string/strcpy.3 Fri Aug 11 21:17:16 2023 @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)strcpy.3 8.1 (Berkeley) 6/4/93 -.\" $NetBSD: strcpy.3,v 1.26 2023/08/11 16:05:56 riastradh Exp $ +.\" $NetBSD: strcpy.3,v 1.27 2023/08/11 21:17:16 riastradh Exp $ .\" .Dd August 11, 2023 .Dt STRCPY 3 @@ -59,7 +59,7 @@ to .Fa dst , including the terminating .Tn NUL -character. +byte. .Pp The strings .Fa src @@ -70,7 +70,7 @@ The string .Fa src must be terminated by a .Tn NUL -character. +byte. The memory for .Fa dst must have space for @@ -86,7 +86,7 @@ The .Fn stpcpy function returns a pointer to the terminating .Tn NUL -character of +byte of .Fa dst . .Sh SEE ALSO .Xr bcopy 3 , Index: src/lib/libc/string/strlcpy.3 diff -u src/lib/libc/string/strlcpy.3:1.18 src/lib/libc/string/strlcpy.3:1.19 --- src/lib/libc/string/strlcpy.3:1.18 Fri Aug 11 16:34:28 2023 +++ src/lib/libc/string/strlcpy.3 Fri Aug 11 21:17:16 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: strlcpy.3,v 1.18 2023/08/11 16:34:28 riastradh Exp $ +.\" $NetBSD: strlcpy.3,v 1.19 2023/08/11 21:17:16 riastradh Exp $ .\" from OpenBSD: strlcpy.3,v 1.11 2000/11/16 23:27:41 angelos Exp .\" .\" Copyright (c) 1998, 2000 Todd C. Miller <todd.mil...@courtesan.com> @@ -54,7 +54,7 @@ The .Fn strlcpy function copies up to .Fa size -- 1 characters from the +- 1 bytes from the .Tn NUL Ns -terminated string .Fa src @@ -175,7 +175,7 @@ Note however, that if .Fn strlcat traverses .Fa size -characters without finding a +bytes without finding a .Tn NUL , the length of the string is considered to be .Fa size @@ -217,7 +217,7 @@ if (strlcat(pname, file, sizeof(pname)) goto toolong; .Ed .Pp -Since we know how many characters we copied the first time, we can +Since we know how many bytes we copied the first time, we can speed things up a bit by using a copy instead of an append: .Bd -literal -offset indent char *dir, *file, pname[MAXPATHLEN]; Index: src/lib/libc/string/strncpy.3 diff -u src/lib/libc/string/strncpy.3:1.12 src/lib/libc/string/strncpy.3:1.13 --- src/lib/libc/string/strncpy.3:1.12 Fri Aug 11 21:12:10 2023 +++ src/lib/libc/string/strncpy.3 Fri Aug 11 21:17:16 2023 @@ -31,7 +31,7 @@ .\" .\" from: @(#)strcpy.3 8.1 (Berkeley) 6/4/93 .\" from: NetBSD: strcpy.3,v 1.23 2015/04/01 20:18:17 riastradh Exp -.\" $NetBSD: strncpy.3,v 1.12 2023/08/11 21:12:10 riastradh Exp $ +.\" $NetBSD: strncpy.3,v 1.13 2023/08/11 21:17:16 riastradh Exp $ .\" .Dd August 11, 2023 .Dt STRNCPY 3 @@ -136,7 +136,7 @@ appear on disk with the content of a cal .Dv str , padded to the end of the field with .Tn NUL -characters: +bytes: .Bd -literal -offset indent struct record { uint16_t id; @@ -168,7 +168,7 @@ Note that when .Dv str has at least six .No non- Ns Tn NUL -characters, +bytes, .Dv rec Ns Li "->name" is .Em not @@ -184,12 +184,12 @@ has .Em more than six .No non- Ns Tn NUL -characters, the additional ones are truncated. +bytes, the additional ones are truncated. If .Dv str has space for .Em fewer -than six characters, and the last one is not +than six bytes, and the last one is not .Tn NUL , using .Fn strncpy