xref: /freebsd/lib/libc/locale/collcmp.c (revision a9d25ab17f022127a6ea13aab4f40dbc80f6f07c)
12eecfbacSAndrey A. Chernov /*
22eecfbacSAndrey A. Chernov  * Copyright (C) 1996 by Andrey A. Chernov, Moscow, Russia.
32eecfbacSAndrey A. Chernov  * All rights reserved.
42eecfbacSAndrey A. Chernov  *
52eecfbacSAndrey A. Chernov  * Redistribution and use in source and binary forms, with or without
62eecfbacSAndrey A. Chernov  * modification, are permitted provided that the following conditions
72eecfbacSAndrey A. Chernov  * are met:
82eecfbacSAndrey A. Chernov  * 1. Redistributions of source code must retain the above copyright
92eecfbacSAndrey A. Chernov  *    notice, this list of conditions and the following disclaimer.
102eecfbacSAndrey A. Chernov  * 2. Redistributions in binary form must reproduce the above copyright
112eecfbacSAndrey A. Chernov  *    notice, this list of conditions and the following disclaimer in the
122eecfbacSAndrey A. Chernov  *    documentation and/or other materials provided with the distribution.
132eecfbacSAndrey A. Chernov  *
142eecfbacSAndrey A. Chernov  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
152eecfbacSAndrey A. Chernov  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
162eecfbacSAndrey A. Chernov  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
172eecfbacSAndrey A. Chernov  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
182eecfbacSAndrey A. Chernov  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
192eecfbacSAndrey A. Chernov  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
202eecfbacSAndrey A. Chernov  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
212eecfbacSAndrey A. Chernov  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
222eecfbacSAndrey A. Chernov  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
232eecfbacSAndrey A. Chernov  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
242eecfbacSAndrey A. Chernov  * SUCH DAMAGE.
252eecfbacSAndrey A. Chernov  */
262eecfbacSAndrey A. Chernov 
27333fc21eSDavid E. O'Brien #include <sys/cdefs.h>
28333fc21eSDavid E. O'Brien __FBSDID("$FreeBSD$");
29333fc21eSDavid E. O'Brien 
302eecfbacSAndrey A. Chernov #include <string.h>
31a9d25ab1SAndrey A. Chernov #include "collate.h"
32883a3266SAndrey A. Chernov 
33cb07d766SAndrey A. Chernov /*
348841d008SAndrey A. Chernov  * Compare two characters using collate
35cb07d766SAndrey A. Chernov  */
36cb07d766SAndrey A. Chernov 
3738aa46cdSAndrey A. Chernov int __collate_range_cmp(c1, c2)
38883a3266SAndrey A. Chernov 	int c1, c2;
392eecfbacSAndrey A. Chernov {
402eecfbacSAndrey A. Chernov 	static char s1[2], s2[2];
412eecfbacSAndrey A. Chernov 
42883a3266SAndrey A. Chernov 	s1[0] = c1;
43883a3266SAndrey A. Chernov 	s2[0] = c2;
4417f67afeSAndrey A. Chernov 	return (strcoll(s1, s2));
452eecfbacSAndrey A. Chernov }
46