summaryrefslogtreecommitdiff
path: root/src/ctype/wcswidth.c
blob: 5c8a5a4dadc2bc7fb41dbdd68d8fb5debdabae6b (plain)
1
2
3
4
5
6
7
8
#include <wchar.h>

int wcswidth(const wchar_t *wcs, size_t n)
{
	int l=0, k=0;
	for (; n-- && *wcs && (k = wcwidth(*wcs)) >= 0; l+=k, wcs++);
	return (k < 0) ? k : l;
}