According to SUSv2, always return 0 for null wide-character code

This commit is contained in:
ache 2002-08-19 18:06:18 +00:00
parent 71551c8840
commit 57b58c92d3

View File

@ -52,7 +52,12 @@ int
wcwidth(wc)
wchar_t wc;
{
int width = __maskrune(wc, _CTYPE_SWM);
int width;
if (wc == 0)
return (0);
width = __maskrune(wc, _CTYPE_SWM);
/* 0 is autowidth (default) */
return (width ? (int)((unsigned)width >> _CTYPE_SWS)