mblen.c revision 118595
1102697Stjr/*-
2118595Stjr * Copyright (c) 2002, 2003 Tim J. Robbins.
3118595Stjr * All rights reserved.
4102697Stjr *
5102697Stjr * Redistribution and use in source and binary forms, with or without
6102697Stjr * modification, are permitted provided that the following conditions
7102697Stjr * are met:
8102697Stjr * 1. Redistributions of source code must retain the above copyright
9102697Stjr *    notice, this list of conditions and the following disclaimer.
10102697Stjr * 2. Redistributions in binary form must reproduce the above copyright
11102697Stjr *    notice, this list of conditions and the following disclaimer in the
12102697Stjr *    documentation and/or other materials provided with the distribution.
13102697Stjr *
14118595Stjr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15102697Stjr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16102697Stjr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17118595Stjr * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18102697Stjr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19102697Stjr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20102697Stjr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21102697Stjr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22102697Stjr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23102697Stjr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24102697Stjr * SUCH DAMAGE.
25102697Stjr */
26102697Stjr
27102697Stjr#include <sys/cdefs.h>
28102697Stjr__FBSDID("$FreeBSD: head/lib/libc/locale/mblen.c 118595 2003-08-07 09:34:51Z tjr $");
29102697Stjr
30102697Stjr#include <stdlib.h>
31102697Stjr
32102697Stjrint
33106032Stjrmblen(const char *s, size_t n)
34102697Stjr{
35102697Stjr
36118595Stjr	/*
37118595Stjr	 * Calling mbtowc() is only legal because we don't support
38118595Stjr	 * state-dependent encodings.
39118595Stjr	 */
40118595Stjr	return (mbtowc(NULL, s, n));
41102697Stjr}
42