/* FUNCTION <>---get fixed-size wide character string length INDEX wcsnlen ANSI_SYNOPSIS #include size_t wcsnlen(const wchar_t *<[s]>, size_t <[maxlen]>); TRAD_SYNOPSIS #include size_t wcsnlen(<[s]>, <[maxlen]>) wchar_t *<[s]>; size_t <[maxlen]>; DESCRIPTION The <> function computes the number of wide character codes in the wide character string pointed to by <[s]> not including the terminating L'\0' wide character but at most <[maxlen]> wide characters. RETURNS <> returns the length of <[s]> if it is less then <[maxlen]>, or <[maxlen]> if there is no L'\0' wide character in first <[maxlen]> characters. PORTABILITY <> is GNU extension.. <> requires no supporting OS subroutines. */ #include <_ansi.h> #include #include size_t _DEFUN(wcsnlen, (s, maxlen), _CONST wchar_t *s _AND size_t maxlen) { _CONST wchar_t *p; p = s; while (*p && maxlen-- > 0) p++; return (size_t)(p - s); }