lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | #include <stdio.h> |
| 2 | #include <string.h> |
| 3 | #include <locale.h> |
| 4 | |
| 5 | int |
| 6 | main (void) |
| 7 | { |
| 8 | const char t1[] = "0-0-0-0-0-0-0-0-0-0.COM"; |
| 9 | const char t2[] = "00000-00000.COM"; |
| 10 | int res1; |
| 11 | int res2; |
| 12 | |
| 13 | setlocale (LC_ALL, "en_US.ISO-8859-1"); |
| 14 | |
| 15 | res1 = strcoll (t1, t2); |
| 16 | printf ("strcoll (\"%s\", \"%s\") = %d\n", t1, t2, res1); |
| 17 | res2 = strcoll (t2, t1); |
| 18 | printf ("strcoll (\"%s\", \"%s\") = %d\n", t2, t1, res2); |
| 19 | |
| 20 | return ((res1 == 0 && res2 != 0) |
| 21 | || (res1 != 0 && res2 == 0) |
| 22 | || (res1 < 0 && res2 < 0) |
| 23 | || (res1 > 0 && res2 > 0)); |
| 24 | } |