Back to index

glibc  2.9
bug-strcoll1.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <string.h>
00003 #include <locale.h>
00004 
00005 int
00006 main (void)
00007 {
00008   const char t1[] = "0-0-0-0-0-0-0-0-0-0.COM";
00009   const char t2[] = "00000-00000.COM";
00010   int res1;
00011   int res2;
00012 
00013   setlocale (LC_ALL, "en_US.ISO-8859-1");
00014 
00015   res1 = strcoll (t1, t2);
00016   printf ("strcoll (\"%s\", \"%s\") = %d\n", t1, t2, res1);
00017   res2 = strcoll (t2, t1);
00018   printf ("strcoll (\"%s\", \"%s\") = %d\n", t2, t1, res2);
00019 
00020   return ((res1 == 0 && res2 != 0)
00021          || (res1 != 0 && res2 == 0)
00022          || (res1 < 0 && res2 < 0)
00023          || (res1 > 0 && res2 > 0));
00024 }