From 0b7aeab2545f30dfa9e66f9c9417fcc8c3bc8cf1 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 4 Nov 1999 23:11:03 +0000 Subject: [PATCH] (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. --- src/comm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/comm.c b/src/comm.c index 2e069d6597..5020902850 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; } -- 2.47.3