WCWIDTH(3P)
π¦ WCWIDTH β okay bestie, let's talk column positions π¦
so this is wcwidth(3P), from the POSIX Programmer's Manual β yes, the POSIX one, not the Linux one, and those two are not the same vibe, okay? Let's get into it.
β¨ PROLOG β¨
Real talk before anything else: this manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ β so pls consult the corresponding Linux manual page for the deets on Linux behavior β or honestly, the interface may not even be implemented on Linux at all. Check before you commit, bestie. π
πΈ NAME πΈ
wcwidth β literally just: the number of column positions of a wide-character code. That's it. That's the whole job. She's niche but she's essential.
π SYNOPSIS π
#include <wchar.h>
int wcwidth(wchar_t wc);
π DESCRIPTION π
okay so here's the tea. wcwidth() shall determine the number of column positions required for the wide character wc. Column positions. Like, how much horizontal room does this little glyph take up on your terminal. π«Ά
But here's the part where you have homework: the application shall ensure that the value of wc is a character representable as a wchar_t, and is a wide-character code corresponding to a valid character in the current locale. So locale-valid, wchar_t-representable, no funny business. β¨
π RETURN VALUE π
So she returns one of three things, and you need to know which is which:
0β ifwcis a null wide-character code. Zero columns, queen of taking up no space. π- the number of column positions β the actual count of columns that the wide-character code
wcwill occupy. Main character energy, occupying her rightful space. π -1β ifwcdoes not correspond to a printable wide-character code. Not printable, not invited. π
π« ERRORS π«
No errors are defined. Iconic. No drama. Nothing to catch. β¨
Also, heads up: the following sections are informative. (Yes, that's the manpage talking, not me.)
π¦ EXAMPLES π¦
None. Nothing to see here, bestie, it's giving tumbleweed. π
π APPLICATION USAGE π
Okay this part is important so pay attention:
This function was removed from the final ISO/IEC 9899:1990/Amendment 1:1995 (E). Gone. Removed. Not in there anymore. π
And the return value for a non-printable wide character is not specified. Not specified! So don't go building your whole life on that value, fr fr. β οΈ
Warning bestie: unspecified return value for non-printable wide characters means you should NOT assume anything about it. Do not pass go. Do not collect your column count.
π RATIONALE π
None. No rationale, no explanation, she simply is. π§
β FUTURE DIRECTIONS β
None. The future is wide open and also empty. Slay. β¨
π SEE ALSO π
wcswidth()- The Base Definitions volume of POSIX.1β2017,
<wchar.h>
Go read wcswidth() next, they're besties, it's a whole thing. iykyk. π«Ά
π COPYRIGHT π
okay legal moment, do not skip, this is required reading:
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole page, bestie β brought to you by IEEE/The Open Group, dated 2017, under the name WCWIDTH(3P). π go forth and measure your columns. periodt. π
β¨
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms