mblen.c revision 118595
153564Sobrien/*- 253564Sobrien * Copyright (c) 2002, 2003 Tim J. Robbins. 353564Sobrien * All rights reserved. 453564Sobrien * 553564Sobrien * Redistribution and use in source and binary forms, with or without 653564Sobrien * modification, are permitted provided that the following conditions 753564Sobrien * are met: 853564Sobrien * 1. Redistributions of source code must retain the above copyright 953564Sobrien * notice, this list of conditions and the following disclaimer. 1053564Sobrien * 2. Redistributions in binary form must reproduce the above copyright 1153564Sobrien * notice, this list of conditions and the following disclaimer in the 1253564Sobrien * documentation and/or other materials provided with the distribution. 1353564Sobrien * 1453564Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1553564Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1653564Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1753564Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1853564Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1953564Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2053564Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2153564Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2253564Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2353564Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2453564Sobrien * SUCH DAMAGE. 2555360Sobrien */ 2653564Sobrien 2753564Sobrien#include <sys/cdefs.h> 2853564Sobrien__FBSDID("$FreeBSD: head/lib/libc/locale/mblen.c 118595 2003-08-07 09:34:51Z tjr $"); 2953564Sobrien 3053564Sobrien#include <stdlib.h> 3155360Sobrien 3253564Sobrienint 3353564Sobrienmblen(const char *s, size_t n) 3453564Sobrien{ 3553564Sobrien 3653564Sobrien /* 3753564Sobrien * Calling mbtowc() is only legal because we don't support 3855360Sobrien * state-dependent encodings. 3953564Sobrien */ 4053564Sobrien return (mbtowc(NULL, s, n)); 4153564Sobrien} 4253564Sobrien