| … | |
… | |
| 2202 | -keycompare (const struct line *a, const struct line *b) |
2202 | -keycompare (const struct line *a, const struct line *b) |
| 2203 | +keycompare_uni (const struct line *a, const struct line *b) |
2203 | +keycompare_uni (const struct line *a, const struct line *b) |
| 2204 | { |
2204 | { |
| 2205 | struct keyfield const *key = keylist; |
2205 | struct keyfield const *key = keylist; |
| 2206 | |
2206 | |
| 2207 | @@ -1875,6 +2265,179 @@ |
2207 | @@ -1875,6 +2265,181 @@ |
| 2208 | return key->reverse ? -diff : diff; |
2208 | return key->reverse ? -diff : diff; |
| 2209 | } |
2209 | } |
| 2210 | |
2210 | |
| 2211 | +#if HAVE_MBRTOWC |
2211 | +#if HAVE_MBRTOWC |
| 2212 | +static int |
2212 | +static int |
| … | |
… | |
| 2252 | + else |
2252 | + else |
| 2253 | + diff = ((key->numeric ? numcompare : general_numcompare) |
2253 | + diff = ((key->numeric ? numcompare : general_numcompare) |
| 2254 | + (texta, textb)); |
2254 | + (texta, textb)); |
| 2255 | + *lima = savea, *limb = saveb; |
2255 | + *lima = savea, *limb = saveb; |
| 2256 | + } |
2256 | + } |
|
|
2257 | + else if (key->version) |
|
|
2258 | + diff = compare_version (texta, lena, textb, lenb); |
| 2257 | + else if (key->month) |
2259 | + else if (key->month) |
| 2258 | + diff = getmonth (texta, lena) - getmonth (textb, lenb); |
2260 | + diff = getmonth (texta, lena) - getmonth (textb, lenb); |
| 2259 | + else |
2261 | + else |
| 2260 | + { |
2262 | + { |
| 2261 | + if (ignore || translate) |
2263 | + if (ignore || translate) |
| … | |
… | |
| 2382 | +#endif |
2384 | +#endif |
| 2383 | + |
2385 | + |
| 2384 | /* Compare two lines A and B, returning negative, zero, or positive |
2386 | /* Compare two lines A and B, returning negative, zero, or positive |
| 2385 | depending on whether A compares less than, equal to, or greater than B. */ |
2387 | depending on whether A compares less than, equal to, or greater than B. */ |
| 2386 | |
2388 | |
| 2387 | @@ -2744,7 +3305,7 @@ |
2389 | @@ -2744,7 +3307,7 @@ |
| 2388 | initialize_exit_failure (SORT_FAILURE); |
2390 | initialize_exit_failure (SORT_FAILURE); |
| 2389 | |
2391 | |
| 2390 | hard_LC_COLLATE = hard_locale (LC_COLLATE); |
2392 | hard_LC_COLLATE = hard_locale (LC_COLLATE); |
| 2391 | -#if HAVE_NL_LANGINFO |
2393 | -#if HAVE_NL_LANGINFO |
| 2392 | +#if HAVE_LANGINFO_CODESET |
2394 | +#if HAVE_LANGINFO_CODESET |
| 2393 | hard_LC_TIME = hard_locale (LC_TIME); |
2395 | hard_LC_TIME = hard_locale (LC_TIME); |
| 2394 | #endif |
2396 | #endif |
| 2395 | |
2397 | |
| 2396 | @@ -2765,6 +3326,27 @@ |
2398 | @@ -2765,6 +3328,27 @@ |
| 2397 | thousands_sep = -1; |
2399 | thousands_sep = -1; |
| 2398 | } |
2400 | } |
| 2399 | |
2401 | |
| 2400 | +#if HAVE_MBRTOWC |
2402 | +#if HAVE_MBRTOWC |
| 2401 | + if (MB_CUR_MAX > 1) |
2403 | + if (MB_CUR_MAX > 1) |
| … | |
… | |
| 2419 | + } |
2421 | + } |
| 2420 | + |
2422 | + |
| 2421 | have_read_stdin = false; |
2423 | have_read_stdin = false; |
| 2422 | inittables (); |
2424 | inittables (); |
| 2423 | |
2425 | |
| 2424 | @@ -3015,13 +3597,35 @@ |
2426 | @@ -3015,13 +3599,35 @@ |
| 2425 | |
2427 | |
| 2426 | case 't': |
2428 | case 't': |
| 2427 | { |
2429 | { |
| 2428 | - char newtab = optarg[0]; |
2430 | - char newtab = optarg[0]; |
| 2429 | - if (! newtab) |
2431 | - if (! newtab) |
| … | |
… | |
| 2459 | - newtab = '\0'; |
2461 | - newtab = '\0'; |
| 2460 | + newtab[0] = '\0'; |
2462 | + newtab[0] = '\0'; |
| 2461 | else |
2463 | else |
| 2462 | { |
2464 | { |
| 2463 | /* Provoke with `sort -txx'. Complain about |
2465 | /* Provoke with `sort -txx'. Complain about |
| 2464 | @@ -3032,9 +3636,12 @@ |
2466 | @@ -3032,9 +3638,12 @@ |
| 2465 | quote (optarg)); |
2467 | quote (optarg)); |
| 2466 | } |
2468 | } |
| 2467 | } |
2469 | } |
| 2468 | - if (tab != TAB_DEFAULT && tab != newtab) |
2470 | - if (tab != TAB_DEFAULT && tab != newtab) |
| 2469 | + if (tab_length |
2471 | + if (tab_length |