xref: /netbsd-src/lib/libc/compat/locale/compat_setlocale32.c (revision 2c9fdc9222927965f31120c117084e401a2987be)
1*2c9fdc92Syamt /* $NetBSD: compat_setlocale32.c,v 1.2 2013/03/06 11:29:01 yamt Exp $ */
29efec5bcStnozaki 
39efec5bcStnozaki /*-
49efec5bcStnozaki  * Copyright (c)1999 Citrus Project,
59efec5bcStnozaki  * All rights reserved.
69efec5bcStnozaki  *
79efec5bcStnozaki  * Redistribution and use in source and binary forms, with or without
89efec5bcStnozaki  * modification, are permitted provided that the following conditions
99efec5bcStnozaki  * are met:
109efec5bcStnozaki  * 1. Redistributions of source code must retain the above copyright
119efec5bcStnozaki  *    notice, this list of conditions and the following disclaimer.
129efec5bcStnozaki  * 2. Redistributions in binary form must reproduce the above copyright
139efec5bcStnozaki  *    notice, this list of conditions and the following disclaimer in the
149efec5bcStnozaki  *    documentation and/or other materials provided with the distribution.
159efec5bcStnozaki  *
169efec5bcStnozaki  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
179efec5bcStnozaki  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
189efec5bcStnozaki  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
199efec5bcStnozaki  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
209efec5bcStnozaki  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
219efec5bcStnozaki  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
229efec5bcStnozaki  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
239efec5bcStnozaki  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
249efec5bcStnozaki  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
259efec5bcStnozaki  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
269efec5bcStnozaki  * SUCH DAMAGE.
279efec5bcStnozaki  *
289efec5bcStnozaki  * NetBSD: setlocale32.c,v 1.6 2010/05/22 13:50:02 tnozaki Exp
299efec5bcStnozaki  */
309efec5bcStnozaki 
319efec5bcStnozaki #include <sys/cdefs.h>
329efec5bcStnozaki #if defined(LIBC_SCCS) && !defined(lint)
33*2c9fdc92Syamt __RCSID("$NetBSD: compat_setlocale32.c,v 1.2 2013/03/06 11:29:01 yamt Exp $");
349efec5bcStnozaki #endif /* LIBC_SCCS and not lint */
359efec5bcStnozaki 
369efec5bcStnozaki #include <sys/types.h>
379efec5bcStnozaki #include <compat/include/locale.h>
389efec5bcStnozaki 
399efec5bcStnozaki #include "setlocale_local.h"
409efec5bcStnozaki 
419efec5bcStnozaki __warn_references(__setlocale_mb_len_max_32,
429efec5bcStnozaki     "warning: reference to compatibility __setlocale_mb_len_max_32();"
439efec5bcStnozaki     "include <locale.h> for correct reference")
449efec5bcStnozaki 
45*2c9fdc92Syamt /*
46*2c9fdc92Syamt  * MB_LEN_MAX used to be a MD macro.  it was 32 for most ports but 6 for hppa.
47*2c9fdc92Syamt  * hppa uses arch/hppa/locale/compat_setlocale32.c instead of this file.
48*2c9fdc92Syamt  */
49*2c9fdc92Syamt #if defined(__hppa__)
50*2c9fdc92Syamt #error using wrong variant of compat_setlocale32.c
51*2c9fdc92Syamt #endif /* defined(__hppa__) */
52*2c9fdc92Syamt 
539efec5bcStnozaki char *
__setlocale_mb_len_max_32(int category,const char * locale)549efec5bcStnozaki __setlocale_mb_len_max_32(int category, const char *locale)
559efec5bcStnozaki {
569efec5bcStnozaki 
579efec5bcStnozaki 	/* locale may be NULL */
589efec5bcStnozaki 
599efec5bcStnozaki 	__mb_len_max_runtime = 32;
609efec5bcStnozaki 	return __setlocale(category, locale);
619efec5bcStnozaki }
62