[PATCH] manual: document wcwidth and wcswidth [BZ #33740]
Nikola Arlotti
nikola.arlotti@gmail.com
Tue Jul 14 15:30:28 GMT 2026
This patch documents functions wcwidth and wcswidth, solving bug
#33740. CC'ing Arjun so he can add it to his stats for the next
glibc contribution workshop ;)
Signed-off-by: Nikola Arlotti <nikola.arlotti@gmail.com>
---
manual/ctype.texi | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/manual/ctype.texi b/manual/ctype.texi
index d09249c6cf..0eeb3f77de 100644
--- a/manual/ctype.texi
+++ b/manual/ctype.texi
@@ -380,6 +380,30 @@ by a successful call to @code{wctype}.
This function is declared in @file{wctype.h}.
@end deftypefun
+@deftypefun int wcwidth (wchar_t @var{wc})
+@standards{POSIX, wchar.h}
+@safety{@prelim{}@mtsafe{@mtslocale{}}@assafe{}@acsafe{}}
+This function returns the number of collumns needed to represent
+the wide character @var{wc}. If @var{wc} is a printable wide character,
+the value is 0 or higher. If @var{wc} is a null-wide character (L'\0'),
+the value is 0. Otherwise, this function returns -1.
+
+@pindex wchar.h
+This function is declared in @file{wchar.h}.
+@end deftypefun
+
+@deftypefun int wcswidth (const wchar_t @var{*s}, size_t @var{n})
+@standards{POSIX, wchar.h}
+@safety{@prelim{}@mtsafe{@mtslocale{}}@assafe{}@acsafe{}}
+This function returns the number of collumns needed to represent
+the wide character string pointed to by @var{*s}, but at most
+@var{n} wide characters. If a nonprintable wide character occurs
+among these characters, this function returns -1.
+
+@pindex wchar.h
+This function is declared in @file{wchar.h}.
+@end deftypefun
+
To make it easier to use the commonly-used classification functions,
they are defined in the C library. There is no need to use
@code{wctype} if the property string is one of the known character
--
2.54.0
More information about the Libc-alpha
mailing list