Add iswctype wcwidth function code

Submitted by:	clkao@clkao.org
Reviewed by:	keichii
Obtained from:	NetBSD
MFC after:	1 month
This commit is contained in:
Michael C . Wu 2002-08-16 13:45:23 +00:00
parent c3121a34a0
commit dff784192b

View File

@ -211,3 +211,13 @@ towupper(wc)
{
return (__toupper(wc));
}
#undef wcwidth
int
wcwidth(wc)
wchar_t wc;
{
int width = (unsigned)__maskrune((wc), _CTYPE_SWM) >> _CTYPE_SWS;
return width ? width : iswprint(wc);
}