summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-11-04 23:11:03 +0000
committerJim Meyering <jim@meyering.net>1999-11-04 23:11:03 +0000
commit0b7aeab2545f30dfa9e66f9c9417fcc8c3bc8cf1 (patch)
treec55a3eb30e06d74bf65cbe6e4a529403ac36f031 /src
parentb4e46d54f9042a3833990df145a6e162b21d9126 (diff)
downloadcoreutils-0b7aeab2545f30dfa9e66f9c9417fcc8c3bc8cf1.tar.xz
(compare_files):
Do not consider newline to be part of a line when comparing lines in `sort' and `comm'. POSIX.2 requires that we consider newline, but this is a bug in the spec and the bug will likely be fixed.
Diffstat (limited to 'src')
-rw-r--r--src/comm.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/comm.c b/src/comm.c
index 2e069d659..502090285 100644
--- a/src/comm.c
+++ b/src/comm.c
@@ -177,13 +177,13 @@ compare_files (char **infiles)
{
#ifdef ENABLE_NLS
if (hard_LC_COLLATE)
- order = memcoll (thisline[0]->buffer, thisline[0]->length,
- thisline[1]->buffer, thisline[1]->length);
+ order = memcoll (thisline[0]->buffer, thisline[0]->length - 1,
+ thisline[1]->buffer, thisline[1]->length - 1);
else
#endif
{
- order = memcmp (thisline[0]->buffer, thisline[1]->buffer,
- min (thisline[0]->length, thisline[1]->length));
+ size_t len = min (thisline[0]->length, thisline[1]->length) - 1;
+ order = memcmp (thisline[0]->buffer, thisline[1]->buffer, len);
if (order == 0)
order = thisline[0]->length - thisline[1]->length;
}