Module Name: src Committed By: riastradh Date: Fri Aug 11 21:20:39 UTC 2023
Modified Files: src/lib/libc/string: strlcpy.3 strncpy.3 Log Message: strlcpy(3), strncpy(3): Omit needless (void) casts in examples. The return values are not critical. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/lib/libc/string/strlcpy.3 cvs rdiff -u -r1.13 -r1.14 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/strlcpy.3 diff -u src/lib/libc/string/strlcpy.3:1.19 src/lib/libc/string/strlcpy.3:1.20 --- src/lib/libc/string/strlcpy.3:1.19 Fri Aug 11 21:17:16 2023 +++ src/lib/libc/string/strlcpy.3 Fri Aug 11 21:20:39 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: strlcpy.3,v 1.19 2023/08/11 21:17:16 riastradh Exp $ +.\" $NetBSD: strlcpy.3,v 1.20 2023/08/11 21:20:39 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> @@ -200,8 +200,8 @@ char *s, *p, buf[BUFSIZ]; \&... -(void)strlcpy(buf, s, sizeof(buf)); -(void)strlcat(buf, p, sizeof(buf)); +strlcpy(buf, s, sizeof(buf)); +strlcat(buf, p, sizeof(buf)); .Ed .Pp To detect truncation, perhaps while building a pathname, something Index: src/lib/libc/string/strncpy.3 diff -u src/lib/libc/string/strncpy.3:1.13 src/lib/libc/string/strncpy.3:1.14 --- src/lib/libc/string/strncpy.3:1.13 Fri Aug 11 21:17:16 2023 +++ src/lib/libc/string/strncpy.3 Fri Aug 11 21:20:39 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.13 2023/08/11 21:17:16 riastradh Exp $ +.\" $NetBSD: strncpy.3,v 1.14 2023/08/11 21:20:39 riastradh Exp $ .\" .Dd August 11, 2023 .Dt STRNCPY 3 @@ -207,7 +207,7 @@ is required it must be done explicitly: .Bd -literal -offset indent char buf[1024]; -(void)strncpy(buf, input, sizeof(buf) - 1); +strncpy(buf, input, sizeof(buf) - 1); buf[sizeof(buf) - 1] = '\e0'; .Ed .Pp @@ -222,7 +222,7 @@ this could be achieved using .Xr strlcpy 3 as follows: .Bd -literal -offset indent -(void)strlcpy(buf, input, sizeof(buf)); +strlcpy(buf, input, sizeof(buf)); .Ed .Pp Note that because