aboutsummaryrefslogtreecommitdiff
path: root/src/ctype/wcswidth.c
blob: 2356e33d703e3cba206ad06c4b7528f9286d282d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#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;
}


#ifdef TEST
int
main(void) {
	return 0;
}
#endif