4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore/*
6b5e5868e7ebf1aff3a5abd7d0c4ef0e5fbf3648Garrett D'Amore * This file and its contents are supplied under the terms of the
6b5e5868e7ebf1aff3a5abd7d0c4ef0e5fbf3648Garrett D'Amore * Common Development and Distribution License ("CDDL"), version 1.0.
5aec55eb0591d2fcdd38d7dd5408a6ff3456e596Garrett D'Amore * You may only use this file in accordance with the terms of version
6b5e5868e7ebf1aff3a5abd7d0c4ef0e5fbf3648Garrett D'Amore * 1.0 of the CDDL.
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore *
6b5e5868e7ebf1aff3a5abd7d0c4ef0e5fbf3648Garrett D'Amore * A full copy of the text of the CDDL should have accompanied this
5aec55eb0591d2fcdd38d7dd5408a6ff3456e596Garrett D'Amore * source. A copy of the CDDL is also available via the Internet at
5aec55eb0591d2fcdd38d7dd5408a6ff3456e596Garrett D'Amore * http://www.illumos.org/license/CDDL.
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore */
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore/*
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore * Copyright 2013 Garrett D'Amore <garrett@damore.org>
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore */
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore#include "lint.h"
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore#include <ctype.h>
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#include <locale.h>
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#include "localeimpl.h"
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#include "lctype.h"
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore#pragma weak _tolower = tolower
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore#pragma weak _toupper = toupper
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreint
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoretolower_l(int c, locale_t loc)
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore{
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore return (((unsigned)c > 255) ? c : loc->ctype->lc_trans_lower[c]);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore}
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoreint
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amoretoupper_l(int c, locale_t loc)
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore{
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore return (((unsigned)c > 255) ? c : loc->ctype->lc_trans_upper[c]);
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore}
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#undef tolower
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amoreint
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amoretolower(int c)
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore{
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore return (isascii(c) ? __trans_lower[c] : tolower_l(c, uselocale(NULL)));
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore}
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore#undef toupper
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amoreint
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amoretoupper(int c)
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore{
2d08521bd15501c8370ba2153b9cca4f094979d0Garrett D'Amore return (isascii(c) ? __trans_upper[c] : toupper_l(c, uselocale(NULL)));
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore}