wcwidth: fix espression to work correctly with SWIDTH0

This commit is contained in:
Andrey A. Chernov 2002-08-17 14:16:14 +00:00
parent 6c56d93528
commit c87e6b26b0

View File

@ -217,7 +217,9 @@ int
wcwidth(wc)
wchar_t wc;
{
int width = (unsigned)__maskrune((wc), _CTYPE_SWM) >> _CTYPE_SWS;
return width ? width : iswprint(wc);
int width = __maskrune(wc, _CTYPE_SWM);
return (width ? (unsigned)width >> _CTYPE_SWS
: iswprint(wc) != 0);
}