source: trunk/libs/newlib/src/newlib/libc/string/wcslen.c @ 567

Last change on this file since 567 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 2.1 KB
Line 
1/*
2FUNCTION
3        <<wcslen>>---get wide-character string length
4
5SYNOPSIS
6        #include <wchar.h>
7        size_t wcslen(const wchar_t *<[s]>);
8
9DESCRIPTION
10        The <<wcslen>> function computes the number of wide-character codes
11        in the wide-character string to which <[s]> points, not including the
12        terminating null wide-character code.
13
14RETURNS
15        The <<wcslen>> function returns the length of <[s]>; no return value is
16        reserved to indicate an error.
17
18PORTABILITY
19<<wcslen>> is ISO/IEC 9899/AMD1:1995 (ISO C).
20
21No supporting OS subroutines are required.
22*/
23
24/*      $NetBSD: wcslen.c,v 1.1 2000/12/23 23:14:36 itojun Exp $        */
25
26/*-
27 * Copyright (c)1999 Citrus Project,
28 * All rights reserved.
29 *
30 * Redistribution and use in source and binary forms, with or without
31 * modification, are permitted provided that the following conditions
32 * are met:
33 * 1. Redistributions of source code must retain the above copyright
34 *    notice, this list of conditions and the following disclaimer.
35 * 2. Redistributions in binary form must reproduce the above copyright
36 *    notice, this list of conditions and the following disclaimer in the
37 *    documentation and/or other materials provided with the distribution.
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
40 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
42 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
43 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
44 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
45 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
47 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
48 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
49 * SUCH DAMAGE.
50 *
51 *      citrus Id: wcslen.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp
52 */
53
54#include <_ansi.h>
55#include <wchar.h>
56
57size_t
58wcslen (const wchar_t * s)
59{
60  const wchar_t *p;
61
62  p = s;
63  while (*p)
64    p++;
65
66  return p - s;
67}
Note: See TracBrowser for help on using the repository browser.