117530Sache/*
217530Sache * Copyright (C) 1996 by Andrey A. Chernov, Moscow, Russia.
317530Sache * All rights reserved.
417530Sache *
5227753Stheraven * Copyright (c) 2011 The FreeBSD Foundation
6227753Stheraven * All rights reserved.
7227753Stheraven * Portions of this software were developed by David Chisnall
8227753Stheraven * under sponsorship from the FreeBSD Foundation.
9227753Stheraven *
1017530Sache * Redistribution and use in source and binary forms, with or without
1117530Sache * modification, are permitted provided that the following conditions
1217530Sache * are met:
1317530Sache * 1. Redistributions of source code must retain the above copyright
1417530Sache *    notice, this list of conditions and the following disclaimer.
1517530Sache * 2. Redistributions in binary form must reproduce the above copyright
1617530Sache *    notice, this list of conditions and the following disclaimer in the
1717530Sache *    documentation and/or other materials provided with the distribution.
1817530Sache *
1917530Sache * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
2017530Sache * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2117530Sache * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2217530Sache * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2317530Sache * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2417530Sache * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2517530Sache * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2617530Sache * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2717530Sache * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2817530Sache * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2917530Sache * SUCH DAMAGE.
3017530Sache */
3117530Sache
3292986Sobrien#include <sys/cdefs.h>
3392986Sobrien__FBSDID("$FreeBSD$");
3492986Sobrien
3517530Sache#include <string.h>
36227753Stheraven#include <xlocale.h>
37118396Sache#include "collate.h"
3817551Sache
3918331Sache/*
40118378Sache * Compare two characters using collate
4118331Sache */
4218331Sache
43227753Stheravenint __collate_range_cmp(struct xlocale_collate *table, int c1, int c2)
4417551Sache{
4517530Sache	static char s1[2], s2[2];
4617530Sache
4717551Sache	s1[0] = c1;
4817551Sache	s2[0] = c2;
49227753Stheraven	struct _xlocale l = {{0}};
50227753Stheraven	l.components[XLC_COLLATE] = (struct xlocale_component *)table;
51227753Stheraven	return (strcoll_l(s1, s2, &l));
5217530Sache}
53