This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
wcsnlen
- From: "Artem B. Bityuckiy" <mail_lists at mail dot ru>
- To: newlib at sources dot redhat dot com
- Date: Thu, 23 Oct 2003 14:05:42 +0400
- Subject: wcsnlen
- Reply-to: mail_lists at mail dot ru
Hello.
Here is wcsnlen with documentation header. Please, add Copyright header
yourself.
wchar.h_diff - is patch that adds wcsnlen prototype to wchar.h (wchar.h
is fresh since was given from Newlib CVS today)
Best Regards, Artem B. Bityuckiy.
/*
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 GNU extension..
<<wcsnlen>> requires no supporting OS subroutines.
*/
#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);
}
57a58
> size_t _EXFUN(wcsnlen, (const wchar_t *, size_t ));