summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1996-09-17 19:27:06 +0000
committerache <ache@FreeBSD.org>1996-09-17 19:27:06 +0000
commitcf052c0bedcc7ac65ce6cdbe3142bedd3535bf10 (patch)
treeaec5be0a1d22f51d0df0b1cd90ecc2f6290adcbe /lib/libc
parent66b8e001744b6aa39013edd161ca16ec2df1b393 (diff)
downloadFreeBSD-src-cf052c0bedcc7ac65ce6cdbe3142bedd3535bf10.zip
FreeBSD-src-cf052c0bedcc7ac65ce6cdbe3142bedd3535bf10.tar.gz
Add comment explaining what function does
Cover strcoll return 0 case too
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 63155e5..c5acf73 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);
}
OpenPOWER on IntegriCloud