summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>1996-09-17 19:27:06 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>1996-09-17 19:27:06 +0000
commitcb07d7668c5de4b38b5daf9cb861e9138ad42187 (patch)
treeaec5be0a1d22f51d0df0b1cd90ecc2f6290adcbe /lib/libc
parent7b8830a51e1b2165879cf6ad6b6374d037bdfca1 (diff)
Notes
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/locale/collcmp.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/libc/locale/collcmp.c b/lib/libc/locale/collcmp.c
index 63155e521406..c5acf73cd2db 100644
--- a/lib/libc/locale/collcmp.c
+++ b/lib/libc/locale/collcmp.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: collcmp.c,v 1.5 1996/08/14 19:47:02 ache Exp $
*/
#include <ctype.h>
@@ -31,10 +31,16 @@
#include <limits.h>
#include <locale.h>
+/*
+ * Compare two characters converting collate information
+ * into ASCII-compatible range, it allows to handle
+ * "[a-z]"-type ranges with national characters.
+ */
+
int collate_range_cmp (c1, c2)
int c1, c2;
{
- int as1, as2, al1, al2;
+ int as1, as2, al1, al2, ret;
static char s1[2], s2[2];
c1 &= UCHAR_MAX;
@@ -65,5 +71,7 @@ int collate_range_cmp (c1, c2)
s1[0] = c1;
s2[0] = c2;
- return strcoll(s1, s2);
+ if ((ret = strcoll(s1, s2)) != 0)
+ return (ret);
+ return (c1 - c2);
}