rebase patches on top of upstream
This commit is contained in:
parent
1abe689c6a
commit
c8beeadadb
2 changed files with 69 additions and 69 deletions
|
|
@ -16,15 +16,15 @@ diff --git a/src/expand-common.c b/src/expand-common.c
|
|||
index 4657e46..97cbb09 100644
|
||||
--- a/src/expand-common.c
|
||||
+++ b/src/expand-common.c
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
+#include <mbfile.h>
|
||||
#include "system.h"
|
||||
#include "die.h"
|
||||
#include "error.h"
|
||||
@@ -105,6 +106,119 @@ set_extend_size (uintmax_t tabval)
|
||||
@@ -126,6 +127,119 @@ set_increment_size (uintmax_t tabval)
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
|
@ -171,7 +171,7 @@ diff --git a/src/expand.c b/src/expand.c
|
|||
index 310b349..4136824 100644
|
||||
--- a/src/expand.c
|
||||
+++ b/src/expand.c
|
||||
@@ -105,11 +105,33 @@ expand (void)
|
||||
@@ -103,11 +103,33 @@ expand (void)
|
||||
FILE *fp = next_file (NULL);
|
||||
mb_file_t mbf;
|
||||
mbf_char_t c;
|
||||
|
|
@ -206,7 +206,7 @@ index 310b349..4136824 100644
|
|||
|
||||
while (true)
|
||||
{
|
||||
@@ -134,6 +156,27 @@ expand (void)
|
||||
@@ -132,6 +154,27 @@ expand (void)
|
||||
if ((mb_iseof (c)) && (fp = next_file (fp)))
|
||||
{
|
||||
mbf_init (mbf, fp);
|
||||
|
|
|
|||
|
|
@ -845,7 +845,7 @@ index 98b461c..9990f38 100644
|
|||
xfields (line);
|
||||
|
||||
if (prevline[which - 1])
|
||||
@@ -567,21 +807,28 @@ prfield (size_t n, struct line const *line)
|
||||
@@ -563,21 +803,28 @@ prfield (size_t n, struct line const *line)
|
||||
|
||||
/* Output all the fields in line, other than the join field. */
|
||||
|
||||
|
|
@ -877,7 +877,7 @@ index 98b461c..9990f38 100644
|
|||
prfield (i, line);
|
||||
}
|
||||
}
|
||||
@@ -592,7 +839,6 @@ static void
|
||||
@@ -588,7 +835,6 @@ static void
|
||||
prjoin (struct line const *line1, struct line const *line2)
|
||||
{
|
||||
const struct outlist *outlist;
|
||||
|
|
@ -885,7 +885,7 @@ index 98b461c..9990f38 100644
|
|||
size_t field;
|
||||
struct line const *line;
|
||||
|
||||
@@ -626,7 +872,7 @@ prjoin (struct line const *line1, struct line const *line2)
|
||||
@@ -622,7 +868,7 @@ prjoin (struct line const *line1, struct line const *line2)
|
||||
o = o->next;
|
||||
if (o == NULL)
|
||||
break;
|
||||
|
|
@ -894,7 +894,7 @@ index 98b461c..9990f38 100644
|
|||
}
|
||||
putchar (eolchar);
|
||||
}
|
||||
@@ -1104,20 +1350,43 @@ main (int argc, char **argv)
|
||||
@@ -1099,20 +1345,43 @@ main (int argc, char **argv)
|
||||
|
||||
case 't':
|
||||
{
|
||||
|
|
@ -1171,7 +1171,7 @@ index 26f221f..633f50e 100644
|
|||
use_col_separator = true;
|
||||
if (optarg)
|
||||
separator_string (optarg);
|
||||
@@ -1166,10 +1250,45 @@ getoptnum (const char *n_str, int min, int *num, const char *err)
|
||||
@@ -1165,10 +1249,45 @@ getoptnum (const char *n_str, int min, int *num, const char *err)
|
||||
a number. */
|
||||
|
||||
static void
|
||||
|
|
@ -1219,7 +1219,7 @@ index 26f221f..633f50e 100644
|
|||
if (*arg)
|
||||
{
|
||||
long int tmp_long;
|
||||
@@ -1191,6 +1310,11 @@ static void
|
||||
@@ -1190,6 +1309,11 @@ static void
|
||||
init_parameters (int number_of_files)
|
||||
{
|
||||
int chars_used_by_number = 0;
|
||||
|
|
@ -1231,7 +1231,7 @@ index 26f221f..633f50e 100644
|
|||
|
||||
lines_per_body = lines_per_page - lines_per_header - lines_per_footer;
|
||||
if (lines_per_body <= 0)
|
||||
@@ -1228,7 +1352,7 @@ init_parameters (int number_of_files)
|
||||
@@ -1227,7 +1351,7 @@ init_parameters (int number_of_files)
|
||||
else
|
||||
col_sep_string = column_separator;
|
||||
|
||||
|
|
@ -1240,7 +1240,7 @@ index 26f221f..633f50e 100644
|
|||
use_col_separator = true;
|
||||
}
|
||||
/* It's rather pointless to define a TAB separator with column
|
||||
@@ -1258,11 +1382,11 @@ init_parameters (int number_of_files)
|
||||
@@ -1257,11 +1381,11 @@ init_parameters (int number_of_files)
|
||||
+ TAB_WIDTH (chars_per_input_tab, chars_per_number); */
|
||||
|
||||
/* Estimate chars_per_text without any margin and keep it constant. */
|
||||
|
|
@ -1254,7 +1254,7 @@ index 26f221f..633f50e 100644
|
|||
|
||||
/* The number is part of the column width unless we are
|
||||
printing files in parallel. */
|
||||
@@ -1271,7 +1395,7 @@ init_parameters (int number_of_files)
|
||||
@@ -1270,7 +1394,7 @@ init_parameters (int number_of_files)
|
||||
}
|
||||
|
||||
int sep_chars, useful_chars;
|
||||
|
|
@ -1263,7 +1263,7 @@ index 26f221f..633f50e 100644
|
|||
sep_chars = INT_MAX;
|
||||
if (INT_SUBTRACT_WRAPV (chars_per_line - chars_used_by_number, sep_chars,
|
||||
&useful_chars))
|
||||
@@ -1294,7 +1418,7 @@ init_parameters (int number_of_files)
|
||||
@@ -1293,7 +1417,7 @@ init_parameters (int number_of_files)
|
||||
We've to use 8 as the lower limit, if we use chars_per_default_tab = 8
|
||||
to expand a tab which is not an input_tab-char. */
|
||||
free (clump_buff);
|
||||
|
|
@ -1272,7 +1272,7 @@ index 26f221f..633f50e 100644
|
|||
}
|
||||
|
||||
/* Open the necessary files,
|
||||
@@ -1402,7 +1526,7 @@ init_funcs (void)
|
||||
@@ -1399,7 +1523,7 @@ init_funcs (void)
|
||||
|
||||
/* Enlarge p->start_position of first column to use the same form of
|
||||
padding_not_printed with all columns. */
|
||||
|
|
@ -1281,7 +1281,7 @@ index 26f221f..633f50e 100644
|
|||
|
||||
/* This loop takes care of all but the rightmost column. */
|
||||
|
||||
@@ -1436,7 +1560,7 @@ init_funcs (void)
|
||||
@@ -1433,7 +1557,7 @@ init_funcs (void)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1290,7 +1290,7 @@ index 26f221f..633f50e 100644
|
|||
h_next = h + chars_per_column;
|
||||
}
|
||||
}
|
||||
@@ -1727,9 +1851,9 @@ static void
|
||||
@@ -1724,9 +1848,9 @@ static void
|
||||
align_column (COLUMN *p)
|
||||
{
|
||||
padding_not_printed = p->start_position;
|
||||
|
|
@ -1302,7 +1302,7 @@ index 26f221f..633f50e 100644
|
|||
padding_not_printed = ANYWHERE;
|
||||
}
|
||||
|
||||
@@ -2004,13 +2128,13 @@ store_char (char c)
|
||||
@@ -2001,13 +2125,13 @@ store_char (char c)
|
||||
/* May be too generous. */
|
||||
buff = X2REALLOC (buff, &buff_allocated);
|
||||
}
|
||||
|
|
@ -1318,7 +1318,7 @@ index 26f221f..633f50e 100644
|
|||
char *s;
|
||||
int num_width;
|
||||
|
||||
@@ -2027,22 +2151,24 @@ add_line_number (COLUMN *p)
|
||||
@@ -2024,22 +2148,24 @@ add_line_number (COLUMN *p)
|
||||
/* Tabification is assumed for multiple columns, also for n-separators,
|
||||
but 'default n-separator = TAB' hasn't been given priority over
|
||||
equal column_width also specified by POSIX. */
|
||||
|
|
@ -1347,7 +1347,7 @@ index 26f221f..633f50e 100644
|
|||
output_position = POS_AFTER_TAB (chars_per_output_tab,
|
||||
output_position);
|
||||
}
|
||||
@@ -2203,7 +2329,7 @@ print_white_space (void)
|
||||
@@ -2198,7 +2324,7 @@ print_white_space (void)
|
||||
while (goal - h_old > 1
|
||||
&& (h_new = POS_AFTER_TAB (chars_per_output_tab, h_old)) <= goal)
|
||||
{
|
||||
|
|
@ -1356,7 +1356,7 @@ index 26f221f..633f50e 100644
|
|||
h_old = h_new;
|
||||
}
|
||||
while (++h_old <= goal)
|
||||
@@ -2223,6 +2349,7 @@ print_sep_string (void)
|
||||
@@ -2218,6 +2344,7 @@ print_sep_string (void)
|
||||
{
|
||||
char const *s = col_sep_string;
|
||||
int l = col_sep_length;
|
||||
|
|
@ -1364,7 +1364,7 @@ index 26f221f..633f50e 100644
|
|||
|
||||
if (separators_not_printed <= 0)
|
||||
{
|
||||
@@ -2234,6 +2361,7 @@ print_sep_string (void)
|
||||
@@ -2229,6 +2356,7 @@ print_sep_string (void)
|
||||
{
|
||||
for (; separators_not_printed > 0; --separators_not_printed)
|
||||
{
|
||||
|
|
@ -1372,7 +1372,7 @@ index 26f221f..633f50e 100644
|
|||
while (l-- > 0)
|
||||
{
|
||||
/* 3 types of sep_strings: spaces only, spaces and chars,
|
||||
@@ -2247,12 +2375,15 @@ print_sep_string (void)
|
||||
@@ -2242,12 +2370,15 @@ print_sep_string (void)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1389,7 +1389,7 @@ index 26f221f..633f50e 100644
|
|||
/* sep_string ends with some spaces */
|
||||
if (spaces_not_printed > 0)
|
||||
print_white_space ();
|
||||
@@ -2280,7 +2411,7 @@ print_clump (COLUMN *p, int n, char *clump)
|
||||
@@ -2275,7 +2406,7 @@ print_clump (COLUMN *p, int n, char *clump)
|
||||
required number of tabs and spaces. */
|
||||
|
||||
static void
|
||||
|
|
@ -1398,7 +1398,7 @@ index 26f221f..633f50e 100644
|
|||
{
|
||||
if (tabify_output)
|
||||
{
|
||||
@@ -2304,6 +2435,74 @@ print_char (char c)
|
||||
@@ -2299,6 +2430,74 @@ print_char (char c)
|
||||
putchar (c);
|
||||
}
|
||||
|
||||
|
|
@ -1473,7 +1473,7 @@ index 26f221f..633f50e 100644
|
|||
/* Skip to page PAGE before printing.
|
||||
PAGE may be larger than total number of pages. */
|
||||
|
||||
@@ -2483,9 +2682,9 @@ read_line (COLUMN *p)
|
||||
@@ -2476,9 +2675,9 @@ read_line (COLUMN *p)
|
||||
align_empty_cols = false;
|
||||
}
|
||||
|
||||
|
|
@ -1485,8 +1485,8 @@ index 26f221f..633f50e 100644
|
|||
padding_not_printed = ANYWHERE;
|
||||
}
|
||||
|
||||
@@ -2555,7 +2754,7 @@ print_stored (COLUMN *p)
|
||||
int i;
|
||||
@@ -2547,7 +2746,7 @@ print_stored (COLUMN *p)
|
||||
COLUMN *q;
|
||||
|
||||
int line = p->current_line++;
|
||||
- char *first = &buff[line_vector[line]];
|
||||
|
|
@ -1494,7 +1494,7 @@ index 26f221f..633f50e 100644
|
|||
/* FIXME
|
||||
UMR: Uninitialized memory read:
|
||||
* This is occurring while in:
|
||||
@@ -2567,7 +2766,7 @@ print_stored (COLUMN *p)
|
||||
@@ -2559,7 +2758,7 @@ print_stored (COLUMN *p)
|
||||
xmalloc [xmalloc.c:94]
|
||||
init_store_cols [pr.c:1648]
|
||||
*/
|
||||
|
|
@ -1503,7 +1503,7 @@ index 26f221f..633f50e 100644
|
|||
|
||||
pad_vertically = true;
|
||||
|
||||
@@ -2586,9 +2785,9 @@ print_stored (COLUMN *p)
|
||||
@@ -2579,9 +2778,9 @@ print_stored (COLUMN *p)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1515,7 +1515,7 @@ index 26f221f..633f50e 100644
|
|||
padding_not_printed = ANYWHERE;
|
||||
}
|
||||
|
||||
@@ -2601,8 +2800,8 @@ print_stored (COLUMN *p)
|
||||
@@ -2594,8 +2793,8 @@ print_stored (COLUMN *p)
|
||||
if (spaces_not_printed == 0)
|
||||
{
|
||||
output_position = p->start_position + end_vector[line];
|
||||
|
|
@ -1526,7 +1526,7 @@ index 26f221f..633f50e 100644
|
|||
}
|
||||
|
||||
return true;
|
||||
@@ -2621,7 +2820,7 @@ print_stored (COLUMN *p)
|
||||
@@ -2614,7 +2813,7 @@ print_stored (COLUMN *p)
|
||||
number of characters is 1.) */
|
||||
|
||||
static int
|
||||
|
|
@ -1535,7 +1535,7 @@ index 26f221f..633f50e 100644
|
|||
{
|
||||
unsigned char uc = c;
|
||||
char *s = clump_buff;
|
||||
@@ -2631,10 +2830,10 @@ char_to_clump (char c)
|
||||
@@ -2624,10 +2823,10 @@ char_to_clump (char c)
|
||||
int chars;
|
||||
int chars_per_c = 8;
|
||||
|
||||
|
|
@ -1548,7 +1548,7 @@ index 26f221f..633f50e 100644
|
|||
{
|
||||
width = TAB_WIDTH (chars_per_c, input_position);
|
||||
|
||||
@@ -2715,6 +2914,164 @@ char_to_clump (char c)
|
||||
@@ -2708,6 +2907,164 @@ char_to_clump (char c)
|
||||
return chars;
|
||||
}
|
||||
|
||||
|
|
@ -1732,7 +1732,7 @@ index 6d2eec5..f189a0d 100644
|
|||
#include "system.h"
|
||||
#include "argmatch.h"
|
||||
#include "die.h"
|
||||
@@ -165,14 +173,39 @@ static int decimal_point;
|
||||
@@ -169,14 +177,39 @@ static int decimal_point;
|
||||
/* Thousands separator; if -1, then there isn't one. */
|
||||
static int thousands_sep;
|
||||
|
||||
|
|
@ -1773,7 +1773,7 @@ index 6d2eec5..f189a0d 100644
|
|||
/* The kind of blanks for '-b' to skip in various options. */
|
||||
enum blanktype { bl_start, bl_end, bl_both };
|
||||
|
||||
@@ -346,13 +379,11 @@ static bool reverse;
|
||||
@@ -350,13 +383,11 @@ static bool reverse;
|
||||
they were read if all keys compare equal. */
|
||||
static bool stable;
|
||||
|
||||
|
|
@ -1790,7 +1790,7 @@ index 6d2eec5..f189a0d 100644
|
|||
|
||||
/* Flag to remove consecutive duplicate lines from the output.
|
||||
Only the last of a sequence of equal lines will be output. */
|
||||
@@ -811,6 +842,46 @@ reap_all (void)
|
||||
@@ -814,6 +845,46 @@ reap_all (void)
|
||||
reap (-1);
|
||||
}
|
||||
|
||||
|
|
@ -1837,7 +1837,7 @@ index 6d2eec5..f189a0d 100644
|
|||
/* Clean up any remaining temporary files. */
|
||||
|
||||
static void
|
||||
@@ -1255,7 +1326,7 @@ zaptemp (char const *name)
|
||||
@@ -1264,7 +1335,7 @@ zaptemp (char const *name)
|
||||
free (node);
|
||||
}
|
||||
|
||||
|
|
@ -1846,7 +1846,7 @@ index 6d2eec5..f189a0d 100644
|
|||
|
||||
static int
|
||||
struct_month_cmp (void const *m1, void const *m2)
|
||||
@@ -1270,7 +1341,7 @@ struct_month_cmp (void const *m1, void const *m2)
|
||||
@@ -1279,7 +1350,7 @@ struct_month_cmp (void const *m1, void const *m2)
|
||||
/* Initialize the character class tables. */
|
||||
|
||||
static void
|
||||
|
|
@ -1855,7 +1855,7 @@ index 6d2eec5..f189a0d 100644
|
|||
{
|
||||
size_t i;
|
||||
|
||||
@@ -1282,7 +1353,7 @@ inittables (void)
|
||||
@@ -1291,7 +1362,7 @@ inittables (void)
|
||||
fold_toupper[i] = toupper (i);
|
||||
}
|
||||
|
||||
|
|
@ -1864,7 +1864,7 @@ index 6d2eec5..f189a0d 100644
|
|||
/* If we're not in the "C" locale, read different names for months. */
|
||||
if (hard_LC_TIME)
|
||||
{
|
||||
@@ -1364,6 +1435,84 @@ specify_nmerge (int oi, char c, char const *s)
|
||||
@@ -1373,6 +1444,84 @@ specify_nmerge (int oi, char c, char const *s)
|
||||
xstrtol_fatal (e, oi, c, long_options, s);
|
||||
}
|
||||
|
||||
|
|
@ -1949,7 +1949,7 @@ index 6d2eec5..f189a0d 100644
|
|||
/* Specify the amount of main memory to use when sorting. */
|
||||
static void
|
||||
specify_sort_size (int oi, char c, char const *s)
|
||||
@@ -1597,7 +1746,7 @@ buffer_linelim (struct buffer const *buf)
|
||||
@@ -1604,7 +1753,7 @@ buffer_linelim (struct buffer const *buf)
|
||||
by KEY in LINE. */
|
||||
|
||||
static char *
|
||||
|
|
@ -1958,7 +1958,7 @@ index 6d2eec5..f189a0d 100644
|
|||
{
|
||||
char *ptr = line->text, *lim = ptr + line->length - 1;
|
||||
size_t sword = key->sword;
|
||||
@@ -1606,10 +1755,10 @@ begfield (struct line const *line, struct keyfield const *key)
|
||||
@@ -1613,10 +1762,10 @@ begfield (struct line const *line, struct keyfield const *key)
|
||||
/* The leading field separator itself is included in a field when -t
|
||||
is absent. */
|
||||
|
||||
|
|
@ -1971,7 +1971,7 @@ index 6d2eec5..f189a0d 100644
|
|||
++ptr;
|
||||
if (ptr < lim)
|
||||
++ptr;
|
||||
@@ -1635,11 +1784,70 @@ begfield (struct line const *line, struct keyfield const *key)
|
||||
@@ -1642,11 +1791,70 @@ begfield (struct line const *line, struct keyfield const *key)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
|
@ -2043,7 +2043,7 @@ index 6d2eec5..f189a0d 100644
|
|||
{
|
||||
char *ptr = line->text, *lim = ptr + line->length - 1;
|
||||
size_t eword = key->eword, echar = key->echar;
|
||||
@@ -1654,10 +1862,10 @@ limfield (struct line const *line, struct keyfield const *key)
|
||||
@@ -1661,10 +1869,10 @@ limfield (struct line const *line, struct keyfield const *key)
|
||||
'beginning' is the first character following the delimiting TAB.
|
||||
Otherwise, leave PTR pointing at the first 'blank' character after
|
||||
the preceding field. */
|
||||
|
|
@ -2056,7 +2056,7 @@ index 6d2eec5..f189a0d 100644
|
|||
++ptr;
|
||||
if (ptr < lim && (eword || echar))
|
||||
++ptr;
|
||||
@@ -1703,10 +1911,10 @@ limfield (struct line const *line, struct keyfield const *key)
|
||||
@@ -1710,10 +1918,10 @@ limfield (struct line const *line, struct keyfield const *key)
|
||||
*/
|
||||
|
||||
/* Make LIM point to the end of (one byte past) the current field. */
|
||||
|
|
@ -2069,7 +2069,7 @@ index 6d2eec5..f189a0d 100644
|
|||
if (newlim)
|
||||
lim = newlim;
|
||||
}
|
||||
@@ -1737,6 +1945,130 @@ limfield (struct line const *line, struct keyfield const *key)
|
||||
@@ -1744,6 +1952,130 @@ limfield (struct line const *line, struct keyfield const *key)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
|
@ -2200,7 +2200,7 @@ index 6d2eec5..f189a0d 100644
|
|||
/* Fill BUF reading from FP, moving buf->left bytes from the end
|
||||
of buf->buf to the beginning first. If EOF is reached and the
|
||||
file wasn't terminated by a newline, supply one. Set up BUF's line
|
||||
@@ -1823,8 +2155,22 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file)
|
||||
@@ -1830,8 +2162,22 @@ fillbuf (struct buffer *buf, FILE *fp, char const *file)
|
||||
else
|
||||
{
|
||||
if (key->skipsblanks)
|
||||
|
|
@ -2225,7 +2225,7 @@ index 6d2eec5..f189a0d 100644
|
|||
line->keybeg = line_start;
|
||||
}
|
||||
}
|
||||
@@ -1974,7 +2320,7 @@ human_numcompare (char const *a, char const *b)
|
||||
@@ -1981,7 +2327,7 @@ human_numcompare (char const *a, char const *b)
|
||||
hideously fast. */
|
||||
|
||||
static int
|
||||
|
|
@ -2234,7 +2234,7 @@ index 6d2eec5..f189a0d 100644
|
|||
{
|
||||
while (blanks[to_uchar (*a)])
|
||||
a++;
|
||||
@@ -1984,6 +2330,25 @@ numcompare (char const *a, char const *b)
|
||||
@@ -1991,6 +2337,25 @@ numcompare (char const *a, char const *b)
|
||||
return strnumcmp (a, b, decimal_point, thousands_sep);
|
||||
}
|
||||
|
||||
|
|
@ -2260,7 +2260,7 @@ index 6d2eec5..f189a0d 100644
|
|||
/* Work around a problem whereby the long double value returned by glibc's
|
||||
strtold ("NaN", ...) contains uninitialized bits: clear all bytes of
|
||||
A and B before calling strtold. FIXME: remove this function once
|
||||
@@ -2034,7 +2399,7 @@ general_numcompare (char const *sa, char const *sb)
|
||||
@@ -2041,7 +2406,7 @@ general_numcompare (char const *sa, char const *sb)
|
||||
Return 0 if the name in S is not recognized. */
|
||||
|
||||
static int
|
||||
|
|
@ -2269,7 +2269,7 @@ index 6d2eec5..f189a0d 100644
|
|||
{
|
||||
size_t lo = 0;
|
||||
size_t hi = MONTHS_PER_YEAR;
|
||||
@@ -2310,15 +2675,14 @@ debug_key (struct line const *line, struct keyfield const *key)
|
||||
@@ -2317,15 +2682,14 @@ debug_key (struct line const *line, struct keyfield const *key)
|
||||
char saved = *lim;
|
||||
*lim = '\0';
|
||||
|
||||
|
|
@ -2287,7 +2287,7 @@ index 6d2eec5..f189a0d 100644
|
|||
else if (key->general_numeric)
|
||||
ignore_value (strtold (beg, &tighter_lim));
|
||||
else if (key->numeric || key->human_numeric)
|
||||
@@ -2452,7 +2816,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
|
||||
@@ -2459,7 +2823,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
|
||||
/* Warn about significant leading blanks. */
|
||||
bool implicit_skip = key_numeric (key) || key->month;
|
||||
bool line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y */
|
||||
|
|
@ -2296,7 +2296,7 @@ index 6d2eec5..f189a0d 100644
|
|||
&& ((!key->skipsblanks && !implicit_skip)
|
||||
|| (!key->skipsblanks && key->schar)
|
||||
|| (!key->skipeblanks && key->echar)))
|
||||
@@ -2510,11 +2874,87 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
|
||||
@@ -2517,11 +2881,87 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
|
||||
error (0, 0, _("option '-r' only applies to last-resort comparison"));
|
||||
}
|
||||
|
||||
|
|
@ -2385,7 +2385,7 @@ index 6d2eec5..f189a0d 100644
|
|||
{
|
||||
struct keyfield *key = keylist;
|
||||
|
||||
@@ -2599,7 +3039,7 @@ keycompare (struct line const *a, struct line const *b)
|
||||
@@ -2606,7 +3046,7 @@ keycompare (struct line const *a, struct line const *b)
|
||||
else if (key->human_numeric)
|
||||
diff = human_numcompare (ta, tb);
|
||||
else if (key->month)
|
||||
|
|
@ -2394,7 +2394,7 @@ index 6d2eec5..f189a0d 100644
|
|||
else if (key->random)
|
||||
diff = compare_random (ta, tlena, tb, tlenb);
|
||||
else if (key->version)
|
||||
@@ -2715,6 +3155,211 @@ keycompare (struct line const *a, struct line const *b)
|
||||
@@ -2722,6 +3162,211 @@ keycompare (struct line const *a, struct line const *b)
|
||||
return key->reverse ? -diff : diff;
|
||||
}
|
||||
|
||||
|
|
@ -2606,16 +2606,16 @@ index 6d2eec5..f189a0d 100644
|
|||
/* Compare two lines A and B, returning negative, zero, or positive
|
||||
depending on whether A compares less than, equal to, or greater than B. */
|
||||
|
||||
@@ -2742,7 +3387,7 @@ compare (struct line const *a, struct line const *b)
|
||||
@@ -2749,7 +3394,7 @@ compare (struct line const *a, struct line const *b)
|
||||
diff = - NONZERO (blen);
|
||||
else if (blen == 0)
|
||||
diff = 1;
|
||||
- else if (hard_LC_COLLATE)
|
||||
+ else if (hard_LC_COLLATE && !folding)
|
||||
{
|
||||
/* Note xmemcoll0 is a performance enhancement as
|
||||
/* xmemcoll0 is a performance enhancement as
|
||||
it will not unconditionally write '\0' after the
|
||||
@@ -4139,6 +4784,7 @@ set_ordering (char const *s, struct keyfield *key, enum blanktype blanktype)
|
||||
@@ -4144,6 +4789,7 @@ set_ordering (char const *s, struct keyfield *key, enum blanktype blanktype)
|
||||
break;
|
||||
case 'f':
|
||||
key->translate = fold_toupper;
|
||||
|
|
@ -2623,7 +2623,7 @@ index 6d2eec5..f189a0d 100644
|
|||
break;
|
||||
case 'g':
|
||||
key->general_numeric = true;
|
||||
@@ -4218,7 +4864,7 @@ main (int argc, char **argv)
|
||||
@@ -4223,7 +4869,7 @@ main (int argc, char **argv)
|
||||
initialize_exit_failure (SORT_FAILURE);
|
||||
|
||||
hard_LC_COLLATE = hard_locale (LC_COLLATE);
|
||||
|
|
@ -2632,7 +2632,7 @@ index 6d2eec5..f189a0d 100644
|
|||
hard_LC_TIME = hard_locale (LC_TIME);
|
||||
#endif
|
||||
|
||||
@@ -4239,6 +4885,29 @@ main (int argc, char **argv)
|
||||
@@ -4244,6 +4890,29 @@ main (int argc, char **argv)
|
||||
thousands_sep = -1;
|
||||
}
|
||||
|
||||
|
|
@ -2662,7 +2662,7 @@ index 6d2eec5..f189a0d 100644
|
|||
have_read_stdin = false;
|
||||
inittables ();
|
||||
|
||||
@@ -4513,13 +5182,34 @@ main (int argc, char **argv)
|
||||
@@ -4518,13 +5187,34 @@ main (int argc, char **argv)
|
||||
|
||||
case 't':
|
||||
{
|
||||
|
|
@ -2701,7 +2701,7 @@ index 6d2eec5..f189a0d 100644
|
|||
else
|
||||
{
|
||||
/* Provoke with 'sort -txx'. Complain about
|
||||
@@ -4530,9 +5220,11 @@ main (int argc, char **argv)
|
||||
@@ -4535,9 +5225,11 @@ main (int argc, char **argv)
|
||||
quote (optarg));
|
||||
}
|
||||
}
|
||||
|
|
@ -2715,7 +2715,7 @@ index 6d2eec5..f189a0d 100644
|
|||
}
|
||||
break;
|
||||
|
||||
@@ -4770,12 +5462,10 @@ main (int argc, char **argv)
|
||||
@@ -4765,12 +5457,10 @@ main (int argc, char **argv)
|
||||
sort (files, nfiles, outfile, nthreads);
|
||||
}
|
||||
|
||||
|
|
@ -3157,7 +3157,7 @@ diff --git a/tests/local.mk b/tests/local.mk
|
|||
index 568944e..192f776 100644
|
||||
--- a/tests/local.mk
|
||||
+++ b/tests/local.mk
|
||||
@@ -352,6 +352,8 @@ all_tests = \
|
||||
@@ -358,6 +358,8 @@ all_tests = \
|
||||
tests/misc/sort-discrim.sh \
|
||||
tests/misc/sort-files0-from.pl \
|
||||
tests/misc/sort-float.sh \
|
||||
|
|
@ -3212,8 +3212,8 @@ index 8a9cad1..9293e39 100755
|
|||
my @Tests =
|
||||
(
|
||||
['t1', '--tabs=3', {IN=>"a\tb"}, {OUT=>"a b"}],
|
||||
@@ -152,6 +161,8 @@ my @Tests =
|
||||
['trail9', '--tab=1,2 -t/5',{IN=>"\ta\tb\tc"}, {OUT=>" a b c"}],
|
||||
@@ -168,6 +177,8 @@ my @Tests =
|
||||
|
||||
|
||||
# Test errors
|
||||
+ # FIXME: The following tests contain ‘quoting’ specific to LC_MESSAGES
|
||||
|
|
@ -3221,7 +3221,7 @@ index 8a9cad1..9293e39 100755
|
|||
['e1', '--tabs="a"', {IN=>''}, {OUT=>''}, {EXIT=>1},
|
||||
{ERR => "$prog: tab size contains invalid character(s): 'a'\n"}],
|
||||
['e2', "-t $UINTMAX_OFLOW", {IN=>''}, {OUT=>''}, {EXIT=>1},
|
||||
@@ -168,6 +179,37 @@ my @Tests =
|
||||
@@ -184,6 +195,37 @@ my @Tests =
|
||||
{ERR => "$prog: '/' specifier not at start of number: '/'\n"}],
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue