From e4900374111d9fcb2dbe48f0cc7afe9c6094da02 Mon Sep 17 00:00:00 2001 From: guenther Date: Wed, 7 Aug 2024 04:59:45 +0000 Subject: [PATCH] wcslcpy() and wcslcat() are in POSIX-2024. Update #include visibility and manpages and add restrict qualifiers. ok millert@ --- include/wchar.h | 13 ++++++++----- lib/libc/string/wcslcpy.3 | 15 +++++++++++---- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/include/wchar.h b/include/wchar.h index 462ed5e4bbf..96e86a15515 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wchar.h,v 1.32 2024/07/14 10:04:17 jca Exp $ */ +/* $OpenBSD: wchar.h,v 1.33 2024/08/07 04:59:45 guenther Exp $ */ /* $NetBSD: wchar.h,v 1.16 2003/03/07 07:11:35 tshiozak Exp $ */ /*- @@ -223,14 +223,17 @@ int vswscanf(const wchar_t * __restrict, const wchar_t * __restrict, __va_list); int vwscanf(const wchar_t * __restrict, __va_list); int wscanf(const wchar_t * __restrict, ...); -#if __BSD_VISIBLE -wchar_t *fgetwln(FILE * __restrict, size_t * __restrict); -size_t wcslcat(wchar_t *, const wchar_t *, size_t) +#if __POSIX_VISIBLE >= 202405 || __BSD_VISIBLE +size_t wcslcat(wchar_t * __restrict, const wchar_t * __restrict, size_t) __attribute__ ((__bounded__(__wcstring__,1,3))); -size_t wcslcpy(wchar_t *, const wchar_t *, size_t) +size_t wcslcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t) __attribute__ ((__bounded__(__wcstring__,1,3))); #endif +#if __BSD_VISIBLE +wchar_t *fgetwln(FILE * __restrict, size_t * __restrict); +#endif + #define getwc(f) fgetwc(f) #define getwchar() getwc(stdin) #define putwc(wc, f) fputwc((wc), (f)) diff --git a/lib/libc/string/wcslcpy.3 b/lib/libc/string/wcslcpy.3 index 5d8721c35aa..d279038079f 100644 --- a/lib/libc/string/wcslcpy.3 +++ b/lib/libc/string/wcslcpy.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: wcslcpy.3,v 1.7 2019/01/25 00:19:25 millert Exp $ +.\" $OpenBSD: wcslcpy.3,v 1.8 2024/08/07 04:59:45 guenther Exp $ .\" .\" Copyright (c) 1998, 2000 Todd C. Miller .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: January 25 2019 $ +.Dd $Mdocdate: August 7 2024 $ .Dt WCSLCPY 3 .Os .Sh NAME @@ -24,9 +24,9 @@ .Sh SYNOPSIS .In wchar.h .Ft size_t -.Fn wcslcpy "wchar_t *dst" "const wchar_t *src" "size_t size" +.Fn wcslcpy "wchar_t * restrict dst" "const wchar_t * restrict src" "size_t size" .Ft size_t -.Fn wcslcat "wchar_t *dst" "const wchar_t *src" "size_t size" +.Fn wcslcat "wchar_t * restrict dst" "const wchar_t * restrict src" "size_t size" .Sh DESCRIPTION The .Fn wcslcpy @@ -137,6 +137,13 @@ The check exists to prevent potential security problems in incorrect code. .Xr swprintf 3 , .Xr wcsncat 3 , .Xr wcsncpy 3 +.Sh STANDARDS +The +.Fn wcslcpy +and +.Fn wcslcat +functions conform to +.St -p1003.1-2024 . .Sh HISTORY The .Fn wcslcpy -- 2.20.1