summaryrefslogtreecommitdiff
path: root/src/join.c
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2016-01-12 16:29:32 +0000
committerPádraig Brady <P@draigBrady.com>2016-01-13 10:59:18 +0000
commitb2eadd109c3a508011705761dfe24a35180d925d (patch)
tree7efae6e5d2ba65a74b2e22e1160f0dd6a4013ce6 /src/join.c
parentd44ae88199ebf44fe721c06621a7ffc442fa34be (diff)
downloadcoreutils-b2eadd109c3a508011705761dfe24a35180d925d.tar.xz
join,sort,uniq: with -z, treat '\n' as a field separator
* NEWS: Mention the change in behavior. * doc/coreutils.texi (newlineFieldSeparator): A new description, referenced from ({join,sort,uniq} invocation). * src/system.h (field_sep): A new inline function to determine if a character is a field separator. * src/join.c (usage): s/whitespace/blank/ to be more accurate wrt which characters are field separators. (xfields): s/isblank/field_sep/. * src/sort.c (inittables): Likewise. * src/uniq.c (find_field): Likewise. * tests/misc/join.pl: Adjust -z test, and add a test/example for processing the whole record with field processing. * tests/misc/sort.pl: Add -z test cases, including case with '\n'. * tests/misc/uniq.pl: Add -z -f test case with \n.
Diffstat (limited to 'src/join.c')
-rw-r--r--src/join.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/join.c b/src/join.c
index 8686428fb..9b25da667 100644
--- a/src/join.c
+++ b/src/join.c
@@ -194,7 +194,7 @@ Usage: %s [OPTION]... FILE1 FILE2\n\
program_name);
fputs (_("\
For each pair of input lines with identical join fields, write a line to\n\
-standard output. The default join field is the first, delimited by whitespace.\
+standard output. The default join field is the first, delimited by blanks.\
\n\
"), stdout);
fputs (_("\
@@ -284,19 +284,19 @@ xfields (struct line *line)
else if (tab < 0)
{
/* Skip leading blanks before the first field. */
- while (isblank (to_uchar (*ptr)))
+ while (field_sep (*ptr))
if (++ptr == lim)
return;
do
{
char *sep;
- for (sep = ptr + 1; sep != lim && ! isblank (to_uchar (*sep)); sep++)
+ for (sep = ptr + 1; sep != lim && ! field_sep (*sep); sep++)
continue;
extract_field (line, ptr, sep - ptr);
if (sep == lim)
return;
- for (ptr = sep + 1; ptr != lim && isblank (to_uchar (*ptr)); ptr++)
+ for (ptr = sep + 1; ptr != lim && field_sep (*ptr); ptr++)
continue;
}
while (ptr != lim);