mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-15 19:09:58 +08:00
a306ebc97e
* libc/ctype/ctype.tex: Use hyphens as appropriate, but not otherwise. * libc/ctype/islower.c: Likewise. * libc/ctype/isupper.c: Likewise. * libc/ctype/iswalnum.c: Likewise. * libc/ctype/iswalpha.c: Likewise. * libc/ctype/iswblank.c: Likewise. * libc/ctype/iswcntrl.c: Likewise. * libc/ctype/iswdigit.c: Likewise. * libc/ctype/iswgraph.c: Likewise. * libc/ctype/iswlower.c: Likewise. * libc/ctype/iswprint.c: Likewise. * libc/ctype/iswpunct.c: Likewise. * libc/ctype/iswspace.c: Likewise. * libc/ctype/iswupper.c: Likewise. * libc/ctype/iswxdigit.c: Likewise. * libc/ctype/tolower.c: Likewise. * libc/ctype/toupper.c: Likewise. * libc/ctype/towctrans.c: Likewise. * libc/ctype/towlower.c: Likewise. * libc/ctype/towupper.c: Likewise. * libc/string/strcasecmp.c: Likewise. * libc/string/strcoll.c: Likewise. * libc/string/strings.tex: Likewise. * libc/string/strlwr.c: Likewise. * libc/string/strncasecmp.c: Likewise. * libc/string/strupr.c: Likewise. * libc/string/wcscoll.c: Likewise. * libc/string/wcslcat.c: Likewise. * libc/string/wcslcpy.c: Likewise. * libc/string/wcsnlen.c: Likewise. * libc/string/wcsstr.c: Likewise. * libc/string/wcstrings.tex: Likewise. * libc/string/wmemchr.c: Likewise. * libc/string/wmemcmp.c: Likewise. * libc/string/wmemcpy.c: Likewise. * libc/string/wmemmove.c: Likewise. * libc/string/wmemset.c: Likewise.
76 lines
2.2 KiB
C
76 lines
2.2 KiB
C
/*
|
|
FUNCTION
|
|
<<wcsnlen>>---get fixed-size wide-character string length
|
|
|
|
INDEX
|
|
wcsnlen
|
|
|
|
ANSI_SYNOPSIS
|
|
#include <wchar.h>
|
|
size_t wcsnlen(const wchar_t *<[s]>, size_t <[maxlen]>);
|
|
|
|
TRAD_SYNOPSIS
|
|
#include <wchar.h>
|
|
size_t wcsnlen(<[s]>, <[maxlen]>)
|
|
wchar_t *<[s]>;
|
|
size_t <[maxlen]>;
|
|
|
|
DESCRIPTION
|
|
The <<wcsnlen>> 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
|
|
<<wcsnlen>> 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
|
|
<<wcsnlen>> is a GNU extension.
|
|
|
|
<<wcsnlen>> requires no supporting OS subroutines.
|
|
*/
|
|
|
|
/*
|
|
* Copyright (c) 2003, Artem B. Bityuckiy (dedekind@mail.ru).
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the above copyright notice,
|
|
* this condition statement, and the following disclaimer are retained
|
|
* in any redistributions of the source code.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
* SUCH DAMAGE.
|
|
*/
|
|
|
|
#include <_ansi.h>
|
|
#include <sys/types.h>
|
|
#include <wchar.h>
|
|
|
|
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);
|
|
}
|
|
|
|
|
|
|