diff options
| author | Andrey A. Chernov <ache@FreeBSD.org> | 2002-08-19 09:02:49 +0000 |
|---|---|---|
| committer | Andrey A. Chernov <ache@FreeBSD.org> | 2002-08-19 09:02:49 +0000 |
| commit | 9424df445ad4cddacbd0690fd3fe9bf8720c2582 (patch) | |
| tree | 88380573a0d806bcf602cea5ef23d7b84b1b84f4 /lib | |
| parent | 3471c917ec3279f58a70d8451a774d58f37ccbb3 (diff) | |
Notes
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/libc/locale/wcwidth.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libc/locale/wcwidth.c b/lib/libc/locale/wcwidth.c index 2be3bcb6839e..dab0808a5f1e 100644 --- a/lib/libc/locale/wcwidth.c +++ b/lib/libc/locale/wcwidth.c @@ -45,12 +45,16 @@ __FBSDID("$FreeBSD$"); #include <wchar.h> #include <wctype.h> +#define _CTYPE_SWM 0xe0000000L /* Mask to get screen width data */ +#define _CTYPE_SWS 30 /* Bits to shift to get width */ + int wcwidth(wc) wchar_t wc; { int width = __maskrune(wc, _CTYPE_SWM); + /* 0 is autowidth (default) */ return (width ? (int)((unsigned)width >> _CTYPE_SWS) : (iswprint(wc) ? 1 : -1)); } |
